Skip to content

Break down errors by extension codes #6381

@n1ru4l

Description

@n1ru4l

Background

We gather information about GraphQL requests that contain an error response (errors key is present within the GraphQL response).
This information is used to display the success and failure rate of GeaphQL request within the Hive Console dashboard, insight view.

Total failure rate

Image

Failure rate compared to success rate

Image

Failure rate by operation

Image


A common practice is to use the code property within the error extensions to identify the origin of the error.

E.g. if a access token sent to a GraphQL API is expired, the following response could be interpreted by the frontend client for refreshing the access token.

{
  "errors": [
    {
       "message": "AccessToken expired",
       "extensions": { "code":  "NEEDS_REFRESH" }
    }
  ]
}

Or if a request was made without an access token, the following response could be interpreted by the frontend client for showing a log-in form.

{
  "errors": [
    {
       "message": "AccessToken expired",
       "extensions": { "code":  "UNAUTHENTICATED" }
    }
  ]
}

Apollo Server initially popularized this pattern and has become an unofficial standard for handling arbitrary errors that are not defined using the Schema SDL.


Task Overview

Users of Hive want to see the reason the reason on why the execution of a request failed without using additional tools. An enhancement would be to include the error code(s) within the usage reporting.

The following things need to be done:

  1. Adjust usage service to support sending error codes to the usage reporting API for the v2 protocol
  2. Adjust the Hive SDKs for extracting the error codes from an error response and include them in the JSON payload sent to the usage reporting API (also include a way to customize the extraction of the error codes; sending error codes should be opt-in)
  3. Figure out how to store the error code data within our Clickhouse database
  4. Figure out how to display the information within the hive insights dashboard
  • Breakdown of all error codes
  • Breakdown of error codes per operation within the operation details view

Links

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions