Struct Registry
pub struct Registry { /* private fields */ }Expand description
A registry for [MetricsGroup].
Implementations§
§impl Registry
impl Registry
pub fn sub_registry_with_prefix(
&mut self,
prefix: impl Into<Cow<'static, str>>,
) -> &mut Registry
pub fn sub_registry_with_prefix( &mut self, prefix: impl Into<Cow<'static, str>>, ) -> &mut Registry
Creates a subregistry where all metrics are prefixed with prefix.
Returns a mutable reference to the subregistry.
pub fn sub_registry_with_labels(
&mut self,
labels: impl IntoIterator<Item = (impl Into<Cow<'static, str>>, impl Into<Cow<'static, str>>)>,
) -> &mut Registry
pub fn sub_registry_with_labels( &mut self, labels: impl IntoIterator<Item = (impl Into<Cow<'static, str>>, impl Into<Cow<'static, str>>)>, ) -> &mut Registry
Creates a subregistry where all metrics are labeled.
Returns a mutable reference to the subregistry.
pub fn sub_registry_with_label(
&mut self,
key: impl Into<Cow<'static, str>>,
value: impl Into<Cow<'static, str>>,
) -> &mut Registry
pub fn sub_registry_with_label( &mut self, key: impl Into<Cow<'static, str>>, value: impl Into<Cow<'static, str>>, ) -> &mut Registry
Creates a subregistry where all metrics have a key=value label.
Returns a mutable reference to the subregistry.
pub fn register(&mut self, metrics_group: Arc<dyn MetricsGroup>)
pub fn register(&mut self, metrics_group: Arc<dyn MetricsGroup>)
Registers a [MetricsGroup] into this registry.
pub fn register_all(&mut self, metrics_group_set: &impl MetricsGroupSet)
pub fn register_all(&mut self, metrics_group_set: &impl MetricsGroupSet)
Registers a [MetricsGroupSet] into this registry.
pub fn register_all_prefixed(
&mut self,
metrics_group_set: &impl MetricsGroupSet,
)
pub fn register_all_prefixed( &mut self, metrics_group_set: &impl MetricsGroupSet, )
Registers a [MetricsGroupSet] into this registry, prefixing all metrics with the group set’s name.
pub fn encode_openmetrics_to_writer(
&self,
writer: &mut impl Write,
) -> Result<(), Error>
pub fn encode_openmetrics_to_writer( &self, writer: &mut impl Write, ) -> Result<(), Error>
Encodes all metrics in the OpenMetrics text format.
This does not write the terminal # EOF\n string to writer.
You can use encode_openmetrics_eof to do that.
pub fn schema_version(&self) -> u64
pub fn schema_version(&self) -> u64
Returns the current schema version of this registry.
pub fn encode_schema(&self, schema: &mut Schema)
pub fn encode_schema(&self, schema: &mut Schema)
Encodes the schema of all registered metrics into the provided schema builder.
pub fn encode_values(&self, values: &mut Values)
pub fn encode_values(&self, values: &mut Values)
Encodes the current values of all registered metrics into the provided values builder.
Trait Implementations§
§impl MetricsSource for Registry
impl MetricsSource for Registry
§fn encode_openmetrics(&self, writer: &mut impl Write) -> Result<(), Error>
fn encode_openmetrics(&self, writer: &mut impl Write) -> Result<(), Error>
§fn encode_openmetrics_to_string(&self) -> Result<String, Error>
fn encode_openmetrics_to_string(&self) -> Result<String, Error>
Auto Trait Implementations§
impl Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl !UnwindSafe for Registry
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more