Search code examples
grafanainfluxdb

grafana working with time difference influxdb


I have a measurements like this:

value | time
35101 | 1599719557000000000
35101 | 1599733107000000000
35102 | 1599733127000000000

I would like to show, maybe in a graph bar, the time difference between the last value and the previous value of a single value. I mean:

difference(1599719557000000000- 1599733107000000000) for value 35101

Is it possible? I reached this point:

Grafana dashboard

Thank you


Solution

  • InfluxDB ELAPSED function helps to find the time difference between subsequent timestamps

    In the measurement given in the question,

    SELECT ELAPSED(value, 1s) FROM tagId WHERE value = 35101
    

    should give the time between subsequent timestamps