feat(graphene): Gate GraphQL data collection behind data_collection option#6886
feat(graphene): Gate GraphQL data collection behind data_collection option#6886ericapisani wants to merge 1 commit into
Conversation
…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.
Codecov Results 📊✅ 97510 passed | ⏭️ 6410 skipped | Total: 103920 | Pass Rate: 93.83% | Execution Time: 354m 55s 📊 Comparison with Base Branch
➖ Removed Tests (1)View removed tests
All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 2512 uncovered lines. 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 +2Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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"] |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 9562fff. Configure here.


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