Struct opentelemetry_api::metrics::InstrumentBuilder
source · pub struct InstrumentBuilder<'a, T> { /* private fields */ }
Expand description
Configuration for building an instrument.
Implementations§
source§impl<'a, T> InstrumentBuilder<'a, T>where
T: TryFrom<Self, Error = MetricsError>,
impl<'a, T> InstrumentBuilder<'a, T>where T: TryFrom<Self, Error = MetricsError>,
sourcepub fn with_description<S: Into<String>>(self, description: S) -> Self
pub fn with_description<S: Into<String>>(self, description: S) -> Self
Set the description for this instrument
sourcepub fn with_unit(self, unit: Unit) -> Self
pub fn with_unit(self, unit: Unit) -> Self
Set the unit for this instrument.
Unit is case sensitive(kb
is not the same as kB
).
Unit must be:
- ASCII string
- No longer than 63 characters
Trait Implementations§
source§impl<T> Debug for InstrumentBuilder<'_, T>
impl<T> Debug for InstrumentBuilder<'_, T>
source§impl TryFrom<InstrumentBuilder<'_, ObservableCounter<f64>>> for ObservableCounter<f64>
impl TryFrom<InstrumentBuilder<'_, ObservableCounter<f64>>> for ObservableCounter<f64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableCounter<f64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableCounter<f64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<InstrumentBuilder<'_, ObservableCounter<u64>>> for ObservableCounter<u64>
impl TryFrom<InstrumentBuilder<'_, ObservableCounter<u64>>> for ObservableCounter<u64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableCounter<u64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableCounter<u64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<InstrumentBuilder<'_, ObservableGauge<f64>>> for ObservableGauge<f64>
impl TryFrom<InstrumentBuilder<'_, ObservableGauge<f64>>> for ObservableGauge<f64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<f64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableGauge<f64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<InstrumentBuilder<'_, ObservableGauge<i64>>> for ObservableGauge<i64>
impl TryFrom<InstrumentBuilder<'_, ObservableGauge<i64>>> for ObservableGauge<i64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<i64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableGauge<i64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<InstrumentBuilder<'_, ObservableGauge<u64>>> for ObservableGauge<u64>
impl TryFrom<InstrumentBuilder<'_, ObservableGauge<u64>>> for ObservableGauge<u64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<u64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableGauge<u64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<InstrumentBuilder<'_, ObservableUpDownCounter<f64>>> for ObservableUpDownCounter<f64>
impl TryFrom<InstrumentBuilder<'_, ObservableUpDownCounter<f64>>> for ObservableUpDownCounter<f64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableUpDownCounter<f64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableUpDownCounter<f64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<InstrumentBuilder<'_, ObservableUpDownCounter<i64>>> for ObservableUpDownCounter<i64>
impl TryFrom<InstrumentBuilder<'_, ObservableUpDownCounter<i64>>> for ObservableUpDownCounter<i64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableUpDownCounter<i64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableUpDownCounter<i64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<InstrumentBuilder<'_, UpDownCounter<f64>>> for UpDownCounter<f64>
impl TryFrom<InstrumentBuilder<'_, UpDownCounter<f64>>> for UpDownCounter<f64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, UpDownCounter<f64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, UpDownCounter<f64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<InstrumentBuilder<'_, UpDownCounter<i64>>> for UpDownCounter<i64>
impl TryFrom<InstrumentBuilder<'_, UpDownCounter<i64>>> for UpDownCounter<i64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, UpDownCounter<i64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, UpDownCounter<i64>> ) -> Result<Self, Self::Error>
Performs the conversion.