pub struct PrometheusText { /* private fields */ }Expand description
Encodes MetricEvents into Prometheus text exposition format (version 0.0.4).
Output format for a metric with labels:
metric_name{label1="val1",label2="val2"} value timestamp_ms\nOutput format for a metric with no labels:
metric_name value timestamp_ms\nThe timestamp is in milliseconds since the Unix epoch (integer).
Label values are escaped: \ → \\, " → \", newline → \n.
When precision is set, metric values are formatted to the specified number
of decimal places (e.g., precision=2 formats 99.60573 as 99.61).
Implementations§
Trait Implementations§
Source§impl Default for PrometheusText
impl Default for PrometheusText
Source§impl Encoder for PrometheusText
impl Encoder for PrometheusText
Source§fn encode_metric(
&self,
event: &MetricEvent,
buf: &mut Vec<u8>,
) -> Result<(), SondaError>
fn encode_metric( &self, event: &MetricEvent, buf: &mut Vec<u8>, ) -> Result<(), SondaError>
Encode a metric event into Prometheus text exposition format.
Writes the formatted line into buf. Bytes are appended; the buffer is not
cleared before writing. Writes into the caller-provided buffer without
additional heap allocations.
Source§fn encode_log(
&self,
_event: &LogEvent,
_buf: &mut Vec<u8>,
) -> Result<(), SondaError>
fn encode_log( &self, _event: &LogEvent, _buf: &mut Vec<u8>, ) -> Result<(), SondaError>
Encode a log event into the provided buffer. Read more
Auto Trait Implementations§
impl Freeze for PrometheusText
impl RefUnwindSafe for PrometheusText
impl Send for PrometheusText
impl Sync for PrometheusText
impl Unpin for PrometheusText
impl UnsafeUnpin for PrometheusText
impl UnwindSafe for PrometheusText
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