pub struct Instrument { /* private fields */ }Expand description
Describes the properties of an instrument at creation, used for filtering in
views. This is utilized in the with_view methods on MeterProviderBuilder
to customize metric output.
Users can use a reference to Instrument to select which instrument(s) a
Stream should be applied to.
§Example
use opentelemetry_sdk::metrics::{Instrument, Stream};
let my_view_change_cardinality = |i: &Instrument| {
if i.name() == "my_second_histogram" {
// Note: If Stream is invalid, `build()` will return an error. By
// calling `.ok()`, any such error is ignored and treated as if the
// view does not match the instrument. If this is not the desired
// behavior, consider handling the error explicitly.
Stream::builder().with_cardinality_limit(2).build().ok()
} else {
None
}
};Implementations§
Source§impl Instrument
impl Instrument
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 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