InfluxDB request from GitHub

I git this request on Github, and am publishing it here for comment and response.


Hi
I’m using InfluxDB + Grafana to display the metrics. Playing with the continuous queries to limit the amount of data to be stored.
Would it be possible for Iotawatt to simplify the usage of measurements by allowing to reuse the measurement names that are transfered to influxdb. Currently you cannot combine all related metrics into one measurement. (Except if I miss something?)
At the moment iotawatt will override an existing measurement if the same name is used.

For example it would be great to place all Wh metrics into a measurement WH or Consumption . Together with the tags $name , $device , $units we would still have full details and we would follow best practices for influxdb. .

In an answer to this github post Create InfluxDB Continuous Query where the measurement name is based on tag values - Stack Overflow
Encoding tag values in a measurements names contradicts InfluxDB official best practices and being discouraged. InfluxDB schema design and data layout | InfluxDB OSS 1.5 Documentation

For now I need to use some regex queries to capture all measurements for display like this:
SELECT sum(“value”) FROM /.+dWh/ WHERE $timeFilter GROUP BY time(1d)

Having all Consumption metrics in one single measurement would allow us to select from that one directly and if desired group by tags.
This would also improve the use of continuous queries as we only need to define one for data retention, keeping the tag details if desired.

What do you think?

We’ve been here before, everyone has a different idea of how to best organize their data, and wants IoTaWatt to allow them to do it that way. There was a contentious period early on with two competing camps advocating for vastly different approaches.

The problem is how to make a simple user interface that can produce a specification that runs efficiently in an ESP8266 every five seconds or so. While its nice to strive for absolute best practices that optimize the influxDB engine performance, influx is running in a much more powerful and capable environment and has less time constraint.

The current interface allows for naming all Wh metrics into a measurement called Wh by specifying the measurement as $units. All Wh measurements will be Wh, all Watts measurements will be Watts, etc.

As you point out, tags can be specified with a value equal to the name ($name), or the device ($device), or the units ($units) which would of course be redundant.

The name could also be conveyed as the field-key of each measurement by specifying field-key as $name. That would leave only a key for device, which would have a constant value for all measurements.

It seems to me that this scheme doesn’t violate the best practice. To the contrary, I think it does exactly what they recommend - minimizes the number of series.