Integral() gives incoherent values

So I’m using grafana to display the current over time:


The query:

Note that the math(1000) is just to convert from A to mA.
You can see that the average current is 0.663mA. If we supose this average as the constant value over the 24h period (which is what is being displayed) we would get: 0.663mA
24h=15.91mAh

So now I want to calculate and show this value but doing it the correct way. This means using integral() to take into account the fact that the current is not really constant (but nearly):
image
I multiply by 1000 to convert from A to mA and divide by 3600 to convert from seconds to hours.
At the end:
image
As you can see the result is 10 times bigger than the expected aproximated value.

What am I doing wrong?

Update

What I have found:

It seems like having discontinuos values screws up with integral() mesurement:


If I zoom in on the middle long measurements and the most recent:

This last one is a coherent measurement. There are two discontinuous data sets but it seems to work fine.

Zooming on the discarded measurements:

Which doesn’t add up to the initial 243mAh.

Any idea?

I think I have found the issue:

Seeing last 7 days:

If I pick those 7 days but selecting the time manually (click and drag on the graph):

The data viewed is the same but the viewing has changed from “last 7 days” to an absolute time range.

I supose this is a bug?

@Marti_B what version of InfluxDB are you using here?

I’m not familiar enough with the Grafana UI to know for sure based off your screenshots, so: are you using InfluxQL here, or Flux?

Hi @dan-moran I’m using InfluxQL

@Marti_B thanks! And what version of InfluxDB?

Sorry,

Connected to https://XDDDD:8086 version 1.8.3
InfluxDB shell version: 1.8.4