influxdb: Derivative of nulls is not null
System info:
influxdb 0.13.0
Steps to reproduce:
- Use a measurement with some gaps in it (e.g. several hours of no data)
- Run a
derivativeornon_negative_derivativeover the mean/median/mode(/etc.) of those values, grouping by a short time period, filling withfill(null)
Expected behavior:
The derivative function should fill with nulls where all its inputs are null.
Actual behavior:
The derivative function behaves the same as if fill(none) had been used, and suppresses records when its inputs are all null.
> SELECT non_negative_derivative(mean("value")) FROM "disk_read" WHERE "host" = 'kirisame' AND "instance" = 'sda' AND time >= now() - 24h GROUP BY "instance", time(1h) fill(none)
name: disk_read
tags: instance=sda
time non_negative_derivative
---- -----------------------
1471622400000000000 510468.42365956306
1471626000000000000 2.2326707869478226e+07
1471694400000000000 4.2967470870584756e+07
1471708800000000000 9.949401068170846e+06
> SELECT non_negative_derivative(mean("value")) FROM "disk_read" WHERE "host" = 'kirisame' AND "instance" = 'sda' AND time >= now() - 24h GROUP BY "instance", time(1h) fill(null)
name: disk_read
tags: instance=sda
time non_negative_derivative
---- -----------------------
1471622400000000000 510468.42365956306
1471626000000000000 2.2326707869478226e+07
1471694400000000000 4.2967470870584756e+07
1471708800000000000 9.949401068170846e+06
Additional info:
Seems like it was previously bug reported in #780 but the fix missed these functions.
In practice, the impact of this is incorrect grafana graphs (network usage here):

About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 12
- Comments: 15 (1 by maintainers)
Commits related to this issue
- dashboard: use fill(null) in InfluxQL requests This patch replaces fill(none) with fill(null) in dashboards InfluxQL requests. After this patch, all panels with non-derivative requests will show the ... — committed to tarantool/grafana-dashboard by DifferentialOrange 2 years ago
- dashboard: use fill(null) in InfluxQL requests This patch replaces fill(none) with fill(null) in dashboards InfluxQL requests. After this patch, all panels with non-derivative requests will show the ... — committed to tarantool/grafana-dashboard by DifferentialOrange 2 years ago
- dashboard: use fill(null) in InfluxQL requests This patch replaces fill(none) with fill(null) in dashboards InfluxQL requests. After this patch, all panels with non-derivative requests will show the ... — committed to tarantool/grafana-dashboard by DifferentialOrange 2 years ago
@chooko Ran into the same issue, and the way we solved this was by multiplying by count()/count()
SELECT non_negative_derivative(min("bytes"), 1s) * count("bytes") / count("bytes") * 8 FROM "net" WHERE "id" = 'id' AND time > now() - 24h GROUP BY time(60s) fill(null)I’ve got the same issue; if both points fed to the derivative are null, I’d like it to output null (or even one point? less sure on that) - I want to see a gap in my graph for that period. Is that incorrect behavior for a derivative function? Do we need something else?
e.g., I’d rather see the gap like:
Instead of skipping over the null output:
I’m seeing this same issue any “fix” yet?
As I don’t seem to be able to re-open someone elses issues: I don’t think this should be closed. You could pretty easily provide an option to the function and offer both behaviors.
@amit-meshbey, nice hack! It works for me.
Think InfluxDB team should be ashamed of having this workaround. Hope more pretty fix will appear sooner than they wanted.