Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[Feature Request] COUNT(): return zeros instead of no results #6412
Proposal: Provide a way to return zeros for count() queries instead of no results.
Current behavior: (Note: this feature request is a followup to what I mistakenly thought was a bug. That github issue is here: #6400)
Check out these two simple queries. The first query returns zeros for all of the grouped minutes for which there are no observations to count. That is the expected behavior -- return zero when there are no observations to count. The second query returns no results at all. That seems incorrect. The two queries only differ in the time part of the WHERE clause, but there is time overlap between them.
Desired behavior: Instead of not returning any results I would like the second query to return zeros:
Possible Implementation: @jsternberg mentiond in #6400 that, "In order to know what series need to be filled in, there needs to be at least one point with that name/tag combination. Since tags can be any arbitrary combination, it's impossible for us to know which combinations to fill without having some basis."
Perhaps an optional windowing period could be passed to count() to generate the list of tag combinations that could then be filled if missing?
Use case: This is rendering my Kapacitor alerts, which only sometimes fire due to inconsistent zero counts vs. no results, essentially useless. Kapacitor alerts that test for "count" == 0 cannot be relied upon to trigger when expected. This doesn't seem like it's Kapacitor's fault -- Influx is only returning zeros in the groups when there is a data point in the window.
@gargooza does https://docs.influxdata.com/kapacitor/v0.13/nodes/join_node/#fill meet your needs? It's a
is there any chance this is getting somewhere ? any update on the issue ?