hasura / hasura/graphql-engine

Add Optional Server-Timing Headers to the HTTP Response

Open
#8,104 0 comments 1 reaction 0 assignees View on GitHub
k/enhancement
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Is your proposal related to a problem?

When debugging latency issues, it can be difficult to distinguish between geographical latency, VPN latency, and the individual GraphQL query latency itself.

### Describe the solution you'd like

Add `Server-Timing` header(s) to requests when enabled from the admin console.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing

For example on a GraphQL query like this:
```gql
query HeroNameAndFriends {
hero {
name
friends {
name
}
}
}

mutation CreateReviewForEpisode($ep: Episode!, $review: ReviewInput!) {
createReview(episode: $ep, review: $review) {
stars
commentary
}
}
```
```
Server-Timing: HeroNameAndFriends;dur=1.4, CreateReviewForEpisode;dur=5.7
```

### Describe alternatives you've considered

Server metrics such as AWS X-Ray, AppDynamics, etc. allow for aggregate timing over a longer period with analytics, but lacking per-request timing lengthens the feedback cycle for developers calling the GraphQL endpoint.

### If the feature is approved, would you be willing to submit a PR?

No. Sadly, my Haskell proficiency does not allow for that.

Contributor guide

Open the contributing guide

Research direction

Start by locating the admin-console setting and the GraphQL request handling that would control optional response headers. Read the linked Server-Timing specification and trace how query names and durations could be exposed. Done means enabled requests include the requested timing headers while disabled requests remain unchanged, with coverage for queries and mutations.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, haskell
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.