prometheus-net / prometheus-net

.NET library to instrument your code with Prometheus metrics
https://prometheus.io
MIT License
1.96k stars 299 forks source link

Which nuget package supports UseHttpClientMetrics method? #366

Open naughtyGitCat opened 2 years ago

naughtyGitCat commented 2 years ago

Both prometheus-net and prometheus-net.AspNetCore does not supplies

The source code hints it is contained in prometheus-net.NetStandard, but this nuget package does not exist in README.md. and the nuget info shows it is published in the year 2019. meanwhile the Asset list contains NetStandard newest version

sandersaares commented 2 years ago

UseHttpClientMetrics is provided by the prometheus-net NuGet package. If you are having problems calling this method, please post a minimal sample project to reproduce the issue (e.g. a sample project that fails to compile because it says UseHttpClientMetrics is missing).

naughtyGitCat commented 2 years ago

finally, figure out it is a function usage issue.

what i actually use is .AddHttpClient() does not return a IHTTPClientBuilder

builder.Services.AddHttpClient().UseHttpClientMetrics();
builder.Services.AddHttpClient("").UseHttpClientMetrics();

usually, I inject the client with AddHttpClient() once in Startup.cs, and do name various clients when getting it from the client factory in different workarounds.

so is there any way to UseHttpClientMetrics in my condition