add dotnet-counters example for custom meter (#30453)

pull/30447/head
Tim Deschryver 2023-09-24 02:05:38 +02:00 committed by GitHub
parent a4db169117
commit ff2d740f19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 0 deletions

View File

@ -132,6 +132,25 @@ Inject the metrics type and record values where needed. Because the metrics type
:::code language="csharp" source="~/log-mon/metrics/metrics/samples/custom-metrics/Program.cs" id="snippet_InjectAndUseMetrics":::
To monitor the "Contoso.Web" meter, use the following [dotnet-counters](/dotnet/core/diagnostics/dotnet-counters) command.
```dotnetcli
dotnet-counters monitor -n WebMetric --counters Contoso.Web
```
Output similar to the following is displayed:
```dotnetcli
Press p to pause, r to resume, q to quit.
Status: Running
[Contoso.Web]
contoso.product.sold (Count / 1 sec)
contoso.product.name=Eggs 12
contoso.product.name=Milk 0
```
## View metrics in Grafana with OpenTelemetry and Prometheus
### Overview