Skip to content

feat(graphene): Gate GraphQL data collection behind data_collection option#6886

Open
ericapisani wants to merge 1 commit into
masterfrom
py-2585-graphene
Open

feat(graphene): Gate GraphQL data collection behind data_collection option#6886
ericapisani wants to merge 1 commit into
masterfrom
py-2585-graphene

Conversation

@ericapisani

@ericapisani ericapisani commented Jul 24, 2026

Copy link
Copy Markdown
Member

The graphene integration now honours the experimental structured data_collection configuration when deciding whether to attach GraphQL-specific data. When data_collection is set, graphql.document controls whether request.api_target is marked as graphql on error events and whether the graphql.document attribute is attached to query/mutation spans (both streamed and transaction-embedded). When data_collection is not configured, behavior falls back to the existing send_default_pii gating, and data_collection takes precedence when both options are set.

Adds tests covering the new gating for the event processor and both span paths, including precedence over send_default_pii.

Refs PY-2585
Refs PY-6745

…ption

The graphene integration now honors the experimental structured data_collection configuration when deciding whether to attach GraphQL-specific data. When data_collection is set, graphql.document controls whether request.api_target is marked as graphql on error events and whether the graphql.document attribute is attached to query/mutation spans (both streamed and transaction-embedded). When data_collection is not configured, behavior falls back to the existing send_default_pii gating, and data_collection takes precedence when both options are set.

Adds tests covering the new gating for the event processor and both span paths, including precedence over send_default_pii.
@linear-code

linear-code Bot commented Jul 24, 2026

Copy link
Copy Markdown

PY-2585

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

97510 passed | ⏭️ 6410 skipped | Total: 103920 | Pass Rate: 93.83% | Execution Time: 354m 55s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +78
Passed Tests 📈 +79
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).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.71%    89.71%        —%
==========================================
  Files          193       193         —
  Lines        24392     24404       +12
  Branches      8642      8654       +12
==========================================
+ Hits         21882     21892       +10
- Misses        2510      2512        +2
- Partials      1399      1401        +2

Generated by Codecov Action

@ericapisani
ericapisani marked this pull request as ready for review July 24, 2026 15:17
@ericapisani
ericapisani requested a review from a team as a code owner July 24, 2026 15:17

@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 9562fff. Configure here.

del event["request"]["data"]
else:
if event.get("request", {}).get("data"):
del event["request"]["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.

Request data not stripped when gated

High Severity

When data_collection is enabled and graphql.document is false, _event_processor skips setting api_target but no longer removes request.data. Flask and Starlette still attach the GraphQL body, so the document can still be sent on error events despite document collection being disabled.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9562fff. Configure 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.

1 participant