René's URL Explorer Experiment


Title: Add cheap field definition accessor to InstrumentationFieldFetchParameters by rhino88 · Pull Request #4544 · graphql-java/graphql-java · GitHub

Open Graph Title: Add cheap field definition accessor to InstrumentationFieldFetchParameters by rhino88 · Pull Request #4544 · graphql-java/graphql-java

X Title: Add cheap field definition accessor to InstrumentationFieldFetchParameters by rhino88 · Pull Request #4544 · graphql-java/graphql-java

Description: Problem InstrumentationFieldFetchParameters.getField() (inherited from InstrumentationFieldParameters) goes through the ExecutionStepInfo supplier, which is () -> environment.get().getExecutionStepInfo(). So asking for the field definition in beginFieldFetching materialises the full lazily built DataFetchingEnvironmentImpl plus its ExecutionStepInfo on every fetch. For trivial PropertyDataFetcher fetches (a LightDataFetcher that never builds the environment itself) the instrumentation becomes the only reason the environment is built at all. ExecutionStrategy.fetchField already has the GraphQLFieldDefinition resolved eagerly before the environment supplier is created, so this cost is avoidable. Motivating case: apollographql/federation-jvm#469 (see the "Possible follow-up in graphql-java" discussion) and apollographql/federation-jvm#470, whose isLeafField() check has to call parameters.getEnvironment().getFieldType() and notes this cost as unavoidable today. Change InstrumentationFieldParameters gains a @Nullable GraphQLFieldDefinition and a new constructor (ExecutionContext, @Nullable GraphQLFieldDefinition, Supplier). getField() returns the definition directly when it was supplied and otherwise falls back to the existing supplier path. The existing public constructor is unchanged and delegates with null. InstrumentationFieldFetchParameters gains the matching constructor (ExecutionContext, @Nullable GraphQLFieldDefinition, Supplier, ExecutionStrategyParameters, boolean), and passes the definition to super. getField() is inherited and now returns the eager definition; the getEnvironment() Javadoc points instrumentations that only need the field definition at getField() since it does not build the environment. The existing public constructor is unchanged and delegates with null. ExecutionStrategy passes the already resolved fieldDef at both construction sites (beginFieldExecution and beginFieldFetching). These were the only two construction sites in main or test code. SubscriptionExecutionStrategy and DeferredExecutionSupport still use the old constructor as they only hold a step info supplier there. getEnvironment() and getExecutionStepInfo() are untouched: they return the same objects and materialise at the same time as before. TracingInstrumentation is not changed in this PR; a follow-up could use getField() there. Before / after for getField() in beginFieldFetching Before After Objects built DataFetchingEnvironmentImpl, ExecutionStepInfo (via createExecutionStepInfo), argument/normalized field suppliers, DataFetchingFieldSelectionSetImpl, QueryDirectivesImpl none Supplier invoked yes (environment.get()) no Result executionStepInfo.get().getFieldDefinition() the GraphQLFieldDefinition fetchField already had So an instrumentation can now do GraphQLTypeUtil.isLeaf(parameters.getField().getType()) on every fetch for free, and only pay for the environment when it actually calls getEnvironment(). Tests New Spock spec InstrumentationFieldFetchParametersTest: getField() with a throwing environment Supplier returns the supplied definition and GraphQLTypeUtil.isLeaf works on it, proving the supplier is never invoked. Old constructor still falls back to the supplier (counted, called exactly once). Same no-invocation check for InstrumentationFieldParameters with a throwing ExecutionStepInfo supplier. End to end: a SimplePerformantInstrumentation reads parameters.getField() in beginFieldFetching against a real schema and sees the right leaf/non-leaf classification per field. ./gradlew test (JDK 25 toolchain): 6076 tests run in 290716 ms BUILD SUCCESSFUL in 5m 1s 6076 tests, 7 skipped, 0 failures, 0 errors. 🤖 Generated with Claude Code

Open Graph Description: Problem InstrumentationFieldFetchParameters.getField() (inherited from InstrumentationFieldParameters) goes through the ExecutionStepInfo supplier, which is () -> environment.get().getExecutionS...

X Description: Problem InstrumentationFieldFetchParameters.getField() (inherited from InstrumentationFieldParameters) goes through the ExecutionStepInfo supplier, which is () -> environment.get().getExecut...

