Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect timings related with TLS handshake #5647

Merged
merged 9 commits into from May 20, 2024

Conversation

Leewongi0731
Copy link
Contributor

@Leewongi0731 Leewongi0731 commented Apr 28, 2024

Motivation:

Collect the timings related with TLS handshake. If a request was the first in a connection, armeria could also provide it in a RequestLog to tell a user that the request timing has been affected by TLS handshake.

Modifications:

  • Add TLS handshake related field in ClientConnectionTimings
  • Add TLS handshake duration metric field at MetricCollectingClient
  • Start collecting the TLS handshake timer in the case below.
    • If the client is enabled as TCP fast open in the first request, start the timer before the TCP connection.
    • start the timer when netty calls SslHandler.channelActive()

Result:

@Leewongi0731 Leewongi0731 force-pushed the collect-timings branch 2 times, most recently from fdcf3ae to a751fa5 Compare April 28, 2024 14:31
Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! Left some minor comments! 👍

@Leewongi0731
Copy link
Contributor Author

Additionally, shouldn't the check condition at the bottom be >0 instead of >=0??

@minwoox
Copy link
Member

minwoox commented May 2, 2024

Additionally, shouldn't the check condition at the bottom be >0 instead of >=0??

Oops, I think so. 😓

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks almost done! Left some minor comments 👍

@Leewongi0731
Copy link
Contributor Author

Oops, I think so. 😓

If find a bug while working on a different �issue like this, should I make and work on a separate issue ticket or fix it together in this PR?

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to mention this, but it is probably more useful if users can view this timing by default when they add a MetricCollectingClient.

e.g.

if (timings != null) {
metrics.connectionAcquisitionDuration().record(timings.connectionAcquisitionDurationNanos(),
TimeUnit.NANOSECONDS);
final long dnsResolutionDurationNanos = timings.dnsResolutionDurationNanos();
if (dnsResolutionDurationNanos >= 0) {
metrics.dnsResolutionDuration().record(dnsResolutionDurationNanos, TimeUnit.NANOSECONDS);
}
final long socketConnectDurationNanos = timings.socketConnectDurationNanos();
if (socketConnectDurationNanos >= 0) {
metrics.socketConnectDuration().record(socketConnectDurationNanos, TimeUnit.NANOSECONDS);
}
final long pendingAcquisitionDurationNanos = timings.pendingAcquisitionDurationNanos();
if (pendingAcquisitionDurationNanos >= 0) {
metrics.pendingAcquisitionDuration().record(pendingAcquisitionDurationNanos,
TimeUnit.NANOSECONDS);
}
}

@jrhee17
Copy link
Contributor

jrhee17 commented May 3, 2024

should I make and work on a separate issue ticket or fix it together in this PR?

It's your choice, but I prefer that it be handled separately

@Leewongi0731
Copy link
Contributor Author

It's your choice, but I prefer that it be handled separately

Okay, I will make new issue and new PR!!

@Leewongi0731 Leewongi0731 marked this pull request as ready for review May 6, 2024 17:46
Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really great!
Thanks, @Leewongi0731! 👍 👍 👍

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nicely done. Thanks @Leewongi0731 🙇 👍 🙇

@jrhee17 jrhee17 added this to the 1.29.0 milestone May 7, 2024
Copy link
Member

@trustin trustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job, @Leewongi0731! Let's merge once @minwoox's comment about deduplication is addressed.

@minwoox minwoox merged commit 0eae626 into line:main May 20, 2024
15 checks passed
@minwoox
Copy link
Member

minwoox commented May 20, 2024

Great job, @Leewongi0731! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collect timings related with TLS handshake and protocol upgrade
4 participants