Collecting Metrics
Record counters, gauges, and histograms.
Why Metrics?
Metrics are numeric measurements aggregated over time. They power dashboards and alerts: request rate, error count, latency, queue depth. Unlike logs, they stay cheap at high volume because they aggregate.
The Meter API
.NET emits metrics through System.Diagnostics.Metrics. You create a Meter, then use it to create instruments like counters and histograms.
using System.Diagnostics.Metrics;
private static readonly Meter Meter = new("Checkout.Orders");