pub struct MetricsProducer<B>where
B: StorageBackend,{ /* private fields */ }Expand description
Producer of schema-v2 metric rows over any StorageBackend.
Default labels/tenant are merged into every emitted record; per-record values win on conflict.
Implementations§
Source§impl<B> MetricsProducer<B>where
B: StorageBackend,
impl<B> MetricsProducer<B>where
B: StorageBackend,
pub fn new(backend: Arc<B>) -> MetricsProducer<B>
Sourcepub fn with_default_label(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> MetricsProducer<B>
pub fn with_default_label( self, key: impl Into<String>, value: impl Into<String>, ) -> MetricsProducer<B>
Add a default label applied to every emitted record.
Sourcepub fn with_default_tenant(
self,
tenant: impl Into<String>,
) -> MetricsProducer<B>
pub fn with_default_tenant( self, tenant: impl Into<String>, ) -> MetricsProducer<B>
Set a default tenant applied to every emitted record.
Sourcepub async fn init(&self) -> Result<(), Status>
pub async fn init(&self) -> Result<(), Status>
Create all schema-v2 tables (metrics, calibration_params,
decision_batches) and migrate pre-v2 metrics tables in place.
Sourcepub fn point(&self, metric_id: impl Into<String>, value: f64) -> MetricRecord
pub fn point(&self, metric_id: impl Into<String>, value: f64) -> MetricRecord
Build a point-sample record (window of one: sum == avg == value) with this producer’s default labels/tenant pre-applied.
Sourcepub async fn emit(&self, record: MetricRecord) -> Result<(), Status>
pub async fn emit(&self, record: MetricRecord) -> Result<(), Status>
Emit one record. Producer defaults fill any label/tenant the record does not set itself.
Sourcepub async fn emit_all(
&self,
records: impl IntoIterator<Item = MetricRecord>,
) -> Result<(), Status>
pub async fn emit_all( &self, records: impl IntoIterator<Item = MetricRecord>, ) -> Result<(), Status>
Emit a batch of records (one insert), applying the same default-merge
as emit.
Sourcepub fn calibration(&self) -> CalibrationStore<B>
pub fn calibration(&self) -> CalibrationStore<B>
Calibration parameter writer/reader on the same backend (P2.2 re-fit).
Sourcepub fn decision_batches(&self) -> DecisionBatchStore<B>
pub fn decision_batches(&self) -> DecisionBatchStore<B>
Arrow-native decision-batch store on the same backend.
Auto Trait Implementations§
impl<B> Freeze for MetricsProducer<B>
impl<B> RefUnwindSafe for MetricsProducer<B>where
B: RefUnwindSafe,
impl<B> Send for MetricsProducer<B>
impl<B> Sync for MetricsProducer<B>
impl<B> Unpin for MetricsProducer<B>
impl<B> UnsafeUnpin for MetricsProducer<B>
impl<B> UnwindSafe for MetricsProducer<B>where
B: RefUnwindSafe,
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].