Struct opentelemetry_sdk::metrics::Instrument
source · #[non_exhaustive]pub struct Instrument {
pub name: Cow<'static, str>,
pub description: Cow<'static, str>,
pub kind: Option<InstrumentKind>,
pub unit: Cow<'static, str>,
pub scope: Scope,
}
Expand description
Describes properties an instrument is created with, also used for filtering in Views.
§Example
Instruments can be used as criteria for views.
use opentelemetry_sdk::metrics::{new_view, Aggregation, Instrument, Stream};
let criteria = Instrument::new().name("counter_*");
let mask = Stream::new().aggregation(Aggregation::Sum);
let view = new_view(criteria, mask);
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.name: Cow<'static, str>
The human-readable identifier of the instrument.
description: Cow<'static, str>
describes the purpose of the instrument.
kind: Option<InstrumentKind>
The functional group of the instrument.
unit: Cow<'static, str>
Unit is the unit of measurement recorded by the instrument.
scope: Scope
The instrumentation that created the instrument.
Implementations§
source§impl Instrument
impl Instrument
sourcepub fn description(self, description: impl Into<Cow<'static, str>>) -> Self
pub fn description(self, description: impl Into<Cow<'static, str>>) -> Self
Set the instrument description.
Trait Implementations§
source§impl Clone for Instrument
impl Clone for Instrument
source§fn clone(&self) -> Instrument
fn clone(&self) -> Instrument
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Instrument
impl Debug for Instrument
source§impl Default for Instrument
impl Default for Instrument
source§fn default() -> Instrument
fn default() -> Instrument
Returns the “default value” for a type. Read more
source§impl PartialEq for Instrument
impl PartialEq for Instrument
impl StructuralPartialEq for Instrument
Auto Trait Implementations§
impl Freeze for Instrument
impl RefUnwindSafe for Instrument
impl Send for Instrument
impl Sync for Instrument
impl Unpin for Instrument
impl UnwindSafe for Instrument
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)