Struct bosun_emitter::Datum

source ·
pub struct Datum<'a> {
    pub metric: &'a str,
    pub timestamp: i64,
    pub value: &'a str,
    pub tags: &'a Tags,
}
Expand description

Represents a metric datum.

Fields

metric: &'a str

Metric name

timestamp: i64

Unix timestamp in either s or ms

value: &'a str

Value as string representation

tags: &'a Tags

Tags for this metric datum

Implementations

Creates a new metric datum with a specified timestamp in ms.

Creates a new metric datum with timestamp now.

Encodes a Datum to JSON as String.

Example
let mut tags = Tags::new();
tags.insert("host".to_string(), "test-vm".to_string());
let datum = Datum::new("lukas.tests.count", 1458066838, "1", &tags);
let json = datum.to_json().unwrap();

Trait Implementations

Formats the value using the given formatter. Read more
Serialize a value using an Encoder.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.