graphile / graphile/crystal

Add Optional Server-Timing Headers to the HTTP Response

Open
#1,579 1 comment 1 reaction 0 assignees View on GitHub
✨ feature
Dominant language
TypeScript
Stars
12.9k
Forks
625
Avg merge
5h 23m
Merged PRs (30d)
24

Description

### Feature description

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

### Motivating example

It was really hard to determine proper socket timeout values for tests vs live vs development, knowing how long the actual queries took rather than figuring out how much my VPN and cross-country latency were adding to the total.

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 `Server-Timing` headers were added to responses when enabled, it would effectively solve this problem.
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
```

### Supporting development

I [tick all that apply]:

- [ ] am interested in building this feature myself
- [ ] am interested in collaborating on building this feature
- [x] am willing to help testing this feature before it's released
- [ ] am willing to write a test-driven test suite for this feature (before it exists)
- [ ] am a [Graphile sponsor](https://www.graphile.org/sponsor/) ❤️
- [ ] have an active [support or consultancy contract](https://www.graphile.org/support/) with Graphile

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.