Skip to content

Expose the response path in field-fetch instrumentation - #4573

Open
joshgord wants to merge 1 commit into
graphql-java:masterfrom
joshgord:field-fetch-instrumentation-path
Open

joshgord wants to merge 1 commit into
graphql-java:masterfrom
joshgord:field-fetch-instrumentation-path

Conversation

@joshgord

@joshgord joshgord commented Dec 4, 2026 •

Copy link
Copy Markdown

At Netflix, we use instrumentDataFetcher to attach local context at top-level fields so nested resolvers can read it. The hook runs for every field. Today it calls getExecutionStepInfo() to identify top-level fields, which builds the lazy DataFetchingEnvironment even for nested fetchers that only need their source object.

We’ll use parameters.getPath().getLevel() == 1 to identify top-level fields and return the original fetcher for nested fields. The execution strategy already has the response path, so a nested property fetcher can skip building the environment when no other hook needs it.

The accessor exposes a value the execution strategy already stores, so a hook can make root/nested decisions without triggering the lazy environment. In Netflix's full instrumentation chain (this change plus the companion DGS guard), paired replays of the production-shaped query mix on the production JDK measured ~3.5% lower allocated bytes per completed response and lower CPU per response; with either half missing, the environment is still built and the savings vanish.

The companion DGS change skips the resolver tag lookup when timers are disabled, removing another eager read of the execution step. Netflix/dgs-framework#2388

Generated by Josh-Bot 9000

Reuse the response path already held by the execution strategy so instrumentation can read it without initializing the lazy data fetching environment.

Generated by Josh-Bot 9000
@joshgord
joshgord force-pushed the field-fetch-instrumentation-path branch from 195b79b to 589bd27 Compare December 4, 2026 23:20
@joshgord
joshgord marked this pull request as ready for review December 4, 2026 23:21

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant