From ff2d740f19e54e1b8474a1d95fdbf0e4332d027e Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Sun, 24 Sep 2023 02:05:38 +0200 Subject: [PATCH] add dotnet-counters example for custom meter (#30453) --- aspnetcore/log-mon/metrics/metrics.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/aspnetcore/log-mon/metrics/metrics.md b/aspnetcore/log-mon/metrics/metrics.md index 8e2e7e8b99..42d2a48cd6 100644 --- a/aspnetcore/log-mon/metrics/metrics.md +++ b/aspnetcore/log-mon/metrics/metrics.md @@ -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