You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HttpClientLoggerHandler runs outside HttpLatencyTelemetryHandler because the wrapHandlersPipeline parameter is set to true when the HttpClientLogger is added.
The ILatencyContext is stored in AsyncLocal, so it is not possible to read the value that was set downstream of the call from upstream.
In other words, I think that the HttpClientLoggerHandler cannot get the values set by the HttpLatencyTelemetryHandler.
When I changed the wrapHandlersPipeline parameter to false while debugging, I got the output I wrote in the Expected behaviour section. Is it correct that this parameter is true?
Alternatively, using AsyncState instead of AsyncLocal.
The text was updated successfully, but these errors were encountered:
Description
See the reproduction steps section for the code I wrote.
The code outputs the following log.
The
LatencyInfo
in log is empty. How can I get it to output a valid value here?I apologise if I have misunderstood how to use this library. In that case, please tell me how to use it correctly.
Reproduction Steps
Expected behavior
The
LatencyInfo
in the log should be as follows, shouldn't it?"LatencyInfo": ",handreqs/dnss/dnse/cons/cone/cones/rlq/reqhs/reqhe/reshs/reshe/enrin/,0.1706/68.8664/81.0259/86.9632/335.9692/341.1706/341.921/342.4656/342.7676/629.649/630.2728/1358.2388999999998/"
Actual behavior
The
LatencyInfo
in the log is as follows"LatencyInfo":","
Regression?
The behavior was the same in ver 8.0.0.
Known Workarounds
No response
Configuration
Other information
HttpClientLoggerHandler
runs outsideHttpLatencyTelemetryHandler
because thewrapHandlersPipeline
parameter is set totrue
when theHttpClientLogger
is added.extensions/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs
Lines 96 to 100 in 16acdbf
The
ILatencyContext
is stored inAsyncLocal
, so it is not possible to read the value that was set downstream of the call from upstream.In other words, I think that the
HttpClientLoggerHandler
cannot get the values set by theHttpLatencyTelemetryHandler
.When I changed the
wrapHandlersPipeline
parameter tofalse
while debugging, I got the output I wrote in the Expected behaviour section. Is it correct that this parameter istrue
?Alternatively, using
AsyncState
instead ofAsyncLocal
.The text was updated successfully, but these errors were encountered: