Skip to content

Expose wrapHandlersPipeline parameter in AddExtendedHttpClientLogging API#7231

Merged
rainsxng merged 11 commits intomainfrom
dbohdanov/diagnostics-latecy-api-update
Feb 10, 2026
Merged

Expose wrapHandlersPipeline parameter in AddExtendedHttpClientLogging API#7231
rainsxng merged 11 commits intomainfrom
dbohdanov/diagnostics-latecy-api-update

Conversation

@rainsxng
Copy link
Contributor

@rainsxng rainsxng commented Jan 26, 2026

As per following API review, these changes allow you to control the wrapHandlersPipeline variable in the AddExtendedHttpClientLogging API. This should fix a bug in which latency context is getting lost when retrieved outside a handlers pipeline

Microsoft Reviewers: Open in CodeFlow

@rainsxng rainsxng self-assigned this Jan 26, 2026
@rainsxng rainsxng changed the title latency api updates Expose wrapHandlersPipeline parameter in AddExtendedHttpClientLogging API Jan 27, 2026
@rainsxng rainsxng marked this pull request as ready for review January 27, 2026 13:04
@rainsxng rainsxng requested a review from a team as a code owner January 27, 2026 13:04
Copilot AI review requested due to automatic review settings January 27, 2026 13:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR exposes the wrapHandlersPipeline parameter in the AddExtendedHttpClientLogging API, allowing callers to control whether the HTTP logging handler wraps the entire handler pipeline or is placed at the point of invocation. This addresses issue #5744 where latency context was being lost when retrieved outside the handlers pipeline, and implements the API proposal from issue #5924.

Changes:

  • Added three new overloads to AddExtendedHttpClientLogging that accept a bool wrapHandlersPipeline parameter, matching the design of the runtime's AddLogger method
  • Added comprehensive tests verifying that latency information is correctly populated with both wrapHandlersPipeline: true and false values
  • Updated the internal implementation to pass the wrapHandlersPipeline parameter through to the AddLogger call

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs Adds three new public API overloads with wrapHandlersPipeline parameter and updates internal implementation to accept and pass through this parameter
test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Latency/HttpClientLatencyTelemetryExtensionsTest.cs Adds four new tests verifying latency info population with different parameter combinations and when latency telemetry is not configured

…ency/HttpClientLatencyTelemetryExtensionsTest.cs

Co-authored-by: Copilot <[email protected]>
@iliar-turdushev iliar-turdushev self-requested a review January 28, 2026 13:51
@rainsxng rainsxng enabled auto-merge (squash) February 10, 2026 12:35
@rainsxng rainsxng merged commit de9c86e into main Feb 10, 2026
6 checks passed
@rainsxng rainsxng deleted the dbohdanov/diagnostics-latecy-api-update branch February 10, 2026 12:35
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants