-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[release/5.0] Http telemetry changes backport #41610
[release/5.0] Http telemetry changes backport #41610
Conversation
* Change HandshakeStop SslProtocols parameter to enum * Parameterize Http11/Http20 events * Add dummy request to ensure Http2 settings are received
* Moved HTTP request telemetry to HttpClient.SendAsync * Added ResponseContent and helper methods events. * Rework helper method activity nesting * Expand Telemetry tests * Also log RequestStart/Stop in HttpMessageInvoker * Update RequestStart signature * RequestAborted => RequestFailed rename * ResponseContent Begin => Start/Stop * Fix HttpMessageInvoker implementation * Add Synchronous request Telemetry tests * Check telemetryStarted before ResponseContentStart Co-authored-by: MihaZupan <mihazupan.zupan1@gmail.com>
Tagging subscribers to this area: @dotnet/ncl |
/azp run runtime-libraries outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
{ | ||
if (!_concurrentStreams.TryRequestCreditNoWait(1)) | ||
if (_pool.EnableMultipleHttp2Connections) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was swapping these 2 if checks intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. We only want to log RequestLeftQueue
if we actually have to wait, so we have to perform the TryRequestCreditNoWait
check first.
We already did so in the EnableMultipleHttp2Connections == true
, so swapping the order around avoided duplicating a check.
@ericstj this is the Telemetry change I talked about -- we're aiming to have it ready for merge in a few hours. Let us know if you approve. Thanks! |
Approved since this is a blocking bug in a 5.0 feature. |
(byte)request.Version.Major, | ||
(byte)request.Version.Minor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we okay truncating these if user sets them to something crazy? Seems like something they'd want to see in diagnostics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed we throw for anything unknown, do we allow it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. We allow it and we just connect over what we have (depending on VersionPolicy
).
Minor is not checked almost at all (except for 1.0 and chunked content ASAIK).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the motivation to change to byte here?
@@ -1425,6 +1436,9 @@ private async ValueTask<Http2Stream> SendHeadersAsync(HttpRequestMessage request | |||
|
|||
return s.mustFlush || s.endStream; | |||
}, cancellationToken).ConfigureAwait(false); | |||
|
|||
if (HttpTelemetry.Log.IsEnabled()) HttpTelemetry.Log.RequestHeadersStop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intended that you'll get a broken Stop without a Start when the switch is flipped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for open questions LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just the question about the version truncation
Joint changes of 3 related PRs: #41527, #41022, #41590 (they depend on each other, therefore they are merged in the port)
Customer Impact
Http telemetry: Request Start/Stop events don't properly correlate, which makes the end-to-end tracing impossible to use.
#41022 fixed that issue by moving the relevant telemetry instrumentation into
HttpClient
&HttpMessageInvoker
.The PR also adds more events that can provide more fine-grained insight into the lifetime of requests -- result of end-to-end validation and comparison with other stack:
RequestHeadersStart/Stop
RequestContentStart/Stop
ResponseHeadersStart/Stop
ResponseContentStart/Stop
RequestAborted
event and counter were renamed toRequestFailed
to align with naming of other*Failed
events and to reflect their real purpose -- i.e.RequestFailed
includes also non-successful HTTP response status codes (not quite an abort of request).The PR further merges several event patterns together into parameterized HTTP version to avoid duplication (motivated by end-to-end validation feedback), for example:
Http11ConnectionEstablished
andHttp20ConnectionEstablished
are merged intoConnectionEstablished(version)
.Testing
HttpClient
behavior in CI.EventListener
.Risk
HttpClient
, but the changes are mostly copy/paste indentation changes (scope changes like including code intry-catch
block, etc.).