Provide a way to differentiate HttpClient configuration
See original GitHub issueThe newly added IHttpClientFactory integration only exposes HTTP request host and method as labels. While a good start, this is not enough to really identify which (out of several possible) HttpClient configurations/types the metric applies to.
Ideally, we could track the “foo” in services.AddHttpClient("foo", ...)
but I did not find any way to get access to this information in our middleware.
Ref: https://github.com/dotnet/aspnetcore/discussions/27018 Ref #248, #229 Ref https://github.com/dotnet/aspnetcore/issues/28455
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
Advanced Apache HttpClient Configuration
HttpClient configurations for advanced use cases. ... Simply put, Digma provides immediate code feedback. As an IDE plugin, it identifies ...
Read more >Are You Using HttpClient in The Right Way?
The simplest way is to inject the IHttpClient Factory and create a new HttpClient instance from it.
Read more >Are there differences to consider? http and https with
Hello,. Are there differences to consider? http and https with - HttpClient. c-only-http-and-https-schemes-are-allowed-httpclie.html.
Read more >HttpClient vs IHttpClientFactory - Henrique Siebert Domareski
HttpClient and IHttpClientFactory can be used in .NET to make HTTP requests and handle HTTP responses from web resources.
Read more >What is the difference between CloseableHttpClient and ...
CloseableHttpClient is an abstract class which is the base implementation of HttpClient that also implements java.io.Closeable. Here is an ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The solution I’ve implemented was to create a delegate handler, create the Counter inside it and register that handler in the http client. That way, the counter will be automatically called whenever the http client is used and there’s no need to repeat this code all over the solution.
Here’s my DelegateHandler:
And in my Service I’m register this handler like this:
Sorry, I misread your post. I thought you’re still having problems. In my case I only want to know how many calls are being made by the HttpClient. At least for now, I don’t need to know the endpoint so I can exclude that so that I don’t have that problem with high label cardinality.