-
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
Integrate HttpClientFactory and metrics #86888
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsPrototype for integration between HttpClientFactory and metrics
|
...xtensions.Http/tests/Microsoft.Extensions.Http.Tests/DefaultHttpMessageHandlerBuilderTest.cs
Outdated
Show resolved
Hide resolved
Change LGTM, I added a small question to the review. |
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
@karelz @CarnaViire @antonfirsov @noahfalk This is still to do. It needs to happen for .NET 8. I don't think this had its own issue. It might have been a checkbox or paragraph in another issue. I'll rebase this PR, react to API changes, unmark as draft, and ping for reviews. |
21fb35f
to
c491358
Compare
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.
👍
// The MeterFactory property is available on handlers in .NET 8 or later. | ||
if (PrimaryHandler is HttpClientHandler httpClientHandler) | ||
{ | ||
httpClientHandler.MeterFactory = _meterFactory; |
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'm not sure DefaultHttpMessageHandlerBuilder is a correct place to hardcode this injection...
Why it's not a ConfigurePrimaryHandler action added via ConfigureHttpClientDefaults or, at least, ConfigureAll?
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 updated it to use a filter.
Defaults or configure don't work because the meter factory should be applied last. If someone changes the handler, such as to a SocketsHttpHandler, then we want to apply the meter factory after that change.
@CarnaViire Please review and merge if good. |
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
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.
Test failures are related @JamesNK. From a brief look they are PNSE, meaning we need a ConditionalFact
Prototype for integration between HttpClientFactory and metrics
Meter
on handler fromIMeterFactory
(waiting for API on handler)Note: HttpClient doesn't have metrics yet, so this PR is useless by itself. @antonfirsov is working on that. In this PR I want to experiment with designing everything end-to-end so we have an idea of what a user of HttpClient metrics APIs will look like.