Path: redb-route/redb.Route/Telemetry/RouteMetrics.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Telemetry/RouteMetrics.cs ---- using System.Diagnostics.Metrics; namespace redb.Route.Telemetry; /// /// Provides and standard counters/histograms for route engine metrics. /// Consumers subscribe to meter name via OpenTelemetry. /// public static class RouteMetrics { /// Meter name for OpenTelemetry subscription. Same canonical name as the activity source. public const string MeterName = RouteActivitySource.TelemetryName; internal static readonly Meter Meter = new(MeterName, GetVersion()); /// Total exchanges processed (counter). public static readonly Counter ExchangesProcessed = Meter.CreateCounter("redb.route.exchanges.processed", "exchanges", "Total exchanges processed by all routes."); /// Exchanges that failed with an unhandled exception (counter). public static readonly Counter ExchangesFailed = Meter.CreateCounter("redb.route.exchanges.failed", "exchanges", "Exchanges that resulted in an unhandled exception."); /// Exchange processing duration (histogram). public static readonly Histogram ExchangeDuration = Meter.CreateHistogram("redb.route.exchange.duration", "ms", "Duration of exchange processing in milliseconds."); /// Currently active exchanges being processed (up-down counter). public static readonly UpDownCounter ExchangesInflight = Meter.CreateUpDownCounter("redb.route.exchanges.inflight", "exchanges", "Number of exchanges currently being processed."); private static string GetVersion() { return typeof(RouteMetrics).Assembly.GetName().Version?.ToString() ?? "0.0.0"; } }