From e47c0952fb63aafeffea508b0aec62cdb4394363 Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Wed, 11 Jul 2018 00:48:12 -0400 Subject: [PATCH] check if there are no fields (only tags), in which case add an integer field "n" with value 1 --- src/influx.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/influx.rs b/src/influx.rs index d9612fc..f07c564 100644 --- a/src/influx.rs +++ b/src/influx.rs @@ -354,6 +354,10 @@ impl InfluxWriter { 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); } } count = next(count, &meas, &mut buf, &loop_time, &mut last);