Title: Profiler: 4 of 9 interface methods have no call sites (v25.0 / master) · Issue #4366 · graphql-java/graphql-java · GitHub
Open Graph Title: Profiler: 4 of 9 interface methods have no call sites (v25.0 / master) · Issue #4366 · graphql-java/graphql-java
X Title: Profiler: 4 of 9 interface methods have no call sites (v25.0 / master) · Issue #4366 · graphql-java/graphql-java
Description: Describe the bug The Profiler interface declares 9 methods. In graphql-java-25.0 and on master as of today, 4 of them have zero call sites anywhere in the graphql-java codebase: Profiler.dataLoaderUsed(String) (line) Profiler.batchLoaded...
Open Graph Description: Describe the bug The Profiler interface declares 9 methods. In graphql-java-25.0 and on master as of today, 4 of them have zero call sites anywhere in the graphql-java codebase: Profiler.dataLoader...
X Description: Describe the bug The Profiler interface declares 9 methods. In graphql-java-25.0 and on master as of today, 4 of them have zero call sites anywhere in the graphql-java codebase: Profiler.dataLoader...
Opengraph URL: https://github.com/graphql-java/graphql-java/issues/4366
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Profiler: 4 of 9 interface methods have no call sites (v25.0 / master)","articleBody":"**Describe the bug**\nThe Profiler interface declares 9 methods. In graphql-java-25.0 and on master as of today, 4 of them have zero call sites anywhere in the graphql-java codebase: \n\n- `Profiler.dataLoaderUsed(String)` ([line](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/Profiler.java#L26))\n- `Profiler.batchLoadedOldStrategy(String, int, int)` ([line](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/Profiler.java#L47))\n- `Profiler.batchLoadedNewStrategy(String, Integer, int, boolean, boolean)` ([line](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/Profiler.java#L52))\n- `Profiler.manualDispatch(String, int, int)` ([line](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/Profiler.java#L56))\n\nThat results in Profiler not collecting data relevant to dataloaders usage and `ProfilerResult.getDataLoaderLoadInvocations` and `ProfilerResult.getDispatchEvents` always return empty result. \n\n**To Reproduce**\n\n```\n// Compile \u0026 run with graphql-java 25.0 and java-dataloader 6.0.0 on the classpath.\n// Expected output:\n// dataLoaderChainingEnabled=true\n// dataLoaderLoadInvocations={} \u003c-- BUG: empty (Profiler.dataLoaderUsed never called)\n// dispatchEvents=[] \u003c-- BUG: empty (batchLoadedNewStrategy/batchLoadedOldStrategy/manualDispatch never called)\n// oldStrategyDispatchingAll=[...] \u003c-- non-empty only if chaining=false (the one wired DataLoader-related event)\n// fieldsFetched=[/users, /users[*]/name] \u003c-- this works; demonstrates the Profiler is hooked up\n\nimport graphql.ExecutionInput;\nimport graphql.ExecutionResult;\nimport graphql.GraphQL;\nimport graphql.ProfilerResult;\nimport graphql.execution.instrumentation.dataloader.DataLoaderDispatchingContextKeys;\nimport graphql.schema.GraphQLSchema;\nimport graphql.schema.idl.RuntimeWiring;\nimport graphql.schema.idl.SchemaGenerator;\nimport graphql.schema.idl.SchemaParser;\nimport graphql.schema.idl.TypeDefinitionRegistry;\nimport org.dataloader.BatchLoader;\nimport org.dataloader.DataLoader;\nimport org.dataloader.DataLoaderFactory;\nimport org.dataloader.DataLoaderRegistry;\n\nimport java.util.List;\nimport java.util.concurrent.CompletableFuture;\n\npublic final class ProfilerUnwiredReproducer {\n\n private static final String SDL = \"\"\"\n type Query { users: [User!]! }\n type User { id: ID!, name: String! }\n \"\"\";\n\n public static void main(String[] args) {\n final boolean chaining = args.length == 0 || !args[0].equals(\"--no-chaining\");\n\n // 1. Schema with one DataLoader-backed field.\n final BatchLoader\u003cString, String\u003e nameLoader =\n keys -\u003e CompletableFuture.completedFuture(keys.stream().map(k -\u003e \"name-\" + k).toList());\n\n final RuntimeWiring wiring = RuntimeWiring.newRuntimeWiring()\n .type(\"Query\", t -\u003e t.dataFetcher(\"users\",\n env -\u003e List.of(new User(\"1\"), new User(\"2\"), new User(\"3\"))))\n .type(\"User\", t -\u003e t.dataFetcher(\"name\",\n env -\u003e env.\u003cDataLoader\u003cString, String\u003e\u003egetDataLoader(\"nameLoader\")\n .load(((User) env.getSource()).id)))\n .build();\n\n final TypeDefinitionRegistry tdr = new SchemaParser().parse(SDL);\n final GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(tdr, wiring);\n final GraphQL graphQL = GraphQL.newGraphQL(schema).build();\n\n // 2. ExecutionInput with profileExecution(true) + chaining flag.\n final DataLoaderRegistry registry = new DataLoaderRegistry();\n registry.register(\"nameLoader\", DataLoaderFactory.newDataLoader(nameLoader));\n\n final ExecutionInput input = ExecutionInput.newExecutionInput()\n .query(\"{ users { id name } }\")\n .dataLoaderRegistry(registry)\n .profileExecution(true)\n .graphQLContext(b -\u003e b.put(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_CHAINING, chaining))\n .build();\n\n // 3. Execute and read the ProfilerResult.\n final ExecutionResult result = graphQL.execute(input);\n if (!result.getErrors().isEmpty()) {\n System.err.println(\"Query errors: \" + result.getErrors());\n System.exit(1);\n }\n final ProfilerResult profile = input.getGraphQLContext().get(ProfilerResult.PROFILER_CONTEXT_KEY);\n if (profile == null) {\n System.err.println(\"ProfilerResult is null — profileExecution(true) was not honored\");\n System.exit(2);\n }\n\n // 4. Print the four collections that demonstrate the bug.\n System.out.println(\"dataLoaderChainingEnabled = \" + profile.isDataLoaderChainingEnabled());\n System.out.println(\"fieldsFetched = \" + profile.getFieldsFetched()); // populated (fieldFetched is wired)\n System.out.println(\"oldStrategyDispatchingAll = \" + profile.getOldStrategyDispatchingAll());// populated only when chaining=false\n System.out.println(\"dataLoaderLoadInvocations = \" + profile.getDataLoaderLoadInvocations());// EMPTY: dataLoaderUsed has 0 call sites\n System.out.println(\"dispatchEvents = \" + profile.getDispatchEvents()); // EMPTY: batchLoadedOld/NewStrategy + manualDispatch all have 0 call sites\n }\n\n private record User(String id) {}\n}\n```","author":{"url":"https://github.com/Apelsinka223","@type":"Person","name":"Apelsinka223"},"datePublished":"2026-04-29T11:02:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/4366/graphql-java/issues/4366"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e84bc491-4725-e29a-660e-8d6deafa9a87 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9604:1C41B3:913D3F:CD2628:6A62502C |
| html-safe-nonce | 14ffd8d68e0d9d97892f9dab7c98d3a0ab93c743725718e8d9199e525272a25a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjA0OjFDNDFCMzo5MTNEM0Y6Q0QyNjI4OjZBNjI1MDJDIiwidmlzaXRvcl9pZCI6IjQ3MDI0OTE0NjMyMDgzNDYwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ef5a5cc807fa26475063d04ec96bfc7a28330f454a82f118ac38378f3602b285 |
| hovercard-subject-tag | issue:4349966925 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/graphql-java/graphql-java/4366/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e9d0b279c917900903121e922d6b6a1ef06fa214fd654cdf49c6ab8c6c02fb45/graphql-java/graphql-java/issues/4366 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e9d0b279c917900903121e922d6b6a1ef06fa214fd654cdf49c6ab8c6c02fb45/graphql-java/graphql-java/issues/4366 |
| og:image:alt | Describe the bug The Profiler interface declares 9 methods. In graphql-java-25.0 and on master as of today, 4 of them have zero call sites anywhere in the graphql-java codebase: Profiler.dataLoader... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Apelsinka223 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 77f5af7d0fa3843b1779a53f60ec016b3f962e46051fb05c2e9b608a8138eefb |
| turbo-cache-control | no-preview |
| go-import | github.com/graphql-java/graphql-java git https://github.com/graphql-java/graphql-java.git |
| octolytics-dimension-user_id | 14289921 |
| octolytics-dimension-user_login | graphql-java |
| octolytics-dimension-repository_id | 38602457 |
| octolytics-dimension-repository_nwo | graphql-java/graphql-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38602457 |
| octolytics-dimension-repository_network_root_nwo | graphql-java/graphql-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d3ce7d369aae307e197872f810f80f3ed9051c78 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width