apollographql / apollographql/federation

[Feature Request] executeQueryPlan Hooks

Open
#434 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
727
Forks
276
Avg merge
1h 47m
Merged PRs (30d)
1

Description

# Feature Request:

We would like to add four hooks in Apollo Gateway:

- `willExecuteQueryPlan`
- `didExecuteQueryPlan`
- `willExecuteRootQueryPlanNode`
- `didExecuteRootQueryPlanNode`

## Request Summary:

We would like to measure the overall query plan execution time as well as the time it takes to make all required requests. Having these hooks will allow us to add timer/spans around these operations to better understand Gateway overhead.

## Investigation:

All four hooks can be passed as gateway config, the same way [other experimental callbacks are passed](https://github.com/apollographql/federation/blob/main/gateway-js/src/index.ts#L69). The first two hooks can wrap `executeQueryPlan` [here](https://github.com/apollographql/federation/blob/main/gateway-js/src/index.ts#L819). As for the root query plan node hooks, they can be passed as an argument for executeQueryPlan, and then wrap the initial `executeNode` call [here](https://github.com/apollographql/federation/blob/main/gateway-js/src/executeQueryPlan.ts#L66).

Contributor guide

Open the contributing guide

Research direction

Start with gateway-js/src/index.ts, including the gateway configuration near line 69 and executeQueryPlan near line 819, then read gateway-js/src/executeQueryPlan.ts around line 66. Define and wire the four requested hooks so they can measure query-plan and root-node execution, and verify the behavior with relevant tests in those areas.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.