Filter a Real-Time Metrics dashboard
Narrow every chart of a Real-Time Metrics dashboard to the requests you need, and apply the same filters to a GraphQL query.
You can narrow the charts of a Real-Time Metrics dashboard in Azion Console, or apply the same filters to a query with the GraphQL API. For every field, operator, and value type a filter accepts, refer to Filters and time range.
With no filter, a dashboard counts the data of your whole account. A filter keeps only the data whose field matches a value, such as the host, the status code, the request method, or the country. In the GraphQL API, these fields are host, status, requestMethod, and geolocCountryName.
Select your interface once. The prerequisites and each task on this page show only that path.
Prerequisites
- An application with requests in the time range you read.
- A host your workload answers on, such as
www.example.com, to combine filters.
- Access to Azion Console. To sign in, refer to How to access Azion Console.
Add a filter
This task keeps the requests that returned an error, with a status code of 400 or higher. Every chart of the dashboard then counts only those requests.
To apply the same filter with the GraphQL API, send a POST request to https://api.azion.com/v4/metrics/graphql. In filter, the statusGte key keeps the status codes of 400 or higher, next to the tsRange that every query requires. The query sums requests for each status code.
Replace [TOKEN VALUE] with your personal token, and the begin and end values with the period you want to read:
The API answers 200 with one row for each status code of 400 or higher:
Each row holds one status code and its request count in the range. A filter key is a field name followed by its operator, such as statusGte or hostEq. For every operator, refer to GraphQL queries.
Combine filters
Each filter you add narrows the data again, so the charts keep only the data that matches every filter. This task adds a host to the status filter from Add a filter, to read the errors of one host. Replace www.example.com with a host your workload answers on.
To combine filters with the API, add each one as a key of filter. This query adds hostEq to the statusGte filter:
The API answers 200 with the error responses of that host alone:
Each row counts only the requests that match both filters.
To keep any of several values of one field, use the In operator with a list. For example, statusIn: [404, 502] in place of statusGte: 400 returns only the rows of 404 and 502 over the same range, with the same counts as in the response of Add a filter.
Filter with the query input
The query input in the filter row takes filters as one typed expression in Azion Query Language. It also keeps several values of one field at once, which a single Equals filter cannot do. This task keeps the requests that returned 404 or 502.
To filter with the query input in Azion Console:
Access Azion Console > Real-Time Metrics.
In the filter row, select the query input, whose placeholder reads Filter using Azion Query Language syntax....
Enter status in (404, 502).
While you type, the input suggests fields, then operators, then values. Ctrl + Space, or Cmd + Space, opens the suggestions.
Press Enter.
Every chart of the dashboard now counts only the requests that returned 404 or 502.
To keep a range of values instead, use between with exactly two values: status between (400, 499) keeps the status codes from 400 to 499. For the syntax of each operator in the query input, refer to Filters and time range. When the input shows a validation message and Refresh stays disabled, refer to Troubleshoot Real-Time Metrics.
Edit or remove a filter
Each applied filter shows as a chip under the filter row. Selecting a chip reopens that filter, and its remove icon deletes it.
To edit a filter in Azion Console:
Under the filter row, select the chip of the filter.
The Filter popover opens with the values of that filter. A lock icon replaces the arrow of the field, because the field cannot change.
The chip shows the new operator or value, and every chart of the dashboard follows the changed filter.
To remove a filter, select the remove icon on its chip, and repeat for each filter you want to remove. The chip disappears, and the charts stop applying that filter.
Switching to a dashboard that reads another dataset clears every filter and keeps the time range.