Opengraph URL: https://github.com/graphql-java/graphql-java/pull/4544

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:aad530cd-9b48-7138-3783-957a3e12d723
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idAB04:27E5CD:271E2C5:320AE2E:6B018AE7
html-safe-noncecb6c53140f450e0cca58937bbafa757a3ef026eab1b9509bee408b13e8d23df1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQjA0OjI3RTVDRDoyNzFFMkM1OjMyMEFFMkU6NkIwMThBRTciLCJ2aXNpdG9yX2lkIjoiODA2ODI3NTI2MTk1Njc4NjkxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7aa8130e3c8f29e62d1ce7bdd420037dd6107f591bc974f732695e8e5a80028a
hovercard-subject-tagpull_request:5203807620
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/graphql-java/graphql-java/pull/4544/files
twitter:imagehttps://avatars.githubusercontent.com/u/1299507?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1299507?s=400&v=4
og:image:altProblem InstrumentationFieldFetchParameters.getField() (inherited from InstrumentationFieldParameters) goes through the ExecutionStepInfo supplier, which is () -> environment.get().getExecutionS...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/graphql-java/graphql-java git https://github.com/graphql-java/graphql-java.git
octolytics-dimension-user_id14289921
octolytics-dimension-user_logingraphql-java
octolytics-dimension-repository_id38602457
octolytics-dimension-repository_nwographql-java/graphql-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id38602457
octolytics-dimension-repository_network_root_nwographql-java/graphql-java
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/graphql-java/graphql-java/pull/4544/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fpull%2F4544%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fpull%2F4544%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=graphql-java%2Fgraphql-java
Reloadhttps://github.com/graphql-java/graphql-java/pull/4544/files
Reloadhttps://github.com/graphql-java/graphql-java/pull/4544/files
Reloadhttps://github.com/graphql-java/graphql-java/pull/4544/files
graphql-javahttps://github.com/graphql-java
graphql-javahttps://github.com/graphql-java/graphql-java
Codehttps://github.com/graphql-java/graphql-java
Issues27 (27)https://github.com/graphql-java/graphql-java/issues
Pull requests35 (35)https://github.com/graphql-java/graphql-java/pulls
Discussionshttps://github.com/graphql-java/graphql-java/discussions
Actionshttps://github.com/graphql-java/graphql-java/actions
Projectshttps://github.com/graphql-java/graphql-java/projects
Wikihttps://github.com/graphql-java/graphql-java/wiki
Security and qualityhttps://github.com/graphql-java/graphql-java/security
Insightshttps://github.com/graphql-java/graphql-java/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgraphql-java%2Fgraphql-java%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgraphql-java%2Fgraphql-java%2Fissues%2Fnew%2Fchoose
bbakermanhttps://github.com/bbakerman
graphql-java:masterhttps://github.com/graphql-java/graphql-java/tree/master
rhino88:cheap-field-definition-accessorhttps://github.com/rhino88/graphql-java/tree/cheap-field-definition-accessor
Conversation 1 https://github.com/graphql-java/graphql-java/pull/4544
Commits 7 https://github.com/graphql-java/graphql-java/pull/4544/commits
Checks 10 https://github.com/graphql-java/graphql-java/pull/4544/checks
Files changed https://github.com/graphql-java/graphql-java/pull/4544/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/4544/files
Add cheap field definition accessor to InstrumentationFieldFetchParameters https://github.com/graphql-java/graphql-java/pull/4544/files#top
Show all changes 7 commits https://github.com/graphql-java/graphql-java/pull/4544/files
b66c6e1 Add cheap field definition accessor to InstrumentationFieldFetchParam… rhino88 Nov 7, 2026 https://github.com/graphql-java/graphql-java/pull/4544/commits/b66c6e1a4c004ce2a4ef0cc95e216f745ef70ddc
6256fd3 Address review: drop pass-through getField override, tidy naming and … rhino88 Nov 7, 2026 https://github.com/graphql-java/graphql-java/pull/4544/commits/6256fd3aa9ad862dfa88204c143fb9d7c8b45213
9b997d4 Merge branch 'master' into cheap-field-definition-accessor rhino88 Nov 8, 2026 https://github.com/graphql-java/graphql-java/pull/4544/commits/9b997d4255108cfc7c58cf4338cc3807c724b101
42fd746 Assert the engine supplies the field definition; fix getField Javadoc rhino88 Nov 8, 2026 https://github.com/graphql-java/graphql-java/pull/4544/commits/42fd746884ede7c458c603c0ef9a9b06b03e7391
1c9d3e9 Merge remote-tracking branch 'origin/cheap-field-definition-accessor'… rhino88 Nov 8, 2026 https://github.com/graphql-java/graphql-java/pull/4544/commits/1c9d3e985502930e5ba8011f8d3315ba1d7a19d7
f1bc8d5 Merge branch 'master' into cheap-field-definition-accessor rhino88 Nov 17, 2026 https://github.com/graphql-java/graphql-java/pull/4544/commits/f1bc8d5fbc09e71d7d09ea44f4e06469f96f0c6a
aa8059f Cover the lazy ExecutionStepInfo supplier in beginFieldExecution rhino88 Nov 17, 2026 https://github.com/graphql-java/graphql-java/pull/4544/commits/aa8059f516025b2352557afdc42cd9041f94129d
Clear filters https://github.com/graphql-java/graphql-java/pull/4544/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/4544/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/4544/files
ExecutionStrategy.java https://github.com/graphql-java/graphql-java/pull/4544/files#diff-2ece51452808f5a3fd08db50de534a12806aa6cd4e236c549dff9759884e43ff
InstrumentationFieldFetchParameters.java https://github.com/graphql-java/graphql-java/pull/4544/files#diff-0d77f591674e8f5d935ebfecb851b8cfa3ae3d157b7d37ee6522e95fa4af747d
InstrumentationFieldParameters.java https://github.com/graphql-java/graphql-java/pull/4544/files#diff-d5157815948b0b2e0b3c5d549da05ac5a17d628e86bab1f0af024d8706a56890
InstrumentationFieldFetchParametersTest.groovy https://github.com/graphql-java/graphql-java/pull/4544/files#diff-74344f6714476ba2d6fa20448a205bd3644d15d617b88bb31f292cc920c4e021
src/main/java/graphql/execution/ExecutionStrategy.javahttps://github.com/graphql-java/graphql-java/pull/4544/files#diff-2ece51452808f5a3fd08db50de534a12806aa6cd4e236c549dff9759884e43ff
View file https://github.com/rhino88/graphql-java/blob/aa8059f516025b2352557afdc42cd9041f94129d/src/main/java/graphql/execution/ExecutionStrategy.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/graphql-java/pull/4544/{{ revealButtonHref }}
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-2ece51452808f5a3fd08db50de534a12806aa6cd4e236c549dff9759884e43ff
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-2ece51452808f5a3fd08db50de534a12806aa6cd4e236c549dff9759884e43ff
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-2ece51452808f5a3fd08db50de534a12806aa6cd4e236c549dff9759884e43ff
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-2ece51452808f5a3fd08db50de534a12806aa6cd4e236c549dff9759884e43ff
...ava/graphql/execution/instrumentation/parameters/InstrumentationFieldFetchParameters.javahttps://github.com/graphql-java/graphql-java/pull/4544/files#diff-0d77f591674e8f5d935ebfecb851b8cfa3ae3d157b7d37ee6522e95fa4af747d
View file https://github.com/rhino88/graphql-java/blob/aa8059f516025b2352557afdc42cd9041f94129d/src/main/java/graphql/execution/instrumentation/parameters/InstrumentationFieldFetchParameters.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/graphql-java/pull/4544/{{ revealButtonHref }}
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-0d77f591674e8f5d935ebfecb851b8cfa3ae3d157b7d37ee6522e95fa4af747d
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-0d77f591674e8f5d935ebfecb851b8cfa3ae3d157b7d37ee6522e95fa4af747d
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-0d77f591674e8f5d935ebfecb851b8cfa3ae3d157b7d37ee6522e95fa4af747d
...ain/java/graphql/execution/instrumentation/parameters/InstrumentationFieldParameters.javahttps://github.com/graphql-java/graphql-java/pull/4544/files#diff-d5157815948b0b2e0b3c5d549da05ac5a17d628e86bab1f0af024d8706a56890
View file https://github.com/rhino88/graphql-java/blob/aa8059f516025b2352557afdc42cd9041f94129d/src/main/java/graphql/execution/instrumentation/parameters/InstrumentationFieldParameters.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/graphql-java/pull/4544/{{ revealButtonHref }}
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-d5157815948b0b2e0b3c5d549da05ac5a17d628e86bab1f0af024d8706a56890
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-d5157815948b0b2e0b3c5d549da05ac5a17d628e86bab1f0af024d8706a56890
https://github.com/graphql-java/graphql-java/pull/4544/files#diff-d5157815948b0b2e0b3c5d549da05ac5a17d628e86bab1f0af024d8706a56890
...t/groovy/graphql/execution/instrumentation/InstrumentationFieldFetchParametersTest.groovyhttps://github.com/graphql-java/graphql-java/pull/4544/files#diff-74344f6714476ba2d6fa20448a205bd3644d15d617b88bb31f292cc920c4e021
View file https://github.com/rhino88/graphql-java/blob/aa8059f516025b2352557afdc42cd9041f94129d/src/test/groovy/graphql/execution/instrumentation/InstrumentationFieldFetchParametersTest.groovy
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/graphql-java/pull/4544/{{ revealButtonHref }}
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/4544/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.