#[non_exhaustive]pub struct FeedMetricsCtx {
pub meter: Option<Meter>,
pub per_partition_detail: bool,
}Expand description
What the runtime hands a feed backend for its own metric families, through
Feed::attach_metrics.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.meter: Option<Meter>Scoped spate_<backend>_feed_* and pre-labeled with the pipeline,
component="feed" and the backend key as
component_type. None when the backend key cannot scope a family: a
reserved root or custom opts out silently, and a malformed key is
logged and also yields None.
per_partition_detail: boolThe calling pipeline’s metrics.per_partition_detail. Gates the
backend’s own per-partition families: when false, register and emit
only aggregate series. Set whether or not meter is
Some.
Implementations§
Source§impl FeedMetricsCtx
impl FeedMetricsCtx
Sourcepub fn new(meter: Option<Meter>) -> Self
pub fn new(meter: Option<Meter>) -> Self
Context carrying meter, with per-partition detail off. Backends
outside this crate construct it here, as the struct is
#[non_exhaustive].
§Examples
use spate_core::feed::FeedMetricsCtx;
use spate_core::metrics::{Meter, render_local};
let meter = Meter::with_namespace("probe_feed", "orders", "feed", "probe");
let cx = FeedMetricsCtx::new(Some(meter)).with_partition_detail(true);
assert!(cx.per_partition_detail);
let meter = cx.meter.expect("a scoped Meter");
let text = render_local(|| meter.counter("receives_total", &[]).increment(1));
assert!(text.lines().any(|l| {
l == r#"spate_probe_feed_receives_total{pipeline="orders",component="feed",component_type="probe"} 1"#
}));Sourcepub fn with_partition_detail(self, enabled: bool) -> Self
pub fn with_partition_detail(self, enabled: bool) -> Self
Enable cardinality-sensitive per-partition series. Called by the
runtime from metrics.per_partition_detail.