pub struct Metadata<'a> { /* private fields */ }
Expand description
Metadata describing a metric.
All metrics have the following metadata:
- A
target
, a string that categorizes part of the system where metric originates from. The `metrics`` macros default to using the module path where the metric originate as the target, but it may be overridden. - A
level
, specifying the verbosity the metric is emitted at.
In addition, the following optional metadata describing the source code location where the metric originated from may be provided:
- The module path of the source code location where the metric event originated.
Metadata usage is exporter-specific, and may be ignored entirely. See the documentation of the specific exporter being used for more information.
Implementations§
Source§impl<'a> Metadata<'a>
impl<'a> Metadata<'a>
Sourcepub const fn new(
target: &'a str,
level: Level,
module_path: Option<&'a str>,
) -> Self
pub const fn new( target: &'a str, level: Level, module_path: Option<&'a str>, ) -> Self
Constructs a new Metadata
.
Sourcepub fn target(&self) -> &'a str
pub fn target(&self) -> &'a str
Returns the target of the metric.
This specifies the part of the system where the metric originates from. Typically, this is the module path where the metric originated from, but can be overridden when registering a metric.
Sourcepub fn module_path(&self) -> Option<&'a str>
pub fn module_path(&self) -> Option<&'a str>
Returns the module path of the metric.
This specifies the module where the metric originates from, or None
if the module path is unknown.
Trait Implementations§
impl<'a> Eq for Metadata<'a>
impl<'a> StructuralPartialEq for Metadata<'a>
Auto Trait Implementations§
impl<'a> Freeze for Metadata<'a>
impl<'a> RefUnwindSafe for Metadata<'a>
impl<'a> Send for Metadata<'a>
impl<'a> Sync for Metadata<'a>
impl<'a> Unpin for Metadata<'a>
impl<'a> UnwindSafe for Metadata<'a>
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