pub trait InstrumentProvider {
Show 15 methods // Required method fn register_callback( &self, instruments: &[Arc<dyn Any, Global>], callbacks: Box<dyn Fn(&dyn Observer) + Send + Sync, Global> ) -> Result<Box<dyn CallbackRegistration, Global>, MetricsError>; // Provided methods fn u64_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Counter<u64>, MetricsError> { ... } fn f64_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Counter<f64>, MetricsError> { ... } fn u64_observable_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<u64>) + Send + Sync, Global>, Global> ) -> Result<ObservableCounter<u64>, MetricsError> { ... } fn f64_observable_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<f64>) + Send + Sync, Global>, Global> ) -> Result<ObservableCounter<f64>, MetricsError> { ... } fn i64_up_down_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<UpDownCounter<i64>, MetricsError> { ... } fn f64_up_down_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<UpDownCounter<f64>, MetricsError> { ... } fn i64_observable_up_down_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<i64>) + Send + Sync, Global>, Global> ) -> Result<ObservableUpDownCounter<i64>, MetricsError> { ... } fn f64_observable_up_down_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<f64>) + Send + Sync, Global>, Global> ) -> Result<ObservableUpDownCounter<f64>, MetricsError> { ... } fn u64_observable_gauge( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<u64>) + Send + Sync, Global>, Global> ) -> Result<ObservableGauge<u64>, MetricsError> { ... } fn i64_observable_gauge( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<i64>) + Send + Sync, Global>, Global> ) -> Result<ObservableGauge<i64>, MetricsError> { ... } fn f64_observable_gauge( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<f64>) + Send + Sync, Global>, Global> ) -> Result<ObservableGauge<f64>, MetricsError> { ... } fn f64_histogram( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Histogram<f64>, MetricsError> { ... } fn u64_histogram( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Histogram<u64>, MetricsError> { ... } fn i64_histogram( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Histogram<i64>, MetricsError> { ... }
}
Available on crate feature metrics only.
Expand description

SDK implemented trait for creating instruments

Required Methods§

source

fn register_callback( &self, instruments: &[Arc<dyn Any, Global>], callbacks: Box<dyn Fn(&dyn Observer) + Send + Sync, Global> ) -> Result<Box<dyn CallbackRegistration, Global>, MetricsError>

Captures the function that will be called during data collection.

It is only valid to call observe within the scope of the passed function.

Provided Methods§

source

fn u64_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Counter<u64>, MetricsError>

creates an instrument for recording increasing values.

source

fn f64_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Counter<f64>, MetricsError>

creates an instrument for recording increasing values.

source

fn u64_observable_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<u64>) + Send + Sync, Global>, Global> ) -> Result<ObservableCounter<u64>, MetricsError>

creates an instrument for recording increasing values via callback.

source

fn f64_observable_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<f64>) + Send + Sync, Global>, Global> ) -> Result<ObservableCounter<f64>, MetricsError>

creates an instrument for recording increasing values via callback.

source

fn i64_up_down_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<UpDownCounter<i64>, MetricsError>

creates an instrument for recording changes of a value.

source

fn f64_up_down_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<UpDownCounter<f64>, MetricsError>

creates an instrument for recording changes of a value.

source

fn i64_observable_up_down_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<i64>) + Send + Sync, Global>, Global> ) -> Result<ObservableUpDownCounter<i64>, MetricsError>

creates an instrument for recording changes of a value.

source

fn f64_observable_up_down_counter( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<f64>) + Send + Sync, Global>, Global> ) -> Result<ObservableUpDownCounter<f64>, MetricsError>

creates an instrument for recording changes of a value via callback.

source

fn u64_observable_gauge( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<u64>) + Send + Sync, Global>, Global> ) -> Result<ObservableGauge<u64>, MetricsError>

creates an instrument for recording the current value via callback.

source

fn i64_observable_gauge( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<i64>) + Send + Sync, Global>, Global> ) -> Result<ObservableGauge<i64>, MetricsError>

creates an instrument for recording the current value via callback.

source

fn f64_observable_gauge( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit>, _callback: Vec<Box<dyn Fn(&dyn AsyncInstrument<f64>) + Send + Sync, Global>, Global> ) -> Result<ObservableGauge<f64>, MetricsError>

creates an instrument for recording the current value via callback.

source

fn f64_histogram( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Histogram<f64>, MetricsError>

creates an instrument for recording a distribution of values.

source

fn u64_histogram( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Histogram<u64>, MetricsError>

creates an instrument for recording a distribution of values.

source

fn i64_histogram( &self, _name: Cow<'static, str>, _description: Option<Cow<'static, str>>, _unit: Option<Unit> ) -> Result<Histogram<i64>, MetricsError>

creates an instrument for recording a distribution of values.

Implementors§