diff --git a/docs/Metrics.md b/docs/Metrics.md index 2ab0e6c..202b00a 100644 --- a/docs/Metrics.md +++ b/docs/Metrics.md @@ -4,7 +4,7 @@ The metrics subsystem exposes counters, histograms, and observable gauges that d ## Overview -`GatewayMetrics` is a singleton (registered in `GatewayApplication.cs`) that owns a single `Meter` named `ZB.MOM.WW.MxGateway.Server` and a set of synchronised counters, histograms, and observable gauges. Subsystems call typed mutator methods (`SessionOpened`, `CommandFailed`, `EventReceived`, etc.) rather than touching the `Meter` directly, which keeps the OpenTelemetry instrument names and tag conventions in one place. A `lock (_syncRoot)` block guards the scalar fields used by `GetSnapshot`, while per-event maps use `ConcurrentDictionary` so the hot event path avoids the lock. +`GatewayMetrics` is a singleton (registered in `GatewayApplication.cs`) that owns a single `Meter` named `ZB.MOM.WW.MxGateway` and a set of synchronised counters, histograms, and observable gauges. Subsystems call typed mutator methods (`SessionOpened`, `CommandFailed`, `EventReceived`, etc.) rather than touching the `Meter` directly, which keeps the OpenTelemetry instrument names and tag conventions in one place. A `lock (_syncRoot)` block guards the scalar fields used by `GetSnapshot`, while per-event maps use `ConcurrentDictionary` so the hot event path avoids the lock. ## Meter and OpenTelemetry Compatibility @@ -13,7 +13,7 @@ The meter name is exposed as a constant so that hosting code can register it wit ```csharp public sealed class GatewayMetrics : IDisposable { - public const string MeterName = "ZB.MOM.WW.MxGateway.Server"; + public const string MeterName = "ZB.MOM.WW.MxGateway"; public GatewayMetrics() { @@ -50,12 +50,12 @@ All counters are `Counter`. Tag values come from the call sites listed und ### Histograms -Histograms record durations in milliseconds (the `unit` argument on `CreateHistogram`): +Histograms record durations in seconds (the `unit` argument on `CreateHistogram`): ```csharp -_workerStartupLatencyHistogram = _meter.CreateHistogram("mxgateway.workers.startup.duration", "ms"); -_commandLatencyHistogram = _meter.CreateHistogram("mxgateway.commands.duration", "ms"); -_eventStreamSendLatencyHistogram = _meter.CreateHistogram("mxgateway.events.stream_send.duration", "ms"); +_workerStartupLatencyHistogram = _meter.CreateHistogram("mxgateway.workers.startup.duration", "s"); +_commandLatencyHistogram = _meter.CreateHistogram("mxgateway.commands.duration", "s"); +_eventStreamSendLatencyHistogram = _meter.CreateHistogram("mxgateway.events.stream_send.duration", "s"); ``` | Instrument | Tags | What it measures |