Break down requests by status code
Split your applications' requests by status code, narrow them to one class, rank the hosts that return errors, and compare each code with the origin's answer.
You can split the requests of your applications by the HTTP status code they returned, in Azion Console or with the GraphQL API. Real-Time Metrics reads these numbers from the httpMetrics dataset. For what each chart of the Status Codes dashboard measures, refer to Build dashboards.
Prerequisites
- An Azion account. To create one, refer to Create an account.
- An application served by a workload, with requests in the range you want to read.
- Access to Azion Console. To sign in, refer to How to access Azion Console.
Open the status breakdown
The breakdown counts the requests of every application in your account, one count per status code.
To read the breakdown with the GraphQL API, send a POST request to https://api.azion.com/v4/metrics/graphql. The query sums requests and groups the sums by status.
Replace [TOKEN VALUE] with your personal token, and the begin and end values with your range:
The API answers 200 with one row per status code, the most frequent first:
The sum values of all rows add up to the requestsTotal of the range. limit: 100 keeps every code: without limit, the API returns 10 rows. For every field of the dataset, refer to Real-Time Metrics GraphQL fields.
Narrow it to one status class
A filter on the status code keeps one class, such as the 5XX server errors. This section keeps the codes from 500 to 599.
To filter with the API, add statusRange to filter, next to tsRange:
The API answers 200 with the 5XX codes alone:
To total a class, sum requests with statusRange, as above. requestsStatusCode5xx can return less for the same range, because it counts only the 5XX codes that have no field of their own. For each class field, refer to Build dashboards.
Find the hosts that return the errors
With the class filter in place, you can check which hosts return those errors. The API ranks every host in one query. In Azion Console, a second filter narrows the dashboard to one host at a time.
To rank the hosts with the API, keep statusRange and group by host instead of status:
The API answers 200 with the hosts that returned 5XX responses, the most errors first:
limit: 10 keeps the ten hosts with the most errors.
Find what the origin answered
The status code is what the client received. The upstream status is what the origin returned. When both carry the same error code, the error came from the origin.
In Azion Console, keep the Status filter and read the Requests by Status and Upstream Status table. Each row pairs a Status with an Upstream Status, and Total counts the requests with that pair. The table lists the 10 most frequent pairs.