Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions sentry_sdk/integrations/graphene.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import sentry_sdk
from sentry_sdk.consts import OP
from sentry_sdk.integrations import DidNotEnable, Integration, _check_minimum_version
from sentry_sdk.scope import should_send_default_pii
from sentry_sdk.utils import (
capture_internal_exceptions,
ensure_integration_enabled,
event_from_exception,
has_data_collection_enabled,
parse_version,
)

Expand Down Expand Up @@ -112,13 +110,7 @@ async def _sentry_patched_graphql_async(
def _event_processor(event: "Event", hint: "Dict[str, Any]") -> "Event":
client_options = sentry_sdk.get_client().options

if has_data_collection_enabled(client_options):
if client_options["data_collection"]["graphql"]["document"]:
request_info = event.setdefault("request", {})
request_info["api_target"] = "graphql"
elif event.get("request", {}).get("data"):
del event["request"]["data"]
elif should_send_default_pii():
if client_options["data_collection"]["graphql"]["document"]:
request_info = event.setdefault("request", {})
request_info["api_target"] = "graphql"
elif event.get("request", {}).get("data"):
Expand Down Expand Up @@ -159,10 +151,7 @@ def graphql_span(
return

additional_attributes = {}
if has_data_collection_enabled(client_options):
if client_options["data_collection"]["graphql"]["document"]:
additional_attributes["graphql.document"] = source
elif should_send_default_pii():
if client_options["data_collection"]["graphql"]["document"]:
additional_attributes["graphql.document"] = source

_graphql_span = sentry_sdk.start_span(
Expand Down
Loading
Loading