Struct influent::measurement::Measurement
[−]
[src]
pub struct Measurement<'a> { pub key: &'a str, pub timestamp: Option<i64>, pub fields: BTreeMap<&'a str, Value<'a>>, pub tags: BTreeMap<&'a str, &'a str>, }
Measurement model.
Fields
key: &'a str
Key.
timestamp: Option<i64>
Timestamp.
fields: BTreeMap<&'a str, Value<'a>>
Map of fields.
Map of tags.
Methods
impl<'a> Measurement<'a>
[src]
fn new(key: &str) -> Measurement
Constructs a new Measurement
.
Examples
use influent::measurement::Measurement; let measurement = Measurement::new("key");
fn add_field(&mut self, field: &'a str, value: Value<'a>)
Adds field to the measurement.
Examples
use influent::measurement::{Measurement, Value}; let mut measurement = Measurement::new("key"); measurement.add_field("field", Value::String("hello"));
fn add_tag(&mut self, tag: &'a str, value: &'a str)
Adds tag to the measurement.
Examples
use influent::measurement::{Measurement, Value}; let mut measurement = Measurement::new("key"); measurement.add_tag("tag", "value");
fn set_timestamp(&mut self, timestamp: i64)
Sets the timestamp of the measurement. It should be unix timestamp in nanosecond
Examples
use influent::measurement::{Measurement, Value}; let mut measurement = Measurement::new("key"); measurement.set_timestamp(1434055562000000000)