Skip to main content

Meter

Struct Meter 

Source
pub struct Meter { /* private fields */ }
Expand description

An instrumentation scope: one component’s three standard labels plus an spate_<namespace>_ name prefix applied to every metric it mints.

Cheap to clone; the handles it mints are the metrics facade’s own Arc-backed handles, safe to clone across pipeline threads — every clone feeds the same series.

use spate_core::metrics::Meter;

// Build-time: resolve the handle once. Pass the LOCAL name — the Meter
// prepends `spate_custom_`, so this registers `spate_custom_orders_enriched_total`.
let meter = Meter::new("orders", "enrich", "map");
let enriched = meter.counter("orders_enriched_total", &[("region", "eu".into())]);

// Hot path: touch only the handle, count per batch.
enriched.increment(512);

Implementations§

Source§

impl Meter

Source

pub fn new( pipeline: impl Into<SharedString>, component: impl Into<SharedString>, component_type: impl Into<SharedString>, ) -> Self

A scope for pipeline-author custom metrics: names land under the spate_custom_ bucket. component is the instance id (e.g. enrich); component_type the implementation label. Reuse the pipeline / component values the framework was given so your series join against its.

Source

pub fn with_namespace( namespace: &str, pipeline: impl Into<SharedString>, component: impl Into<SharedString>, component_type: impl Into<SharedString>, ) -> Self

A scope under a specific spate_<namespace>_ bucket — for a connector that owns a segment (e.g. "kafka"spate_kafka_*).

§Panics

Panics if namespace is empty, is not a lowercase [a-z][a-z0-9_]* segment, or is one of the framework’s reserved stage roots (source, sink, …). This is a construction-time wiring check.

Source

pub fn counter( &self, name: &str, extra: &[(&'static str, SharedString)], ) -> Counter

Resolve a counter under this scope. name is the local name (auto-prefixed spate_<namespace>_); it carries the three standard labels, then extra. Pass &[] for the standard labels alone. Build-time only.

Follow the taxonomy rules: _total suffix on counters, and push per-instance identity (a topic, a shard) into extra labels rather than the name, keeping the name low-cardinality.

Source

pub fn gauge(&self, name: &str, extra: &[(&'static str, SharedString)]) -> Gauge

Resolve a gauge under this scope (local name, auto-prefixed). Build-time only.

Source

pub fn histogram( &self, name: &str, extra: &[(&'static str, SharedString)], ) -> Histogram

Resolve a histogram under this scope (local name, auto-prefixed). Build-time only. Give it a unit suffix (_seconds / _bytes / _rows).

Source

pub fn labels(&self) -> &ComponentLabels

The underlying standard-label set, for building a framework stage handle from the same scope (e.g. DeserMetrics::new).

Trait Implementations§

Source§

impl Clone for Meter

Source§

fn clone(&self) -> Meter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Meter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Meter

§

impl RefUnwindSafe for Meter

§

impl Send for Meter

§

impl Sync for Meter

§

impl Unpin for Meter

§

impl UnsafeUnpin for Meter

§

impl UnwindSafe for Meter

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more