[Metrics] Create custom metrics with DI integration
Open
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
The current documentation for creating a custom metric recommends static meter and counters: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/metrics-instrumentation#create-a-custom-metric
An alternative should be recommended that uses `IMeterFactory`, DI and a custom class that contains the counters. Should discuss how this is more unit testable.
An example worker template app (which uses generic host and DI) can show off writing metrics like this.
Can reuse content from ASP.NET Core docs: https://github.com/dotnet/AspNetCore.Docs/pull/30073
Contributor guide
Assessment
This issue has not been assessed yet.