Skip to content

Commit 23ef8ca

Browse files
authored
Removed experimental explain_plan feature. (getsentry#3534)
Attaching the database explain plan to a db span was an experimental feature done in an Sentry Hackweek. As we are moving into an Otel world, we remove this experiment from our Repository. There is still a branch experiment/explain_plans on Github to keep the code for future reference: https://github.com/getsentry/sentry-python/tree/experiment/explain_plans (maybe we can copy the code into the Opentelemetry instrumentation if we want to see this feature in the future)
1 parent e6ca5a2 commit 23ef8ca

File tree

7 files changed

+0
-184
lines changed

7 files changed

+0
-184
lines changed

sentry_sdk/consts.py

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class EndpointType(Enum):
5353
Experiments = TypedDict(
5454
"Experiments",
5555
{
56-
"attach_explain_plans": dict[str, Any],
5756
"max_spans": Optional[int],
5857
"record_sql_params": Optional[bool],
5958
"continuous_profiling_auto_start": Optional[bool],

sentry_sdk/db/__init__.py

Whitespace-only changes.

sentry_sdk/db/explain_plan/__init__.py

-59
This file was deleted.

sentry_sdk/db/explain_plan/django.py

-48
This file was deleted.

sentry_sdk/db/explain_plan/sqlalchemy.py

-48
This file was deleted.

sentry_sdk/integrations/django/__init__.py

-15
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import sentry_sdk
88
from sentry_sdk.consts import OP, SPANDATA
9-
from sentry_sdk.db.explain_plan.django import attach_explain_plan_to_span
109
from sentry_sdk.scope import add_global_event_processor, should_send_default_pii
1110
from sentry_sdk.serializer import add_global_repr_processor
1211
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TRANSACTION_SOURCE_URL
@@ -634,20 +633,6 @@ def execute(self, sql, params=None):
634633
span_origin=DjangoIntegration.origin_db,
635634
) as span:
636635
_set_db_data(span, self)
637-
options = (
638-
sentry_sdk.get_client()
639-
.options["_experiments"]
640-
.get("attach_explain_plans")
641-
)
642-
if options is not None:
643-
attach_explain_plan_to_span(
644-
span,
645-
self.cursor.connection,
646-
sql,
647-
params,
648-
self.mogrify,
649-
options,
650-
)
651636
result = real_execute(self, sql, params)
652637

653638
with capture_internal_exceptions():

sentry_sdk/integrations/sqlalchemy.py

-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import sentry_sdk
21
from sentry_sdk.consts import SPANSTATUS, SPANDATA
3-
from sentry_sdk.db.explain_plan.sqlalchemy import attach_explain_plan_to_span
42
from sentry_sdk.integrations import Integration, DidNotEnable
53
from sentry_sdk.tracing_utils import add_query_source, record_sql_queries
64
from sentry_sdk.utils import (
@@ -68,17 +66,6 @@ def _before_cursor_execute(
6866

6967
if span is not None:
7068
_set_db_data(span, conn)
71-
options = (
72-
sentry_sdk.get_client().options["_experiments"].get("attach_explain_plans")
73-
)
74-
if options is not None:
75-
attach_explain_plan_to_span(
76-
span,
77-
conn,
78-
statement,
79-
parameters,
80-
options,
81-
)
8269
context._sentry_sql_span = span
8370

8471

0 commit comments

Comments
 (0)