Skip to content

Commit

Permalink
Removed experimental explain_plan feature. (#3534)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
antonpirker committed Sep 13, 2024
1 parent e6ca5a2 commit 23ef8ca
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 184 deletions.
1 change: 0 additions & 1 deletion sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class EndpointType(Enum):
Experiments = TypedDict(
"Experiments",
{
"attach_explain_plans": dict[str, Any],
"max_spans": Optional[int],
"record_sql_params": Optional[bool],
"continuous_profiling_auto_start": Optional[bool],
Expand Down
Empty file removed sentry_sdk/db/__init__.py
Empty file.
59 changes: 0 additions & 59 deletions sentry_sdk/db/explain_plan/__init__.py

This file was deleted.

48 changes: 0 additions & 48 deletions sentry_sdk/db/explain_plan/django.py

This file was deleted.

48 changes: 0 additions & 48 deletions sentry_sdk/db/explain_plan/sqlalchemy.py

This file was deleted.

15 changes: 0 additions & 15 deletions sentry_sdk/integrations/django/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import sentry_sdk
from sentry_sdk.consts import OP, SPANDATA
from sentry_sdk.db.explain_plan.django import attach_explain_plan_to_span
from sentry_sdk.scope import add_global_event_processor, should_send_default_pii
from sentry_sdk.serializer import add_global_repr_processor
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TRANSACTION_SOURCE_URL
Expand Down Expand Up @@ -634,20 +633,6 @@ def execute(self, sql, params=None):
span_origin=DjangoIntegration.origin_db,
) as span:
_set_db_data(span, self)
options = (
sentry_sdk.get_client()
.options["_experiments"]
.get("attach_explain_plans")
)
if options is not None:
attach_explain_plan_to_span(
span,
self.cursor.connection,
sql,
params,
self.mogrify,
options,
)
result = real_execute(self, sql, params)

with capture_internal_exceptions():
Expand Down
13 changes: 0 additions & 13 deletions sentry_sdk/integrations/sqlalchemy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import sentry_sdk
from sentry_sdk.consts import SPANSTATUS, SPANDATA
from sentry_sdk.db.explain_plan.sqlalchemy import attach_explain_plan_to_span
from sentry_sdk.integrations import Integration, DidNotEnable
from sentry_sdk.tracing_utils import add_query_source, record_sql_queries
from sentry_sdk.utils import (
Expand Down Expand Up @@ -68,17 +66,6 @@ def _before_cursor_execute(

if span is not None:
_set_db_data(span, conn)
options = (
sentry_sdk.get_client().options["_experiments"].get("attach_explain_plans")
)
if options is not None:
attach_explain_plan_to_span(
span,
conn,
statement,
parameters,
options,
)
context._sentry_sql_span = span


Expand Down

0 comments on commit 23ef8ca

Please sign in to comment.