|
11 | 11 | from sentry_sdk.integrations import Integration |
12 | 12 | from sentry_sdk.integrations._wsgi_common import _filter_headers |
13 | 13 | from sentry_sdk.integrations.cloud_resource_context import CLOUD_PROVIDER |
14 | | -from sentry_sdk.scope import Scope, should_send_default_pii |
| 14 | +from sentry_sdk.scope import Scope |
15 | 15 | from sentry_sdk.traces import SegmentNameSource |
16 | 16 | from sentry_sdk.utils import ( |
17 | 17 | AnnotatedValue, |
18 | 18 | TimeoutThread, |
19 | 19 | capture_internal_exceptions, |
20 | 20 | event_from_exception, |
21 | | - has_data_collection_enabled, |
22 | 21 | logger, |
23 | 22 | reraise, |
24 | 23 | ) |
@@ -98,17 +97,12 @@ def sentry_func( |
98 | 97 | if hasattr(gcp_event, "query_string"): |
99 | 98 | query_string = gcp_event.query_string.decode("utf-8", errors="replace") |
100 | 99 | if query_string: |
101 | | - if has_data_collection_enabled(client.options): |
102 | | - filtered_qs = _apply_data_collection_filtering_to_query_string( |
103 | | - query_string=query_string, |
104 | | - behaviour=client.options["data_collection"][ |
105 | | - "url_query_params" |
106 | | - ], |
107 | | - ) |
108 | | - if filtered_qs: |
109 | | - additional_attributes["url.query"] = filtered_qs |
110 | | - elif should_send_default_pii(): |
111 | | - additional_attributes["url.query"] = query_string |
| 100 | + filtered_qs = _apply_data_collection_filtering_to_query_string( |
| 101 | + query_string=query_string, |
| 102 | + behaviour=client.options["data_collection"]["url_query_params"], |
| 103 | + ) |
| 104 | + if filtered_qs: |
| 105 | + additional_attributes["url.query"] = filtered_qs |
112 | 106 |
|
113 | 107 | sampling_context = { |
114 | 108 | "gcp_env": { |
@@ -229,28 +223,19 @@ def event_processor(event: "Event", hint: "Hint") -> "Optional[Event]": |
229 | 223 |
|
230 | 224 | if hasattr(gcp_event, "query_string"): |
231 | 225 | query_string = gcp_event.query_string.decode("utf-8", errors="replace") |
232 | | - if has_data_collection_enabled(client_options): |
233 | | - if query_string: |
234 | | - filtered_qs = _apply_data_collection_filtering_to_query_string( |
235 | | - query_string=query_string, |
236 | | - behaviour=client_options["data_collection"]["url_query_params"], |
237 | | - ) |
238 | | - if filtered_qs: |
239 | | - request["query_string"] = filtered_qs |
240 | | - else: |
241 | | - request["query_string"] = query_string |
| 226 | + if query_string: |
| 227 | + filtered_qs = _apply_data_collection_filtering_to_query_string( |
| 228 | + query_string=query_string, |
| 229 | + behaviour=client_options["data_collection"]["url_query_params"], |
| 230 | + ) |
| 231 | + if filtered_qs: |
| 232 | + request["query_string"] = filtered_qs |
242 | 233 |
|
243 | 234 | if hasattr(gcp_event, "headers"): |
244 | 235 | request["headers"] = _filter_headers(gcp_event.headers) |
245 | 236 |
|
246 | 237 | if hasattr(gcp_event, "data"): |
247 | | - if has_data_collection_enabled(client_options): |
248 | | - if ( |
249 | | - "incoming_request" |
250 | | - in client_options["data_collection"]["http_bodies"] |
251 | | - ): |
252 | | - request["data"] = gcp_event.data |
253 | | - elif should_send_default_pii(): |
| 238 | + if "incoming_request" in client_options["data_collection"]["http_bodies"]: |
254 | 239 | request["data"] = gcp_event.data |
255 | 240 | else: |
256 | 241 | # Unfortunately couldn't find a way to get structured body from GCP |
|
0 commit comments