This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
HttpHandlerDiagnosticListener: Write response event once when request is redirected #19195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HttpHandlerDiagnosticListener was introduced in #18101. It allows to hook into the .NET Framework
HttpClient
implementation based onHttpWebRequest
and get notifications withDiagnosticSource
and inject correlation headers (similar to corefx instrumentation).When HTTP request is redirected, the hook is invoked once per redirect. when request is being sent, the hook only sends one event for the first request and does not notify about each consecutive redirect.
When response is received, hook sends event for each response.
Consumers of these events uses them to log requests/responses and having the 'final' response code, actual duration and potentially details from the response is important. So every consumer for the hook needs to wait for the last response.
This fix implements it: it does not send
Stop
eventOtherwise it notifies consumer about the 'final' response.
/cc @vance @davidsh