Skip to main content

hyperlane_plugin_metrics/
lib.rs

1//! hyperlane-plugin-metrics
2//!
3//! Lock-free atomic Prometheus/OpenMetrics observability plugin for Hyperlane
4//! with built-in HTTP request counters, in-flight gauges, fixed-bucket latency
5//! histograms, custom metric handles, and a scrapeable `/metrics` endpoint.
6
7mod r#const;
8mod r#fn;
9mod r#impl;
10mod r#static;
11mod r#struct;
12
13#[cfg(test)]
14#[path = "../tests/mod.rs"]
15mod tests;
16
17pub use {r#const::*, r#struct::*};
18
19pub(crate) use {r#fn::*, r#static::*};
20
21use std::{
22    array::from_fn,
23    collections::VecDeque,
24    fmt::{self, Write},
25    str::from_utf8,
26    sync::{
27        Arc, OnceLock, RwLock,
28        atomic::{AtomicI64, AtomicU64, AtomicUsize, Ordering},
29    },
30    time::Instant,
31};
32
33use {
34    hyperlane::{
35        AUTHORIZATION, CACHE_CONTROL, CONTENT_TYPE, Context, HashMapXxHash3_64, HttpStatus,
36        Request, ResponseError, ServerHook, Status, Stream, hash_map_xx_hash3_64,
37    },
38    lombok_macros::*,
39};