pub struct PrometheusEncoder { /* private fields */ }Expand description
Encoder for Prometheus text exposition snapshots.
The encoder is intentionally transport-agnostic: callers can write the
returned text to a file, serve it from their own HTTP endpoint, or pass it to
another delivery mechanism without enabling the pushgateway feature.
Implementations§
Source§impl PrometheusEncoder
impl PrometheusEncoder
Sourcepub const DEFAULT_PREFIX: &'static str = "iperf3"
pub const DEFAULT_PREFIX: &'static str = "iperf3"
Default metric prefix used by the CLI, PrometheusEncoder, and
Pushgateway helpers.
Sourcepub fn new(metric_prefix: impl Into<String>) -> Result<Self>
pub fn new(metric_prefix: impl Into<String>) -> Result<Self>
Build an encoder with a custom metric name prefix.
Sourcepub fn with_labels<I, K, V>(
metric_prefix: impl Into<String>,
labels: I,
) -> Result<Self>
pub fn with_labels<I, K, V>( metric_prefix: impl Into<String>, labels: I, ) -> Result<Self>
Build an encoder with fixed labels on every emitted sample.
Sourcepub fn metric_prefix(&self) -> &str
pub fn metric_prefix(&self) -> &str
Return the metric prefix used by this encoder.
Sourcepub fn labels(&self) -> &[(String, String)]
pub fn labels(&self) -> &[(String, String)]
Return fixed labels applied to every emitted sample.
Sourcepub fn encode_interval(&self, metrics: &Metrics) -> String
pub fn encode_interval(&self, metrics: &Metrics) -> String
Encode one immediate interval sample as Prometheus text exposition.
Sourcepub fn encode_window(&self, metrics: &WindowMetrics) -> String
pub fn encode_window(&self, metrics: &WindowMetrics) -> String
Encode one aggregated window summary as Prometheus text exposition.
Trait Implementations§
Source§impl Clone for PrometheusEncoder
impl Clone for PrometheusEncoder
Source§fn clone(&self) -> PrometheusEncoder
fn clone(&self) -> PrometheusEncoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrometheusEncoder
impl Debug for PrometheusEncoder
Source§impl Default for PrometheusEncoder
impl Default for PrometheusEncoder
Source§impl PartialEq for PrometheusEncoder
impl PartialEq for PrometheusEncoder
impl Eq for PrometheusEncoder
impl StructuralPartialEq for PrometheusEncoder
Auto Trait Implementations§
impl Freeze for PrometheusEncoder
impl RefUnwindSafe for PrometheusEncoder
impl Send for PrometheusEncoder
impl Sync for PrometheusEncoder
impl Unpin for PrometheusEncoder
impl UnsafeUnpin for PrometheusEncoder
impl UnwindSafe for PrometheusEncoder
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