Skip to content

feat(strawberry): Gate GraphQL data collection behind data_collection option#6887

Open
ericapisani wants to merge 1 commit into
py-2585-graphenefrom
py-2585-strawberry
Open

feat(strawberry): Gate GraphQL data collection behind data_collection option#6887
ericapisani wants to merge 1 commit into
py-2585-graphenefrom
py-2585-strawberry

Conversation

@ericapisani

@ericapisani ericapisani commented Jul 24, 2026

Copy link
Copy Markdown
Member

Apply the data_collection option to the Strawberry integration so that
graphql.document, request data, and variables are only collected when
explicitly enabled. send_default_pii is used as a fallback only when
data_collection is not configured.

GraphQL operation names are now always captured when available,
independent of document or PII settings. Tests are updated to assert the
new behavior.

Refs PY-2585
Refs #6745

… option

Apply the data_collection option to the Strawberry integration so that

graphql.document, request data, and variables are only collected when

explicitly enabled. send_default_pii is used as a fallback only when

data_collection is not configured.

GraphQL operation names are now always captured when available,

independent of document or PII settings.
@linear-code

linear-code Bot commented Jul 24, 2026

Copy link
Copy Markdown

PY-2585

@ericapisani
ericapisani changed the base branch from master to py-2585-graphene July 24, 2026 18:30
@ericapisani
ericapisani marked this pull request as ready for review July 24, 2026 18:30
@ericapisani
ericapisani requested a review from a team as a code owner July 24, 2026 18:30

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a6055cd. Configure here.

execution_context.operation_name
)

request_data["data"] = execution_context_data

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty request data written

Low Severity

When data_collection is enabled but document and variables are both off and there is no operationName, the event processor still assigns request.data to an empty dict. That adds empty request payload on events where nothing GraphQL-related was selected for collection.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a6055cd. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

97734 passed | ⏭️ 6410 skipped | Total: 104144 | Pass Rate: 93.85% | Execution Time: 343m 16s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +302
Passed Tests 📈 +303
Failed Tests 📉 -1
Skipped Tests

➖ Removed Tests (1)

View removed tests
  • test_circular_references_span_streaming
    • File: tests.tracing.test_misc

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2512 uncovered lines.
✅ Project coverage is 89.71%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/integrations/strawberry.py 100.00% ⚠️ 1 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.71%    89.71%        —%
==========================================
  Files          193       193         —
  Lines        24392     24422       +30
  Branches      8642      8672       +30
==========================================
+ Hits         21882     21910       +28
- Misses        2510      2512        +2
- Partials      1399      1402        +3

Generated by Codecov Action

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