pub struct PrometheusSubscriber { /* private fields */ }Expand description
Prometheus subscriber for supervision-level metrics.
Implements Subscribe and captures metrics from the taskvisor event stream.
Must share a Registry with crate::PrometheusMetrics for a unified /metrics endpoint.
§Event → metric mapping
TaskStarting → tasks_in_flight.inc()
+ task_restarts.inc() (if attempt > 1)
TaskStopped → tasks_in_flight.dec()
TaskFailed → tasks_in_flight.dec()
TimeoutHit → task_timeouts.inc()
BackoffScheduled → task_backoff_count{source}.inc()
+ task_backoff_duration.observe(delay)
ActorExhausted → task_terminal{reason="exhausted"}.inc()
+ attempts_to_finalize{outcome="exhausted"}.observe(attempt)
ActorDead → task_terminal{reason="fatal"}.inc()
+ attempts_to_finalize{outcome="fatal"}.observe(attempt)
SubscriberOverflow → subscriber_overflow.inc() + tracing::warn
SubscriberPanicked → subscriber_panicked.inc() + tracing::warn
ControllerSubmitted → controller_submissions.inc()
ControllerRejected → controller_rejections{reason}.inc() (reason classified from Event.reason)§Supervision metrics (solti_sv_*)
| Metric | Type | Labels | Description |
|---|---|---|---|
solti_sv_tasks_in_flight | Gauge | - | Currently executing tasks |
solti_sv_task_restarts_total | Counter | - | Restarts (attempt > 1) |
solti_sv_task_backoff_count_total | Counter | source | Backoff events |
solti_sv_task_backoff_duration_seconds | Histogram | - | Backoff delay duration |
solti_sv_task_terminal_total | Counter | reason | Terminal task states |
solti_sv_attempts_to_finalize | Histogram | outcome | Attempts when task left loop |
solti_sv_task_timeouts_total | Counter | - | Timeout events |
solti_sv_subscriber_overflow_total | Counter | - | Queue overflow (lost events) |
solti_sv_subscriber_panicked_total | Counter | - | Subscriber panics |
§Controller metrics (solti_ctrl_*)
| Metric | Type | Labels | Description |
|---|---|---|---|
solti_ctrl_submissions_total | Counter | - | Controller submissions |
solti_ctrl_rejections_total | CounterVec | reason | Controller rejections grouped by cause |
§Labels
| Label | Values | Source |
|---|---|---|
source | failure, success | BackoffSource on the event |
reason (terminal) | exhausted, fatal | Terminal event kind |
outcome (attempts) | exhausted, fatal | Attempts-to-finalize histogram |
reason (rejection) | slot_full, slot_busy, add_failed, remove_failed, queue_failed, recovery_failed, bus_lagged, controller_exited, other, unknown | Classified from Event.reason by classify_rejection_reason (private) |
§Notes
tasks_in_flightgauge is guarded against going negative: aTaskStoppedwithout a precedingTaskStartingis a no-op on the gauge.queue_capacitydefaults toDEFAULT_QUEUE_CAPACITY.- Backoff duration is converted from milliseconds to seconds before observation.
§Also
PrometheusMetricsis a runner-level metrics, complementary to this subscriber.EventandEventKind: event structure and classification.
Implementations§
Source§impl PrometheusSubscriber
impl PrometheusSubscriber
Trait Implementations§
Source§impl Debug for PrometheusSubscriber
impl Debug for PrometheusSubscriber
Source§impl Subscribe for PrometheusSubscriber
impl Subscribe for PrometheusSubscriber
Source§fn on_event(&self, event: &Event)
fn on_event(&self, event: &Event)
Translates a taskvisor event into prometheus metric updates.
Source§fn queue_capacity(&self) -> usize
fn queue_capacity(&self) -> usize
Returns the per-subscriber queue capacity configured via PrometheusSubscriber::new or PrometheusSubscriber::with_queue_capacity.
Auto Trait Implementations§
impl Freeze for PrometheusSubscriber
impl !RefUnwindSafe for PrometheusSubscriber
impl Send for PrometheusSubscriber
impl Sync for PrometheusSubscriber
impl Unpin for PrometheusSubscriber
impl UnsafeUnpin for PrometheusSubscriber
impl !UnwindSafe for PrometheusSubscriber
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