pub struct PrometheusObserver { /* private fields */ }Available on crate feature
metrics only.Expand description
Prometheus-backed Observer. Construct it, register it on the engine
builder, and expose its registry on your /metrics
endpoint.
use arcly_stream::observability::PrometheusObserver;
use arcly_stream::prelude::*;
let metrics = PrometheusObserver::new().expect("register metrics");
let registry = metrics.registry().clone();
let engine = Engine::builder()
.application(AppSpec::new("live"))
.observer(metrics)
.build();
assert!(!registry.gather().is_empty());Implementations§
Source§impl PrometheusObserver
impl PrometheusObserver
Sourcepub fn with_registry(registry: Registry) -> Result<Self>
pub fn with_registry(registry: Registry) -> Result<Self>
Create an observer registering into an existing registry (e.g. the
process-wide default).
Trait Implementations§
Source§impl Observer for PrometheusObserver
impl Observer for PrometheusObserver
Source§fn on_publish_started(&self, app: &str)
fn on_publish_started(&self, app: &str)
A publish session started in application
app.Source§fn on_publish_ended(&self, app: &str)
fn on_publish_ended(&self, app: &str)
A publish session ended in application
app.Source§fn on_frame(&self, key: &StreamKey, _frame: &MediaFrame)
fn on_frame(&self, key: &StreamKey, _frame: &MediaFrame)
A frame was published. Hot-path hook — keep it cheap. The default
is a no-op so the branch is trivially predicted away when no observer
is installed.
Source§fn on_subscriber_lagged(&self, key: &StreamKey, skipped: u64)
fn on_subscriber_lagged(&self, key: &StreamKey, skipped: u64)
A subscriber fell behind the broadcast buffer and
skipped frames were
dropped from its view before it could read them. This is the canonical
slow-consumer signal: alert on it. Fired by
StreamHandle::subscribe_resilient.Source§fn on_event(&self, _event: &StreamEvent)
fn on_event(&self, _event: &StreamEvent)
A stream lifecycle event was emitted.
Source§fn on_subscriber_evicted(&self, _key: &StreamKey)
fn on_subscriber_evicted(&self, _key: &StreamKey)
A chronically slow subscriber crossed its
max_lag budget and was shed.
Fired by Subscription::recv.Source§fn on_rate_limited(&self, _key: &StreamKey)
fn on_rate_limited(&self, _key: &StreamKey)
An ingress rate limit was exceeded for
key; the protocol handler should
drop or backpressure the connection. Handlers call this from their
ingest loop (e.g. when IngestRateLimit
returns false).Source§fn on_stream_reaped(&self, _key: &StreamKey)
fn on_stream_reaped(&self, _key: &StreamKey)
A publish session was reaped for exceeding the engine’s idle timeout.
Auto Trait Implementations§
impl !RefUnwindSafe for PrometheusObserver
impl !UnwindSafe for PrometheusObserver
impl Freeze for PrometheusObserver
impl Send for PrometheusObserver
impl Sync for PrometheusObserver
impl Unpin for PrometheusObserver
impl UnsafeUnpin for PrometheusObserver
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