pub struct PrometheusMetrics { /* private fields */ }Expand description
Prometheus metrics collector for rust-camel
This struct implements the MetricsCollector trait and exposes metrics
in Prometheus format via the /metrics endpoint.
Implementations§
Source§impl PrometheusMetrics
impl PrometheusMetrics
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new PrometheusMetrics instance with all metrics registered.
§Panics
Panics if metric creation or registration fails. This can only happen if:
- A metric name is invalid (must match
^[a-zA-Z_:][a-zA-Z0-9_:]*$). All names are hardcoded below and comply with this requirement by convention. - A metric is registered twice. This is impossible here because each call creates a
fresh
Registry.
Since both conditions are static invariants enforced by code review, these expect()
calls are intentional and will never fail in practice.
Trait Implementations§
Source§impl Default for PrometheusMetrics
impl Default for PrometheusMetrics
Source§impl MetricsCollector for PrometheusMetrics
impl MetricsCollector for PrometheusMetrics
Source§fn record_exchange_duration(&self, route_id: &str, duration: Duration)
fn record_exchange_duration(&self, route_id: &str, duration: Duration)
Record exchange processing time
Source§fn increment_errors(&self, route_id: &str, error_type: &str)
fn increment_errors(&self, route_id: &str, error_type: &str)
Increment error counter
Source§fn increment_exchanges(&self, route_id: &str)
fn increment_exchanges(&self, route_id: &str)
Increment exchange counter
Source§fn set_queue_depth(&self, route_id: &str, depth: usize)
fn set_queue_depth(&self, route_id: &str, depth: usize)
Update queue depth
Auto Trait Implementations§
impl Freeze for PrometheusMetrics
impl !RefUnwindSafe for PrometheusMetrics
impl Send for PrometheusMetrics
impl Sync for PrometheusMetrics
impl Unpin for PrometheusMetrics
impl UnsafeUnpin for PrometheusMetrics
impl !UnwindSafe for PrometheusMetrics
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