Browse Source

check if there are no fields (only tags), in which case add an integer field "n" with value 1

master
Jonathan Strong 6 years ago
parent
commit
e47c0952fb
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      src/influx.rs

+ 4
- 0
src/influx.rs View File

@@ -354,6 +354,10 @@ impl InfluxWriter {


if meas.timestamp.is_none() { meas.timestamp = Some(now()) } if meas.timestamp.is_none() { meas.timestamp = Some(now()) }


if meas.fields.is_empty() {
meas.fields.push(("n", OwnedValue::Integer(1)));
}

//#[cfg(feature = "trace")] { if count % 10 == 0 { trace!(logger, "rcvd new measurement"; "count" => count, "key" => meas.key); } } //#[cfg(feature = "trace")] { if count % 10 == 0 { trace!(logger, "rcvd new measurement"; "count" => count, "key" => meas.key); } }


count = next(count, &meas, &mut buf, &loop_time, &mut last); count = next(count, &meas, &mut buf, &loop_time, &mut last);


Loading…
Cancel
Save