From 5cc008cb00d877dc84303f71767d65d622329bbe Mon Sep 17 00:00:00 2001 From: Erica Pisani Date: Tue, 7 Jul 2026 15:11:15 -0400 Subject: [PATCH 1/2] feat(data-collection): add queues option to data collection config Add a `queues` boolean to the data collection spec, gated by send_default_pii like other PII-bearing fields. Depends on https://github.com/getsentry/sentry-docs/pull/18637 and the outcome of discussions there. Fixes PY-2679 Fixes #6739 --- sentry_sdk/_types.py | 2 ++ sentry_sdk/data_collection.py | 2 ++ tests/test_data_collection.py | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/sentry_sdk/_types.py b/sentry_sdk/_types.py index 5add9eaa4b..6eae252e2d 100644 --- a/sentry_sdk/_types.py +++ b/sentry_sdk/_types.py @@ -193,6 +193,7 @@ class DataCollectionUserOptions(TypedDict, total=False): graphql: "GraphQLCollectionUserOptions" gen_ai: "GenAICollectionUserOptions" database: "DatabaseCollectionUserOptions" + queues: bool stack_frame_variables: bool frame_context_lines: int @@ -206,6 +207,7 @@ class DataCollection(TypedDict): graphql: "GraphQLCollectionBehaviour" gen_ai: "GenAICollectionBehaviour" database: "DatabaseCollectionBehaviour" + queues: bool stack_frame_variables: bool frame_context_lines: int diff --git a/sentry_sdk/data_collection.py b/sentry_sdk/data_collection.py index ff50325fa7..9476da4b46 100644 --- a/sentry_sdk/data_collection.py +++ b/sentry_sdk/data_collection.py @@ -108,6 +108,7 @@ def _map_from_send_default_pii( "graphql": {"document": send_default_pii, "variables": send_default_pii}, "gen_ai": {"inputs": send_default_pii, "outputs": send_default_pii}, "database": {"query_params": send_default_pii}, + "queues": send_default_pii, "stack_frame_variables": include_local_variables, "frame_context_lines": ( _DEFAULT_FRAME_CONTEXT_LINES if include_source_context else 0 @@ -157,6 +158,7 @@ def _resolve_explicit( "graphql": _graphql_from_value(d.get("graphql") or {}), "gen_ai": _gen_ai_from_value(d.get("gen_ai") or {}), "database": _database_from_value(d.get("database") or {}), + "queues": d.get("queues", True), "stack_frame_variables": stack_frame_variables, "frame_context_lines": frame_context_lines, } diff --git a/tests/test_data_collection.py b/tests/test_data_collection.py index 8bbff0ff5d..4aa17e71a4 100644 --- a/tests/test_data_collection.py +++ b/tests/test_data_collection.py @@ -85,6 +85,7 @@ def _get(dc, path): "query_params.mode": "off", "http_headers.request.mode": "denylist", "http_bodies": _ALL_HTTP_BODY_TYPES, + "queues": False, "frame_context_lines": 5, }, id="no_options_collects_no_pii", @@ -97,12 +98,13 @@ def _get(dc, path): "gen_ai.outputs": True, "cookies.mode": "denylist", "query_params.mode": "denylist", + "queues": True, }, id="send_default_pii_true_collects_pii", ), pytest.param( {"send_default_pii": False}, - {"user_info": False, "cookies.mode": "off"}, + {"user_info": False, "cookies.mode": "off", "queues": False}, id="send_default_pii_false_collects_no_pii", ), pytest.param( @@ -114,6 +116,7 @@ def _get(dc, path): "cookies.mode": "denylist", "query_params.mode": "denylist", "http_bodies": _ALL_HTTP_BODY_TYPES, + "queues": True, }, id="explicit_data_collection_uses_spec_defaults", ), @@ -193,8 +196,9 @@ def _get(dc, path): "graphql.document": False, "graphql.variables": False, "database.query_params": False, + "queues": False, }, - id="legacy_pii_off_gates_graphql_and_database", + id="legacy_pii_off_gates_graphql_database_and_queues", ), pytest.param( {"send_default_pii": True}, @@ -202,14 +206,20 @@ def _get(dc, path): "graphql.document": True, "graphql.variables": True, "database.query_params": True, + "queues": True, }, - id="legacy_pii_on_collects_graphql_and_database", + id="legacy_pii_on_collects_graphql_database_and_queues", ), pytest.param( {"data_collection": {"graphql": {"variables": False}}}, {"graphql.document": True, "graphql.variables": False}, id="explicit_partial_graphql_fills_omitted", ), + pytest.param( + {"data_collection": {"queues": False}}, + {"queues": False}, + id="explicit_queues_override", + ), pytest.param( {"data_collection": {"frame_context_lines": True}}, {"frame_context_lines": 5}, From 4696edca8a0575feadcba38ce139e05b3b68662d Mon Sep 17 00:00:00 2001 From: Erica Pisani Date: Tue, 7 Jul 2026 15:34:26 -0400 Subject: [PATCH 2/2] remove unnecessary test --- tests/test_data_collection.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/test_data_collection.py b/tests/test_data_collection.py index 4aa17e71a4..7586b2960e 100644 --- a/tests/test_data_collection.py +++ b/tests/test_data_collection.py @@ -215,11 +215,6 @@ def _get(dc, path): {"graphql.document": True, "graphql.variables": False}, id="explicit_partial_graphql_fills_omitted", ), - pytest.param( - {"data_collection": {"queues": False}}, - {"queues": False}, - id="explicit_queues_override", - ), pytest.param( {"data_collection": {"frame_context_lines": True}}, {"frame_context_lines": 5},