For general HTTP endpoints, we could usually calculate its availability by 2xx requests / total requests, or non-5xx-requests / total requests.
However GraphQL endpoints treat error as data and may include multiple data points in one single query. Is there a best practice to measure availability of that?
We are going to define a list of error codes which could be classified into 4xx-like and 5xx-like types. And if there is any 5xx-like error code in the error list of response, this request could be marked as a failure request. The availability could be calculated by non-failure requests / total requests. Does this make sense? Or any better idea?
For general HTTP endpoints, we could usually calculate its availability by 2xx requests / total requests, or non-5xx-requests / total requests.
However GraphQL endpoints treat error as data and may include multiple data points in one single query. Is there a best practice to measure availability of that?
We are going to define a list of error codes which could be classified into 4xx-like and 5xx-like types. And if there is any 5xx-like error code in the error list of response, this request could be marked as a failure request. The availability could be calculated by non-failure requests / total requests. Does this make sense? Or any better idea?
Share Improve this question asked Mar 28 at 14:15 predefined42predefined42 1 1- Please provide enough code so others can better understand or reproduce the problem. – Community Bot Commented Mar 29 at 14:40
1 Answer
Reset to default 0In this context GraphQL should be seen as a higher level protocol than HTTP. Standard HTTP mechanisms for evaluating availability still work, but may not provide the full picture, while still being valid. Still a non-2xx response code for HTTP is a valid indicator or error.
What you are asking is similar to trying to evaluate availability of HTTP just by relying on TCP metrics (lower level transport protocol).
There isn't a well established mechanism that is de-facto standardized. What makes it even tricky is that GraphQL can also work over other transports (WebSocket or MQTT).
If you are using a popular off the shelf GraphQL server likely it already has some metrics that it provides.
If you are using a custom implemented the following custom metrics could indicate issues:
Percentage of responses including errors
Average number of errors in responses (there may be more than one)