influxdata / influxdata/kapacitor

Need way to count points where condition is true

Open
#1,277 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

I think we need a way to count the number of nodes where a certain condition is true.
Currently the only way to count things is with the InfluxQL `Count()` node. However this counts where the given field is non-null. Meaning to count where a condition is true, you have to do `|where(lambda: foo)|count("arbitrary_field")`. The problem with this is that if the `where()` drop all the points, then `count` doesn't receive anything, and thus doesn't emit anything either. So you can never get a count of 0.

Contributor guide

Open the contributing guide

Research direction

Start by examining the existing InfluxQL Count() node and how it receives output from where(). Confirm how the current pipeline behaves when where() drops every point; done should provide a conditional count that emits 0 when no points satisfy the condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
stream-processing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.