metrics/metrics/src/lib.rs

477 lines
19 KiB
Rust
Raw Normal View History

//! A lightweight metrics facade.
//!
//! The `metrics` crate provides a single metrics API that abstracts over the actual metrics
//! implementation. Libraries can use the metrics API provided by this crate, and the consumer of
//! those libraries can choose the metrics implementation that is most suitable for its use case.
//!
2020-10-25 13:59:44 -07:00
//! # Overview
//! `metrics` exposes two main concepts: emitting a metric, and recording it.
//!
2020-10-25 13:59:44 -07:00
//! ## Emission
//! Metrics are emitted by utilizing the registration or emission macros. There is a macro for
//! registering and emitting each fundamental metric type:
2020-10-28 18:19:50 -07:00
//! - [`register_counter!`], [`increment!`], and [`counter!`] for counters
//! - [`register_gauge!`] and [`gauge!`] for gauges
//! - [`register_histogram!`] and [`histogram!`] for histograms
2020-10-25 13:59:44 -07:00
//!
//! In order to register or emit a metric, you need a way to record these events, which is where
//! [`Recorder`] comes into play.
//!
//! ## Recording
//! The [`Recorder`] trait defines the interface between the registration/emission macros, and
2020-10-28 19:43:42 -07:00
//! exporters, which is how we refer to concrete implementations of [`Recorder`]. The trait defines
2020-10-25 13:59:44 -07:00
//! what the exporters are doing -- recording -- but ultimately exporters are sending data from your
//! application to somewhere else: whether it be a third-party service or logging via standard out.
//! It's "exporting" the metric data somewhere else besides your application.
//!
//! Each metric type is usually reserved for a specific type of use case, whether it be tracking a
//! single value or allowing the summation of multiple values, and the respective macros elaborate
//! more on the usage and invariants provided by each.
//!
//! # Getting Started
//!
//! ## In libraries
2020-10-25 13:59:44 -07:00
//! Libraries need only include the `metrics` crate to emit metrics. When an executable installs a
//! recorder, all included crates which emitting metrics will now emit their metrics to that record,
//! which allows library authors to seamless emit their own metrics without knowing or caring which
//! exporter implementation is chosen, or even if one is installed.
//!
//! In cases where no global recorder is installed, a "noop" recorder lives in its place, which has
//! an incredibly very low overhead: an atomic load and comparison. Libraries can safely instrument
//! their code without fear of ruining baseline performance.
//!
//! ### Examples
//!
//! ```rust
//! use metrics::{histogram, counter};
//!
//! # use std::time::Instant;
//! # pub fn run_query(_: &str) -> u64 { 42 }
//! pub fn process(query: &str) -> u64 {
//! let start = Instant::now();
//! let row_count = run_query(query);
//! let delta = Instant::now() - start;
//!
//! histogram!("process.query_time", delta);
//! counter!("process.query_row_count", row_count);
//!
//! row_count
//! }
//! # fn main() {}
//! ```
//!
//! ## In executables
//!
2020-10-25 13:59:44 -07:00
//! Executables, which themselves can emit their own metrics, are intended to install a global
//! recorder so that metrics can actually be recorded and exported somewhere.
//!
2020-10-25 13:59:44 -07:00
//! Initialization of the global recorder isn't required for macros to function, but any metrics
//! emitted before a global recorder is installed will not be recorded, so early initialization is
//! recommended when possible.
//!
//! ### Warning
//!
//! The metrics system may only be initialized once.
//!
2020-10-25 13:59:44 -07:00
//! For most use cases, you'll be using an off-the-shelf exporter implementation that hooks up to an
//! existing metrics collection system, or interacts with the existing systems/processes that you use.
//!
//! Out of the box, some exporter implementations are available for you to use:
//!
//! * [metrics-exporter-tcp] - outputs metrics to clients over TCP
//! * [metrics-exporter-prometheus] - serves a Prometheus scrape endpoint
//!
//! You can also implement your own recorder if a suitable one doesn't already exist.
//!
2020-10-25 13:59:44 -07:00
//! # Development
//!
2020-10-25 13:59:44 -07:00
//! The primary interface with `metrics` is through the [`Recorder`] trait, so we'll show examples
//! below of the trait and implementation notes.
//!
2020-10-25 13:59:44 -07:00
//! ## Implementing and installing a basic recorder
//!
//! Here's a basic example which writes metrics in text form via the `log` crate.
Entirely remove the event loop and switch to pure atomics. Originally, metrics (and `hotmic` before it was converted) was based on an event loop that centered around `mio`'s `Poll` interface with a custom channel to read and write metrics to. That model required a dedicated thread to run to poll for writes, and ingest them, managing the internal data structures in turn. Eventually, I rewrote that portion to be based on `crossbeam-channel` but we still depended on a background thread to pop samples off the channel and process them. Instead, we've rewritten the core of metrics to be based purely on atomics, with the caveat that we still do have a background thread. Instead of a single channel that metrics are funneled into, each underlying metric becomes a single-track codepath: each metric is backed by an atomic structure which means we can pass handles to that storage as far as the callers themselves, eliminating the need to funnel metrics into the "core" where they all contend for processing. Counters are gauges are now, effectively, wrapped atomic integers, which means we can process over 100 million counter/gauge updates per core. Histograms are based on a brand-new atomic "bucket" that allows for fast, unbounded writes and the ability to snapshot at any time. The end result is that we can process a mixed workload (counter, gauge, and histogram) at sample rates of up to 30 million samples per second per core, with p999 ingest latencies of in the low hundreds of nanoseconds. Taking snapshots also now avoids stalling the event loop and driving up tail latencies for ingest, and writers can proceed with no interruption. There is still a background thread that is part of quanta's new "recent" time support, which allows a background thread to incrementally update a shared global time, which can be accessed more quickly than grabbing the time directly. For our purposes, only histograms need the time to perform the window upkeep inherent to the sliding windows we use, and the time they need can be far less precise than what quanta is capable of. This background thread is spawned automatically when creating a receiver, and drops when the receiver goes away. By default, it updates 20 times a second performing an operation which itself takes less than 100ns, so all in all, this background thread should be imperceptible, performance-wise, on all systems*. On top of all of this, we've embraced the natural pattern of defining metrics individually at the variable/field level, and added supported for proxy types, which can be acquired from a sink and embedded as fields within your existing types, which lets you directly update metrics with the ease of accessing a field in an object. Sinks still have the ability to have metrics pushed directly into them, but this just opens up more possibilities. * - famous last words
2019-05-27 17:41:42 -07:00
//!
//! ```rust
//! use log::info;
2020-10-17 10:10:28 -07:00
//! use metrics::{Key, Recorder, Unit};
2020-10-25 13:59:44 -07:00
//! use metrics::SetRecorderError;
//!
//! struct LogRecorder;
//!
//! impl Recorder for LogRecorder {
2020-10-17 10:10:28 -07:00
//! fn register_counter(&self, key: Key, _unit: Option<Unit>, _description: Option<&'static str>) {}
//!
2020-10-17 10:10:28 -07:00
//! fn register_gauge(&self, key: Key, _unit: Option<Unit>, _description: Option<&'static str>) {}
//!
2020-10-17 10:10:28 -07:00
//! fn register_histogram(&self, key: Key, _unit: Option<Unit>, _description: Option<&'static str>) {}
//!
//! fn increment_counter(&self, key: Key, value: u64) {
//! info!("counter '{}' -> {}", key, value);
//! }
//!
//! fn update_gauge(&self, key: Key, value: f64) {
//! info!("gauge '{}' -> {}", key, value);
//! }
//!
//! fn record_histogram(&self, key: Key, value: u64) {
//! info!("histogram '{}' -> {}", key, value);
//! }
//! }
Entirely remove the event loop and switch to pure atomics. Originally, metrics (and `hotmic` before it was converted) was based on an event loop that centered around `mio`'s `Poll` interface with a custom channel to read and write metrics to. That model required a dedicated thread to run to poll for writes, and ingest them, managing the internal data structures in turn. Eventually, I rewrote that portion to be based on `crossbeam-channel` but we still depended on a background thread to pop samples off the channel and process them. Instead, we've rewritten the core of metrics to be based purely on atomics, with the caveat that we still do have a background thread. Instead of a single channel that metrics are funneled into, each underlying metric becomes a single-track codepath: each metric is backed by an atomic structure which means we can pass handles to that storage as far as the callers themselves, eliminating the need to funnel metrics into the "core" where they all contend for processing. Counters are gauges are now, effectively, wrapped atomic integers, which means we can process over 100 million counter/gauge updates per core. Histograms are based on a brand-new atomic "bucket" that allows for fast, unbounded writes and the ability to snapshot at any time. The end result is that we can process a mixed workload (counter, gauge, and histogram) at sample rates of up to 30 million samples per second per core, with p999 ingest latencies of in the low hundreds of nanoseconds. Taking snapshots also now avoids stalling the event loop and driving up tail latencies for ingest, and writers can proceed with no interruption. There is still a background thread that is part of quanta's new "recent" time support, which allows a background thread to incrementally update a shared global time, which can be accessed more quickly than grabbing the time directly. For our purposes, only histograms need the time to perform the window upkeep inherent to the sliding windows we use, and the time they need can be far less precise than what quanta is capable of. This background thread is spawned automatically when creating a receiver, and drops when the receiver goes away. By default, it updates 20 times a second performing an operation which itself takes less than 100ns, so all in all, this background thread should be imperceptible, performance-wise, on all systems*. On top of all of this, we've embraced the natural pattern of defining metrics individually at the variable/field level, and added supported for proxy types, which can be acquired from a sink and embedded as fields within your existing types, which lets you directly update metrics with the ease of accessing a field in an object. Sinks still have the ability to have metrics pushed directly into them, but this just opens up more possibilities. * - famous last words
2019-05-27 17:41:42 -07:00
//!
2020-10-25 13:59:44 -07:00
//! // Recorders are installed by calling the [`set_recorder`] function. Recorders should provide a
//! // function that wraps the creation and installation of the recorder:
//!
//! static RECORDER: LogRecorder = LogRecorder;
//!
//! pub fn init() -> Result<(), SetRecorderError> {
//! metrics::set_recorder(&RECORDER)
//! }
//! # fn main() {}
2019-06-11 18:38:05 -07:00
//! ```
2020-10-25 13:59:44 -07:00
//! ## Keys
2019-06-11 18:38:05 -07:00
//!
2020-10-25 13:59:44 -07:00
//! All metrics are, in essence, the combination of a metric type and metric identifier, such as a
//! histogram called "response_latency". You could conceivably have multiple metrics with the same
//! name, so long as they are of different types.
//!
2020-10-25 13:59:44 -07:00
//! As the types are enforced/limited by the [`Recorder`] trait itself, the remaining piece is the
//! identifier, which we handle by using [`Key`].
2019-06-11 18:38:05 -07:00
//!
2020-10-25 13:59:44 -07:00
//! [`Key`] itself is a wrapper for [`KeyData`], which holds not only the name of a metric, but
//! potentially holds labels for it as well. The name of a metric must always be a literal string.
//! The labels are a key/value pair, where both components are strings as well.
//!
2020-10-25 13:59:44 -07:00
//! Internally, `metrics` uses a clone-on-write "smart pointer" for these values to optimize cases
//! where the values are static strings, which can provide significant performance benefits. These
//! smart pointers can also hold owned `String` values, though, so users can mix and match static
//! strings and owned strings for labels without issue. Metric names, as mentioned above, are always
//! static strings.
//!
//! Two [`Key`] objects can be checked for equality and considered to point to the same metric if
//! they are equal. Equality checks both the name of the key and the labels of a key. Labels are
//! _not_ sorted prior to checking for equality, but insertion order is maintained, so any [`Key`]
//! constructed from the same set of labels in the same order should be equal.
//!
//! It is an implementation detail if a recorder wishes to do an deeper equality check that ignores
//! the order of labels, but practically speaking, metric emission, and thus labels, should be
//! fixed in ordering in nearly all cases, and so it isn't typically a problem.
//!
//! ## Registration
//!
//! Recorders must handle the "registration" of a metric.
//!
//! In practice, registration solves two potential problems: providing metadata for a metric, and
//! creating an entry for a metric even though it has not been emitted yet.
//!
//! Callers may wish to provide a human-readable description of what the metric is, or provide the
//! units the metrics uses. Additionally, users may wish to register their metrics so that they
//! show up in the output of the installed exporter even if the metrics have yet to be emitted.
//! This allows callers to ensure the metrics output is stable, or allows them to expose all of the
//! potential metrics a system has to offer, again, even if they have not all yet been emitted.
//!
//! As you can see from the trait, the registration methods treats the metadata as optional, and
//! the macros allow users to mix and match whichever fields they want to provide.
//!
//! When a metric is registered, the expectation is that it will show up in output with a default
//! value, so, for example, a counter should be initialized to zero, a histogram would have no
//! values, and so on.
//!
//! ## Emission
//!
//! Likewise, records must handle the emission of metrics as well.
//!
//! Comparatively speaking, emission is not too different from registration: you have access to the
//! same [`Key`] as well as the value being emitted.
//!
//! For recorders which temporarily buffer or hold on to values before exporting, a typical approach
//! would be to utilize atomic variables for the storage. For counters and gauges, this can be done
//! simply by using types like [`AtomicU64`](std::sync::atomic::AtomicU64). For histograms, this can be
//! slightly tricky as you must hold on to all of the distinct values. In our helper crate,
2020-10-28 20:12:06 -07:00
//! [`metrics-util`][metrics-util], we've provided a type called [`AtomicBucket`][AtomicBucket]. For
//! exporters that will want to get all of the current values in a batch, while clearing the bucket so
//! that values aren't processed again, [AtomicBucket] provides a simple interface to do so, as well as
//! optimized performance on both the insertion and read side.
2020-10-25 13:59:44 -07:00
//!
//! ## Installing recorders
//!
//! In order to actually use an exporter, it must be installed as the "global" recorder. This is a
//! static recorder that the registration and emission macros refer to behind-the-scenes. `metrics`
//! provides a few methods to do so: [`set_recorder`], [`set_boxed_recorder`], and [`set_recorder_racy`].
//!
//! Primarily, you'll use [`set_boxed_recorder`] to pass a boxed version of the exporter to be
//! installed. This is due to the fact that most exporters won't be able to be constructed
//! statically. If you could construct your exporter statically, though, then you could instead
//! choose [`set_recorder`].
//!
//! Similarly, [`set_recorder_racy`] takes a static reference, but is also not thread safe, and
//! should only be used on platforms which do not support atomic operations, such as embedded
//! environments.
2019-06-11 18:38:05 -07:00
//!
//! [metrics-exporter-tcp]: https://docs.rs/metrics-exporter-tcp
//! [metrics-exporter-prometheus]: https://docs.rs/metrics-exporter-prometheus
2020-10-25 13:59:44 -07:00
//! [metrics-util]: https://docs.rs/metrics-util
//! [AtomicBucket]: https://docs.rs/metrics-util/0.4.0-alpha.6/metrics_util/struct.AtomicBucket.html
2019-06-01 12:55:28 -07:00
#![deny(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
2020-10-28 18:14:46 -07:00
#![cfg_attr(docsrs, feature(doc_cfg), deny(broken_intra_doc_links))]
extern crate alloc;
use proc_macro_hack::proc_macro_hack;
mod common;
pub use self::common::*;
2020-11-12 20:23:32 -08:00
mod cow;
mod key;
pub use self::key::*;
mod label;
pub use self::label::*;
mod recorder;
pub use self::recorder::*;
/// Registers a counter.
///
2020-10-25 13:59:44 -07:00
/// Counters represent a single monotonic value, which means the value can only be incremented, not
/// decremented, and always starts out with an initial value of zero.
///
2020-10-25 13:59:44 -07:00
/// Metrics can be registered with an optional unit and description. Whether or not the installed
/// recorder does anything with the description is implementation defined. Labels can also be
/// specified when registering a metric.
///
/// # Example
/// ```
/// # use metrics::register_counter;
2020-10-25 13:59:44 -07:00
/// # use metrics::Unit;
/// # fn main() {
/// // A basic counter:
/// register_counter!("some_metric_name");
///
2020-10-25 13:59:44 -07:00
/// // Providing a unit for a counter:
/// register_counter!("some_metric_name", Unit::Bytes);
///
/// // Providing a description for a counter:
2020-10-25 13:59:44 -07:00
/// register_counter!("some_metric_name", "total number of bytes");
///
/// // Specifying labels:
/// register_counter!("some_metric_name", "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// // We can combine the units, description, and labels arbitrarily:
/// register_counter!("some_metric_name", Unit::Bytes, "total number of bytes");
/// register_counter!("some_metric_name", Unit::Bytes, "service" => "http");
/// register_counter!("some_metric_name", "total number of bytes", "service" => "http");
///
/// // And all combined:
2020-10-25 13:59:44 -07:00
/// register_counter!("some_metric_name", Unit::Bytes, "number of woopsy daisies", "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// /// We can also pass labels by giving a vector or slice of key/value pairs. In this scenario,
/// // a unit or description can still be passed in their respective positions:
/// let dynamic_val = "woo";
/// let labels = [("dynamic_key", format!("{}!", dynamic_val))];
/// register_counter!("some_metric_name", &labels);
/// # }
/// ```
#[proc_macro_hack]
pub use metrics_macros::register_counter;
/// Registers a gauge.
///
2020-10-25 13:59:44 -07:00
/// Gauges represent a single value that can go up or down over time, and always starts out with an
/// initial value of zero.
///
2020-10-25 13:59:44 -07:00
/// Metrics can be registered with an optional unit and description. Whether or not the installed
/// recorder does anything with the description is implementation defined. Labels can also be
/// specified when registering a metric.
///
/// # Example
/// ```
/// # use metrics::register_gauge;
2020-10-25 13:59:44 -07:00
/// # use metrics::Unit;
/// # fn main() {
/// // A basic gauge:
/// register_gauge!("some_metric_name");
///
2020-10-25 13:59:44 -07:00
/// // Providing a unit for a gauge:
/// register_gauge!("some_metric_name", Unit::Bytes);
///
/// // Providing a description for a gauge:
2020-10-25 13:59:44 -07:00
/// register_gauge!("some_metric_name", "total number of bytes");
///
/// // Specifying labels:
/// register_gauge!("some_metric_name", "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// // We can combine the units, description, and labels arbitrarily:
/// register_gauge!("some_metric_name", Unit::Bytes, "total number of bytes");
/// register_gauge!("some_metric_name", Unit::Bytes, "service" => "http");
/// register_gauge!("some_metric_name", "total number of bytes", "service" => "http");
///
/// // And all combined:
2020-10-25 13:59:44 -07:00
/// register_gauge!("some_metric_name", Unit::Bytes, "total number of bytes", "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// // We can also pass labels by giving a vector or slice of key/value pairs. In this scenario,
/// // a unit or description can still be passed in their respective positions:
/// let dynamic_val = "woo";
/// let labels = [("dynamic_key", format!("{}!", dynamic_val))];
/// register_gauge!("some_metric_name", &labels);
/// # }
/// ```
#[proc_macro_hack]
pub use metrics_macros::register_gauge;
/// Records a histogram.
///
2020-10-25 13:59:44 -07:00
/// Histograms measure the distribution of values for a given set of measurements, and start with no
/// initial values.
///
2020-10-25 13:59:44 -07:00
/// Metrics can be registered with an optional unit and description. Whether or not the installed
/// recorder does anything with the description is implementation defined. Labels can also be
/// specified when registering a metric.
///
/// # Example
/// ```
/// # use metrics::register_histogram;
2020-10-25 13:59:44 -07:00
/// # use metrics::Unit;
/// # fn main() {
/// // A basic histogram:
/// register_histogram!("some_metric_name");
///
2020-10-25 13:59:44 -07:00
/// // Providing a unit for a histogram:
/// register_histogram!("some_metric_name", Unit::Nanoseconds);
///
/// // Providing a description for a histogram:
2020-10-25 13:59:44 -07:00
/// register_histogram!("some_metric_name", "request handler duration");
///
/// // Specifying labels:
/// register_histogram!("some_metric_name", "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// // We can combine the units, description, and labels arbitrarily:
/// register_histogram!("some_metric_name", Unit::Nanoseconds, "request handler duration");
/// register_histogram!("some_metric_name", Unit::Nanoseconds, "service" => "http");
/// register_histogram!("some_metric_name", "request handler duration", "service" => "http");
///
/// // And all combined:
2020-10-25 13:59:44 -07:00
/// register_histogram!("some_metric_name", Unit::Nanoseconds, "request handler duration", "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// // We can also pass labels by giving a vector or slice of key/value pairs. In this scenario,
/// // a unit or description can still be passed in their respective positions:
/// let dynamic_val = "woo";
/// let labels = [("dynamic_key", format!("{}!", dynamic_val))];
/// register_histogram!("some_metric_name", &labels);
/// # }
/// ```
#[proc_macro_hack]
pub use metrics_macros::register_histogram;
2020-10-25 13:59:44 -07:00
/// Increments a counter by one.
///
2020-10-25 13:59:44 -07:00
/// Counters represent a single monotonic value, which means the value can only be incremented, not
/// decremented, and always starts out with an initial value of zero.
///
/// # Example
/// ```
/// # use metrics::increment;
/// # fn main() {
/// // A basic increment:
/// increment!("some_metric_name");
///
/// // Specifying labels:
/// increment!("some_metric_name", "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// // We can also pass labels by giving a vector or slice of key/value pairs:
/// let dynamic_val = "woo";
/// let labels = [("dynamic_key", format!("{}!", dynamic_val))];
/// increment!("some_metric_name", &labels);
/// # }
/// ```
#[proc_macro_hack]
pub use metrics_macros::increment;
/// Increments a counter.
///
2020-10-25 13:59:44 -07:00
/// Counters represent a single monotonic value, which means the value can only be incremented, not
/// decremented, and always starts out with an initial value of zero.
///
/// # Example
/// ```
/// # use metrics::counter;
/// # fn main() {
/// // A basic counter:
/// counter!("some_metric_name", 12);
///
/// // Specifying labels:
/// counter!("some_metric_name", 12, "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// // We can also pass labels by giving a vector or slice of key/value pairs:
/// let dynamic_val = "woo";
/// let labels = [("dynamic_key", format!("{}!", dynamic_val))];
/// counter!("some_metric_name", 12, &labels);
/// # }
/// ```
#[proc_macro_hack]
pub use metrics_macros::counter;
/// Updates a gauge.
///
2020-10-25 13:59:44 -07:00
/// Gauges represent a single value that can go up or down over time, and always starts out with an
/// initial value of zero.
///
/// # Example
/// ```
/// # use metrics::gauge;
/// # fn main() {
/// // A basic gauge:
/// gauge!("some_metric_name", 42.2222);
///
/// // Specifying labels:
/// gauge!("some_metric_name", 66.6666, "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// // We can also pass labels by giving a vector or slice of key/value pairs:
/// let dynamic_val = "woo";
/// let labels = [("dynamic_key", format!("{}!", dynamic_val))];
/// gauge!("some_metric_name", 42.42, &labels);
/// # }
/// ```
#[proc_macro_hack]
pub use metrics_macros::gauge;
/// Records a histogram.
///
2020-10-25 13:59:44 -07:00
/// Histograms measure the distribution of values for a given set of measurements, and start with no
/// initial values.
///
/// # Implicit conversions
/// Histograms are represented as `u64` values, but often come from another source, such as a time
/// measurement. By default, `histogram!` will accept a `u64` directly or a
/// [`Duration`](std::time::Duration), which uses the nanoseconds total as the converted value.
///
/// External libraries and applications can create their own conversions by implementing the
/// [`IntoU64`] trait for their types, which is required for the value being passed to `histogram!`.
///
/// # Example
/// ```
/// # use metrics::histogram;
/// # use std::time::Duration;
/// # fn main() {
/// // A basic histogram:
/// histogram!("some_metric_name", 34);
///
/// // An implicit conversion from `Duration`:
/// let d = Duration::from_millis(17);
/// histogram!("some_metric_name", d);
///
/// // Specifying labels:
/// histogram!("some_metric_name", 38, "service" => "http");
///
2020-10-25 13:59:44 -07:00
/// // We can also pass labels by giving a vector or slice of key/value pairs:
/// let dynamic_val = "woo";
/// let labels = [("dynamic_key", format!("{}!", dynamic_val))];
/// histogram!("some_metric_name", 1337, &labels);
/// # }
/// ```
#[proc_macro_hack]
pub use metrics_macros::histogram;