pub struct Instrumentation { /* private fields */ }Expand description
A dynamic, isolated tracing instrumentation.
Each instrumentation takes a dedicated slot.
The slot number identifies which slot this instrumentation uses.
The slot number is used to map to that slot in SLOTS, and in
the OTel Context to identify which (active) span belongs to the slot.
Implementations§
Source§impl Instrumentation
impl Instrumentation
Sourcepub fn builder() -> InstrumentationBuilder
pub fn builder() -> InstrumentationBuilder
Create a new InstrumentationBuilder.
Sourcepub fn is_distributed(&self) -> bool
pub fn is_distributed(&self) -> bool
Whether this is the distributed instrumentation (see
InstrumentationBuilder::distributed).
Sourcepub fn enable_all(&self)
pub fn enable_all(&self)
Enable every known #[traceable] function for this instrumentation.
Sourcepub fn disable_all(&self)
pub fn disable_all(&self)
Disable every function for this instrumentation.
Sourcepub fn set_enabled<S: AsRef<str>>(
&self,
selectors: &[S],
) -> Result<Selection, UnknownKeys>
pub fn set_enabled<S: AsRef<str>>( &self, selectors: &[S], ) -> Result<Selection, UnknownKeys>
Replace this instrumentation’s enabled sites with the ones the
provided selectors resolve to.
§Errors
UnknownKeys does not resolve to any #[traceable] function. In
that case nothing is applied and this instrumentation keeps the
set it already had.
Sourcepub fn enable<S: AsRef<str>>(
&self,
selectors: &[S],
) -> Result<Selection, UnknownKeys>
pub fn enable<S: AsRef<str>>( &self, selectors: &[S], ) -> Result<Selection, UnknownKeys>
Enable everything that selectors resolves to, leaving the rest of the enabled
set unchanged (additive).
§Errors
As set_enabled.
Sourcepub fn disable<S: AsRef<str>>(
&self,
selectors: &[S],
) -> Result<Selection, UnknownKeys>
pub fn disable<S: AsRef<str>>( &self, selectors: &[S], ) -> Result<Selection, UnknownKeys>
Disable everything that selectors resolves to, leaving the rest of the enabled
set unchanged.
§Errors
As set_enabled.
Sourcepub fn enabled_names(&self) -> impl Iterator<Item = &'static str>
pub fn enabled_names(&self) -> impl Iterator<Item = &'static str>
Registry keys currently enabled for this instrumentation.