diff --git a/sentry_sdk/_types.py b/sentry_sdk/_types.py index 6eae252e2d..fbd2578048 100644 --- a/sentry_sdk/_types.py +++ b/sentry_sdk/_types.py @@ -172,12 +172,6 @@ class GraphQLCollectionBehaviour(TypedDict): document: bool variables: bool - class DatabaseCollectionUserOptions(TypedDict, total=False): - query_params: bool - - class DatabaseCollectionBehaviour(TypedDict): - query_params: bool - class HttpHeadersCollectionUserOptions(TypedDict, total=False): request: "KeyValueCollectionBehaviour" @@ -192,7 +186,7 @@ class DataCollectionUserOptions(TypedDict, total=False): query_params: "KeyValueCollectionBehaviour" graphql: "GraphQLCollectionUserOptions" gen_ai: "GenAICollectionUserOptions" - database: "DatabaseCollectionUserOptions" + database_query_data: bool queues: bool stack_frame_variables: bool frame_context_lines: int @@ -206,7 +200,7 @@ class DataCollection(TypedDict): query_params: "KeyValueCollectionBehaviour" graphql: "GraphQLCollectionBehaviour" gen_ai: "GenAICollectionBehaviour" - database: "DatabaseCollectionBehaviour" + database_query_data: bool 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 9476da4b46..e742f3c209 100644 --- a/sentry_sdk/data_collection.py +++ b/sentry_sdk/data_collection.py @@ -29,7 +29,6 @@ from typing import Any, Dict, Literal from sentry_sdk._types import ( - DatabaseCollectionBehaviour, DataCollection, GenAICollectionBehaviour, GraphQLCollectionBehaviour, @@ -107,7 +106,7 @@ def _map_from_send_default_pii( "query_params": {"mode": kv_mode, "terms": terms}, "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}, + "database_query_data": send_default_pii, "queues": send_default_pii, "stack_frame_variables": include_local_variables, "frame_context_lines": ( @@ -157,7 +156,7 @@ def _resolve_explicit( "query_params": _kvcb_from_value(d.get("query_params") or {}), "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 {}), + "database_query_data": d.get("database_query_data", True), "queues": d.get("queues", True), "stack_frame_variables": stack_frame_variables, "frame_context_lines": frame_context_lines, @@ -211,12 +210,6 @@ def _graphql_from_value( } -def _database_from_value( - val: "dict[str, Any]", -) -> "DatabaseCollectionBehaviour": - return {"query_params": val.get("query_params", True)} - - def _resolve_data_collection(options: "Dict[str, Any]") -> "DataCollection": """ Resolve the effective ``DataCollection`` dict from client ``options``. diff --git a/tests/test_data_collection.py b/tests/test_data_collection.py index 7586b2960e..fcec0c0e99 100644 --- a/tests/test_data_collection.py +++ b/tests/test_data_collection.py @@ -166,7 +166,6 @@ def _get(dc, path): "query_params": None, "graphql": None, "gen_ai": None, - "database": None, } }, { @@ -177,7 +176,6 @@ def _get(dc, path): "graphql.variables": True, "gen_ai.inputs": True, "gen_ai.outputs": True, - "database.query_params": True, }, id="none_values_fall_back_to_spec_defaults", ), @@ -186,7 +184,7 @@ def _get(dc, path): { "graphql.document": True, "graphql.variables": True, - "database.query_params": True, + "database_query_data": True, }, id="explicit_graphql_database_defaults", ), @@ -195,7 +193,7 @@ def _get(dc, path): { "graphql.document": False, "graphql.variables": False, - "database.query_params": False, + "database_query_data": False, "queues": False, }, id="legacy_pii_off_gates_graphql_database_and_queues", @@ -205,7 +203,7 @@ def _get(dc, path): { "graphql.document": True, "graphql.variables": True, - "database.query_params": True, + "database_query_data": True, "queues": True, }, id="legacy_pii_on_collects_graphql_database_and_queues",