pub struct PrometheusMetrics { /* private fields */ }Expand description
Prometheus metrics collector for JSON-RPC
Implementations§
Source§impl PrometheusMetrics
impl PrometheusMetrics
Sourcepub fn new() -> Result<Self, Error>
pub fn new() -> Result<Self, Error>
Create a new Prometheus metrics collector
§Errors
Returns error if registry or metric creation fails
Sourcepub fn with_prefix(prefix: &str) -> Result<Self, Error>
pub fn with_prefix(prefix: &str) -> Result<Self, Error>
Create a new metrics collector with custom prefix
§Errors
Returns error if registry or metric creation fails
Sourcepub fn record_request(&self, method: &str, duration: Duration, success: bool)
pub fn record_request(&self, method: &str, duration: Duration, success: bool)
Record a request with method, duration, and success status
Sourcepub fn connection_opened(&self)
pub fn connection_opened(&self)
Increment active connections count
Sourcepub fn connection_closed(&self)
pub fn connection_closed(&self)
Decrement active connections count
Trait Implementations§
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