Skip to content

count

Count aggregation operator. There are two variants of the :count operator.

Aggregation

Input Stack:
Query
Output Stack:
AggregationFunction

Compute the number of time series that match the query and have a value for a given interval.

name,ssCpuUser,:eq,
:count

When matching against the sample data in the table below, the highlighted time series would be included in the aggregate result:

Namenf.appnf.nodeData
ssCpuUser alerttest i-0123 [1.0, 2.0, NaN]
ssCpuSystem alerttest i-0123 [3.0, 4.0, 5.0]
ssCpuUser nccp i-0abc [8.0, 7.0, 6.0]
ssCpuSystem nccp i-0abc [6.0, 7.0, 8.0]
numRequests nccp i-0abc [1.0, 2.0, 4.0]
ssCpuUser api i-0456 [1.0, 2.0, 2.0]

The values from the corresponding intervals will be aggregated. For the first interval using the sample data above the values are 1.0, 8.0, and 1.0. Each value other than NaN contributes one to the count. This leads to a final result of:

NameData
ssCpuUser [3.0, 3.0, 2.0]

The only tags for the aggregated result are those that are matched exactly (:eq clause) as part of the choosing criteria or are included in a group by.

Math

Input Stack:
TimeSeriesExpr
Output Stack:
TimeSeriesExpr

Compute the number of time series from the input expression and have a value for a given interval. Example:

BeforeAfter
name,sps,:eq,
(,nf.cluster,),:by
name,sps,:eq,
(,nf.cluster,),:by,
:count