Add Optional Server-Timing Headers to the HTTP Response
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:
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 ❤️
- [ ] have an active support or consultancy contract with Graphile
This could be added post v5.0.0 if needed.