This repository was archived by the owner on Jan 23, 2023. It is now read-only.
HttpHandlerDiagnosticListener: Write response event once when request is redirected#19195
Merged
Merged
Conversation
Contributor
|
cc: @stephentoub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
HttpClientimplementation based onHttpWebRequestand get notifications withDiagnosticSourceand 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
StopeventOtherwise it notifies consumer about the 'final' response.
/cc @vance @davidsh