Skip to content

Commit 88aea39

Browse files
authored
feat(data-collection): add queues option to data collection config (#6770)
Add a `queues` boolean to the data collection spec, gated by send_default_pii like other PII-bearing fields. Depends on getsentry/sentry-docs#18637 and the outcome of discussions there. Fixes PY-2679 Fixes #6739 --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
1 parent 9f3c89a commit 88aea39

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

sentry_sdk/_types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ class DataCollectionUserOptions(TypedDict, total=False):
193193
graphql: "GraphQLCollectionUserOptions"
194194
gen_ai: "GenAICollectionUserOptions"
195195
database: "DatabaseCollectionUserOptions"
196+
queues: bool
196197
stack_frame_variables: bool
197198
frame_context_lines: int
198199

@@ -206,6 +207,7 @@ class DataCollection(TypedDict):
206207
graphql: "GraphQLCollectionBehaviour"
207208
gen_ai: "GenAICollectionBehaviour"
208209
database: "DatabaseCollectionBehaviour"
210+
queues: bool
209211
stack_frame_variables: bool
210212
frame_context_lines: int
211213

sentry_sdk/data_collection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def _map_from_send_default_pii(
108108
"graphql": {"document": send_default_pii, "variables": send_default_pii},
109109
"gen_ai": {"inputs": send_default_pii, "outputs": send_default_pii},
110110
"database": {"query_params": send_default_pii},
111+
"queues": send_default_pii,
111112
"stack_frame_variables": include_local_variables,
112113
"frame_context_lines": (
113114
_DEFAULT_FRAME_CONTEXT_LINES if include_source_context else 0
@@ -157,6 +158,7 @@ def _resolve_explicit(
157158
"graphql": _graphql_from_value(d.get("graphql") or {}),
158159
"gen_ai": _gen_ai_from_value(d.get("gen_ai") or {}),
159160
"database": _database_from_value(d.get("database") or {}),
161+
"queues": d.get("queues", True),
160162
"stack_frame_variables": stack_frame_variables,
161163
"frame_context_lines": frame_context_lines,
162164
}

tests/test_data_collection.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def _get(dc, path):
8585
"query_params.mode": "off",
8686
"http_headers.request.mode": "denylist",
8787
"http_bodies": _ALL_HTTP_BODY_TYPES,
88+
"queues": False,
8889
"frame_context_lines": 5,
8990
},
9091
id="no_options_collects_no_pii",
@@ -97,12 +98,13 @@ def _get(dc, path):
9798
"gen_ai.outputs": True,
9899
"cookies.mode": "denylist",
99100
"query_params.mode": "denylist",
101+
"queues": True,
100102
},
101103
id="send_default_pii_true_collects_pii",
102104
),
103105
pytest.param(
104106
{"send_default_pii": False},
105-
{"user_info": False, "cookies.mode": "off"},
107+
{"user_info": False, "cookies.mode": "off", "queues": False},
106108
id="send_default_pii_false_collects_no_pii",
107109
),
108110
pytest.param(
@@ -114,6 +116,7 @@ def _get(dc, path):
114116
"cookies.mode": "denylist",
115117
"query_params.mode": "denylist",
116118
"http_bodies": _ALL_HTTP_BODY_TYPES,
119+
"queues": True,
117120
},
118121
id="explicit_data_collection_uses_spec_defaults",
119122
),
@@ -193,17 +196,19 @@ def _get(dc, path):
193196
"graphql.document": False,
194197
"graphql.variables": False,
195198
"database.query_params": False,
199+
"queues": False,
196200
},
197-
id="legacy_pii_off_gates_graphql_and_database",
201+
id="legacy_pii_off_gates_graphql_database_and_queues",
198202
),
199203
pytest.param(
200204
{"send_default_pii": True},
201205
{
202206
"graphql.document": True,
203207
"graphql.variables": True,
204208
"database.query_params": True,
209+
"queues": True,
205210
},
206-
id="legacy_pii_on_collects_graphql_and_database",
211+
id="legacy_pii_on_collects_graphql_database_and_queues",
207212
),
208213
pytest.param(
209214
{"data_collection": {"graphql": {"variables": False}}},

0 commit comments

Comments
 (0)