pub struct PrometheusSink { /* private fields */ }Expand description
Prometheus metrics sink for Rustvello.
Registers standard metrics and exposes them via an HTTP /metrics endpoint.
The sink spawns a background tokio task for the HTTP server.
Singleton: Only one PrometheusSink can be created per process because
the metrics crate uses a global recorder. A second call to [new] will
return an error.
§Metric Naming Convention
rustvello_<subsystem>_<metric>_<unit>
§Example
use rustvello_prometheus::PrometheusSink;
use std::net::SocketAddr;
let sink = PrometheusSink::new("0.0.0.0:9090".parse()?)?;Implementations§
Source§impl PrometheusSink
impl PrometheusSink
Sourcepub fn new(bind: SocketAddr) -> RustvelloResult<Self>
pub fn new(bind: SocketAddr) -> RustvelloResult<Self>
Create a new Prometheus sink and start the HTTP exporter on the given address.
§Errors
Returns an error if the global metrics recorder has already been installed
(only one PrometheusSink per process).
Trait Implementations§
Source§impl EventEmitter for PrometheusSink
impl EventEmitter for PrometheusSink
Source§fn on_worker_started(&self, runner_id: &RunnerId)
fn on_worker_started(&self, runner_id: &RunnerId)
A runner process has started.
Source§fn on_worker_shutdown(&self, runner_id: &RunnerId)
fn on_worker_shutdown(&self, runner_id: &RunnerId)
A runner process is shutting down.
Source§fn on_task_submitted(&self, task_id: &TaskId, _inv_id: &InvocationId)
fn on_task_submitted(&self, task_id: &TaskId, _inv_id: &InvocationId)
A task invocation was submitted to the system.
Source§fn on_task_started(&self, task_id: &TaskId, _inv_id: &InvocationId)
fn on_task_started(&self, task_id: &TaskId, _inv_id: &InvocationId)
A runner began executing a task invocation.
Source§fn on_task_succeeded(
&self,
task_id: &TaskId,
_inv_id: &InvocationId,
duration: Duration,
)
fn on_task_succeeded( &self, task_id: &TaskId, _inv_id: &InvocationId, duration: Duration, )
A task invocation completed successfully.
Source§fn on_task_failed(
&self,
task_id: &TaskId,
_inv_id: &InvocationId,
_error: &str,
duration: Duration,
)
fn on_task_failed( &self, task_id: &TaskId, _inv_id: &InvocationId, _error: &str, duration: Duration, )
A task invocation failed (final failure, retries exhausted).
Source§fn on_task_retried(
&self,
task_id: &TaskId,
_inv_id: &InvocationId,
_attempt: u32,
)
fn on_task_retried( &self, task_id: &TaskId, _inv_id: &InvocationId, _attempt: u32, )
A task invocation is being retried.
Source§fn on_queue_depth(&self, queue: &str, depth: usize)
fn on_queue_depth(&self, queue: &str, depth: usize)
Current queue depth snapshot.
Source§fn on_cc_rejected(&self, task_id: &TaskId)
fn on_cc_rejected(&self, task_id: &TaskId)
Concurrency control rejected an invocation registration.
Source§fn on_cc_slot_acquired(&self, task_id: &TaskId)
fn on_cc_slot_acquired(&self, task_id: &TaskId)
A concurrency slot was successfully acquired.
Source§fn on_cc_slot_released(&self, task_id: &TaskId)
fn on_cc_slot_released(&self, task_id: &TaskId)
A concurrency slot was released (invocation reached terminal state).
Auto Trait Implementations§
impl Freeze for PrometheusSink
impl RefUnwindSafe for PrometheusSink
impl Send for PrometheusSink
impl Sync for PrometheusSink
impl Unpin for PrometheusSink
impl UnsafeUnpin for PrometheusSink
impl UnwindSafe for PrometheusSink
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