Skip to content

fix: Rename op db to db.query #4444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: potel-base
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
- The `Span()` constructor does not accept a `hub` parameter anymore.
- `Span.finish()` does not accept a `hub` parameter anymore.
- `Span.finish()` no longer returns the `event_id` if the event is sent to sentry.
- Some integrations were creating spans with `op` `db`. This was changed to `db.query`.
- The `Profile()` constructor does not accept a `hub` parameter anymore.
- A `Profile` object does not have a `.hub` property anymore.
- `MAX_PROFILE_DURATION_NS`, `PROFILE_MINIMUM_SAMPLES`, `Profile`, `Scheduler`, `ThreadScheduler`, `GeventScheduler`, `has_profiling_enabled`, `setup_profiler`, `teardown_profiler` are no longer accessible from `sentry_sdk.profiler`. They're still accessible from `sentry_sdk.profiler.transaction_profiler`.
Expand All @@ -30,6 +31,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
- We updated how we handle `ExceptionGroup`s. You will now get more data if ExceptionGroups are appearing in chained exceptions. It could happen that after updating the SDK the grouping of issues change because of this. So eventually you will see the same exception in two Sentry issues (one from before the update, one from after the update)
- The integration for Python `logging` module does not send Sentry issues by default anymore when calling `logging.error()`, `logging.critical()` or `logging.exception()`. If you want to preserve the old behavior use `sentry_sdk.init(integrations=[LoggingIntegration(event_level="ERROR")])`.
- The `SentrySpanProcessor` and `SentryPropagator` are exported from `sentry_sdk.opentelemetry` instead of `sentry_sdk.integrations.opentelemetry`.
- PyMongo breadcrumb type was changed from `db` to `query`.
- The integration-specific content of the `sampling_context` argument of `traces_sampler` and `profiles_sampler` now looks different.
- The Celery integration doesn't add the `celery_job` dictionary anymore. Instead, the individual keys are now available as:

Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ class OP:
CACHE_PUT = "cache.put"
COHERE_CHAT_COMPLETIONS_CREATE = "ai.chat_completions.create.cohere"
COHERE_EMBEDDINGS_CREATE = "ai.embeddings.create.cohere"
DB = "db"
DB_QUERY = "db.query"
DB_REDIS = "db.redis"
EVENT_DJANGO = "event.django"
FUNCTION = "function"
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/asyncpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async def _inner(*args: Any, **kwargs: Any) -> T:
return await f(*args, **kwargs)

with sentry_sdk.start_span(
op=OP.DB,
op=OP.DB_QUERY,
name="connect",
origin=AsyncPGIntegration.origin,
only_if_parent=True,
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/clickhouse_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _inner(*args: P.args, **kwargs: P.kwargs) -> T:
params = args[3] if len(args) > 3 else kwargs.get("params")

span = sentry_sdk.start_span(
op=OP.DB,
op=OP.DB_QUERY,
name=query,
origin=ClickhouseDriverIntegration.origin,
only_if_parent=True,
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/django/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def connect(self):
sentry_sdk.add_breadcrumb(message="connect", category="query")

with sentry_sdk.start_span(
op=OP.DB,
op=OP.DB_QUERY,
name="connect",
origin=DjangoIntegration.origin_db,
only_if_parent=True,
Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/pymongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ def started(self, event):

query = _serialize_span_attribute(command)
span = sentry_sdk.start_span(
op=OP.DB,
op=OP.DB_QUERY,
name=query,
origin=PyMongoIntegration.origin,
only_if_parent=True,
)

with capture_internal_exceptions():
sentry_sdk.add_breadcrumb(
message=query, category="query", type=OP.DB, data=data
message=query, category="query", type="query", data=data
)

for key, value in data.items():
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/opentelemetry/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def span_data_for_db_query(span):
# type: (ReadableSpan) -> OtelExtractedSpanData
span_attributes = span.attributes or {}

op = cast("str", span_attributes.get(SentrySpanAttribute.OP, OP.DB))
op = cast("str", span_attributes.get(SentrySpanAttribute.OP, OP.DB_QUERY))

statement = span_attributes.get(SpanAttributes.DB_STATEMENT, None)
statement = cast("Optional[str]", statement)
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/tracing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def record_sql_queries(
sentry_sdk.add_breadcrumb(message=query, category="query", data=data)

with sentry_sdk.start_span(
op=OP.DB,
op=OP.DB_QUERY,
name=query,
origin=span_origin,
only_if_parent=True,
Expand Down
Loading
Loading