pub struct Metrics { /* private fields */ }Implementations§
Source§impl Metrics
impl Metrics
Sourcepub fn new() -> Result<(Self, Registry)>
pub fn new() -> Result<(Self, Registry)>
Prometheus-only (unchanged behaviour). Retained for existing callers.
Sourcepub fn with_otlp(
otlp_endpoint: Option<&str>,
service_name: &str,
) -> Result<(Self, Registry)>
pub fn with_otlp( otlp_endpoint: Option<&str>, service_name: &str, ) -> Result<(Self, Registry)>
Prometheus reader (always, exported on :9090) plus an OTLP/HTTP
PeriodicReader when otlp_endpoint is Some. service_name is
attached as the service.name resource attribute so OTLP series carry
e.g. service_name=sandbox-broker.
otlp_endpoint is a base collector URL like http://host:4318; the
/v1/metrics signal path is appended here (a programmatically-supplied
endpoint is used verbatim by opentelemetry-otlp 0.32, so we must append
the path ourselves).
Sourcepub fn meter(&self) -> Meter
pub fn meter(&self) -> Meter
A meter on the SAME provider (so downstream crates such as synapse-mcp
build instruments that share this provider’s OTLP + Prometheus readers
and single service.name resource).
pub fn record( &self, route: &str, method: &str, status: u16, outcome: &str, secs: f64, )
pub fn upstream_error(&self, route: &str, reason: &str)
pub fn transform_error(&self, route: &str, transform: &str)
Auto Trait Implementations§
impl !RefUnwindSafe for Metrics
impl !UnwindSafe for Metrics
impl Freeze for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl UnsafeUnpin for Metrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more