Skip to content

feat(core): Add and use dataCollection.graphQL#22221

Open
s1gr1d wants to merge 1 commit into
developfrom
sig/add-dataCollection-graphQL
Open

feat(core): Add and use dataCollection.graphQL#22221
s1gr1d wants to merge 1 commit into
developfrom
sig/add-dataCollection-graphQL

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Jul 13, 2026

Copy link
Copy Markdown
Member

Sets the default collection behavior to true as it has been collected already.

@s1gr1d s1gr1d requested review from a team as code owners July 13, 2026 10:50
@s1gr1d s1gr1d requested review from Lms24, andreiborza, chargome, isaacs, logaretm, mydea and nicohrubec and removed request for a team July 13, 2026 10:50
Comment on lines +59 to +62
graphQL?: {
document?: boolean;
variables?: boolean;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The graphQL.variables configuration option is defined but never used, making the feature to control GraphQL variable collection non-functional.
Severity: HIGH

Suggested Fix

Implement the logic to read the getDataCollectionOptions().graphQL.variables setting. Based on its value, conditionally collect or suppress the variables field from GraphQL requests. This logic should be added where GraphQL bodies are processed, such as in packages/browser/src/integrations/graphqlClient.ts and packages/server-utils/src/graphql/utils.ts.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/core/src/types/datacollection.ts#L59-L62

Potential issue: The `graphQL.variables` configuration option is defined and documented,
but its value is never read in the production codebase. No code checks
`getDataCollectionOptions().graphQL.variables` before collecting GraphQL variables.
Since no variable collection code exists, the setting has no effect. Users who set
`graphQL: { variables: false }` believing they are suppressing variable collection are
not actually having variables collected (as the feature is missing), and users who set
`variables: true` believing variables will be captured find they are not. The API
contract is unfulfilled as the implementation is missing.

Did we get this right? 👍 / 👎 to inform future reviews.

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.64 kB +0.15% +40 B 🔺
@sentry/browser - with treeshaking flags 26.09 kB +0.19% +47 B 🔺
@sentry/browser (incl. Tracing) 46.41 kB +0.13% +56 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.19 kB +0.11% +52 B 🔺
@sentry/browser (incl. Tracing, Profiling) 51.19 kB +0.11% +52 B 🔺
@sentry/browser (incl. Tracing, Replay) 85.66 kB +0.05% +40 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.3 kB +0.06% +44 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 90.38 kB +0.05% +41 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 103.03 kB +0.04% +41 B 🔺
@sentry/browser (incl. Feedback) 44.83 kB +0.11% +45 B 🔺
@sentry/browser (incl. sendFeedback) 32.44 kB +0.14% +44 B 🔺
@sentry/browser (incl. FeedbackAsync) 37.57 kB +0.12% +44 B 🔺
@sentry/browser (incl. Metrics) 28.73 kB +0.18% +50 B 🔺
@sentry/browser (incl. Logs) 28.97 kB +0.14% +40 B 🔺
@sentry/browser (incl. Metrics & Logs) 29.66 kB +0.16% +46 B 🔺
@sentry/react 29.44 kB +0.18% +50 B 🔺
@sentry/react (incl. Tracing) 48.67 kB +0.11% +50 B 🔺
@sentry/vue 33.07 kB +0.14% +44 B 🔺
@sentry/vue (incl. Tracing) 48.39 kB +0.12% +57 B 🔺
@sentry/svelte 27.66 kB +0.15% +40 B 🔺
CDN Bundle 30.05 kB +0.16% +46 B 🔺
CDN Bundle (incl. Tracing) 48.39 kB +0.13% +60 B 🔺
CDN Bundle (incl. Logs, Metrics) 31.63 kB +0.16% +48 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.7 kB +0.11% +53 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 70.86 kB +0.07% +43 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.89 kB +0.07% +56 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.21 kB +0.06% +49 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.69 kB +0.06% +49 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.96 kB +0.05% +46 B 🔺
CDN Bundle - uncompressed 89.54 kB +0.25% +216 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 146.29 kB +0.15% +216 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.25 kB +0.23% +216 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.26 kB +0.15% +216 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.97 kB +0.1% +216 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.49 kB +0.09% +216 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.45 kB +0.09% +216 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.19 kB +0.08% +216 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.14 kB +0.08% +216 B 🔺
@sentry/nextjs (client) 51.21 kB +0.09% +46 B 🔺
@sentry/sveltekit (client) 46.86 kB +0.13% +58 B 🔺
@sentry/core/server 78.47 kB +0.07% +53 B 🔺
@sentry/core/browser 64.82 kB +0.08% +50 B 🔺
@sentry/node-core 62.79 kB +0.11% +65 B 🔺
@sentry/node 125.46 kB +0.09% +110 B 🔺
@sentry/node (incl. diagnostics channel injection) 139.75 kB +0.09% +113 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.96 kB - -
@sentry/node/light 50.8 kB +0.14% +68 B 🔺
@sentry/node - without tracing 74.11 kB +0.1% +71 B 🔺
@sentry/aws-serverless 83.33 kB +0.08% +66 B 🔺
@sentry/cloudflare (withSentry) - minified 181.69 kB +0.12% +216 B 🔺
@sentry/cloudflare (withSentry) 449.47 kB +0.11% +490 B 🔺

View base workflow run

Comment on lines +59 to +62
graphQL?: {
document?: boolean;
variables?: boolean;
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker but something I was discussing with @ericapisani, this creates the expectation that the SDK is going to apply these options to all GraphQL requests which is not accurate.

It would only apply if the user is using the client or the server GraphQL integrations. GraphQL requests outside of the integrations coverage won't be covered by these options which I find weird. I know the gen AI spans is already a precedent, so I don't have strong opinions here.

An alternative I considered is adding the dataCollection option to the integrations themselves rather than a top-level option.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core idea of the top-level option is to have only one place where all of this is defined in an on/off switch manner (like: this is allowed to be sent, but you also need the integration to be enabled). This makes it easier to see it all at once. According to the spec, it's also possible to add it on integration level, which would overwrite the option set on the root-level.

Maybe we should make this more clear in the JSDoc?

@logaretm logaretm Jul 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine, we already have a precedent for it with gen AI stuff so not feeling too strongly about it but it is something that I wanted to bring up is all.

Maybe adding a line or two in the JS doc to explain what "it won't do" will help here.

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.

2 participants