Struct opentelemetry_sdk::metrics::Stream
source · #[non_exhaustive]pub struct Stream {
pub name: Cow<'static, str>,
pub description: Cow<'static, str>,
pub unit: Cow<'static, str>,
pub aggregation: Option<Aggregation>,
pub allowed_attribute_keys: Option<Arc<HashSet<Key>>>,
}
Expand description
Describes the stream of data an instrument produces.
§Example
Streams can be used as masks in 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 stream.
description: Cow<'static, str>
Describes the purpose of the data.
unit: Cow<'static, str>
the unit of measurement recorded.
aggregation: Option<Aggregation>
Aggregation the stream uses for an instrument.
allowed_attribute_keys: Option<Arc<HashSet<Key>>>
An allow-list of attribute keys that will be preserved for the stream.
Any attribute recorded for the stream with a key not in this set will be
dropped. If the set is empty, all attributes will be dropped, if None
all
attributes will be kept.
Implementations§
source§impl Stream
impl Stream
sourcepub fn description(self, description: impl Into<Cow<'static, str>>) -> Self
pub fn description(self, description: impl Into<Cow<'static, str>>) -> Self
Set the stream description.
sourcepub fn aggregation(self, aggregation: Aggregation) -> Self
pub fn aggregation(self, aggregation: Aggregation) -> Self
Set the stream aggregation.
sourcepub fn allowed_attribute_keys(
self,
attribute_keys: impl IntoIterator<Item = Key>,
) -> Self
pub fn allowed_attribute_keys( self, attribute_keys: impl IntoIterator<Item = Key>, ) -> Self
Set the stream allowed attribute keys.
Any attribute recorded for the stream with a key not in this set will be dropped. If this set is empty all attributes will be dropped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stream
impl RefUnwindSafe for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl UnwindSafe for Stream
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