Count

Count non zero

FunctionDescriptionExample
count_nonzero()Compute count of all non-zero values.count_nonzero(<METRIC_NAME>{*})

For a query grouped by one or more tag keys, count the number of tag values with non-zero metric values at each point.

Example: count_nonzero(system.cpu.user{*} by {host}) returns a timeseries representing the number of hosts with non-zero system load at each point.

count non zero

Note: count_nonzero_finite() can be used as an alias for count_nonzero().

Count not null

FunctionDescriptionExample
count_not_null()Compute count of all not null values.count_not_null(<METRIC_NAME>{*})

For a query grouped by one or more tag keys, count the number of tag values with non-null metric values at each point. A null metric value is when there is no finite value.

Example: count_not_null(system.cpu.user{*} by {host}) returns a timeseries representing the number of hosts with non-null system load at each point.

count not null

Other functions