hyperlane-plugin-metrics 23.4.0

A lock-free atomic Prometheus/OpenMetrics observability plugin for the Hyperlane framework with built-in HTTP request counters, in-flight gauges, latency histograms, custom user metric registration, and a scrapeable /metrics endpoint.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use super::*;

/// Global process-wide [`MetricsPlugin`] singleton initialized via [`MetricsPlugin::init`].
pub(crate) static METRICS_PLUGIN: OnceLock<MetricsPlugin> = OnceLock::new();

/// Monotonic counter assigning stable shard indices across worker threads.
pub(crate) static METRICS_NEXT_SHARD_ID: AtomicUsize = AtomicUsize::new(0);

thread_local! {
    /// Cached per-thread shard index into [`MetricsRegistryInner::builtin_shards`].
    pub(crate) static WORKER_METRICS_SHARD: Cell<usize> = const { Cell::new(usize::MAX) };
}