count Metrics Operator
Counts the total number of time series that match the query. If grouping is specified, it counts the total number for each group.
Syntax​
count [by FIELD [, FIELD, ...]]
Examples​
Count of time series for a metric​
This query returns the number of time series for the size
metric.Â
metric=size | count
Count of time series for a metric by IP address​
This query returns the number of time series for the size metric by src_ip.Â
metric=size | count by src_ip
Count of 4xx errors by method​
This example shows a query in the Metrics Explorer in basic mode. In advanced mode, the query would look like:
metric=4XXError | count by method
In this query, we're searching for how many 4xx errors occurred by different methods, for example, GET, PUT, DELETE, and so on.