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
2 changes: 1 addition & 1 deletion MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
Span ops are now a smaller, framework-neutral set.

- The Cohere integration now emits `gen_ai.chat` instead of `ai.chat_completions.create.cohere`, and `gen_ai.embeddings` instead of `ai.embeddings.create.cohere`.
- The Django integration now emits `view.render` instead of `view.response.render`, and `view` instead of `view.authenticate`.
- The Django integration now emits `view.render` instead of `view.response.render`, `view` instead of `view.authenticate`, and `function` instead of `event.django`.

#### Django

Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/django/signals_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def wrapper(*args: "Any", **kwargs: "Any") -> "Any":
with sentry_sdk.start_span(
name=signal_name,
attributes={
"sentry.op": OP.EVENT_DJANGO,
"sentry.op": OP.FUNCTION,
"sentry.origin": DjangoIntegration.origin,
SPANDATA.CODE_FUNCTION_NAME: signal_name,
},
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/django/asgi/test_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import sentry_sdk
from sentry_sdk import capture_message
from sentry_sdk.consts import SPANDATA
from sentry_sdk.consts import OP, SPANDATA
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.django.asgi import _asgi_middleware_mixin_factory
from tests.integrations.django.myapp.asgi import channels_application
Expand Down Expand Up @@ -271,7 +271,7 @@ async def test_async_middleware_spans(

# Filter out signal-receiver spans — their ordering depends on Django
# module import order and is not what this middleware test verifies.
spans = [s for s in spans if s["attributes"].get("sentry.op") != "event.django"]
spans = [s for s in spans if s["attributes"].get("sentry.op") != OP.FUNCTION]

assert (
render_span_tree(spans)
Expand Down
24 changes: 12 additions & 12 deletions tests/integrations/django/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import sentry_sdk
from sentry_sdk import capture_exception, capture_message
from sentry_sdk._compat import PY310
from sentry_sdk.consts import SPANDATA
from sentry_sdk.consts import OP, SPANDATA
from sentry_sdk.integrations.django import (
DjangoIntegration,
DjangoRequestExtractor,
Expand Down Expand Up @@ -1571,15 +1571,15 @@ def test_signals_spans(
render_span_tree(spans)
== """\
- sentry.op="http.server": name="/message"
- sentry.op="event.django": name="django.db.reset_queries"
- sentry.op="event.django": name="django.db.close_old_connections"\
- sentry.op="function": name="django.db.reset_queries"
- sentry.op="function": name="django.db.close_old_connections"\
"""
)

assert spans[0]["attributes"]["sentry.op"] == "event.django"
assert spans[0]["attributes"]["sentry.op"] == OP.FUNCTION
assert spans[0]["name"] == "django.db.reset_queries"

assert spans[1]["attributes"]["sentry.op"] == "event.django"
assert spans[1]["attributes"]["sentry.op"] == OP.FUNCTION
assert spans[1]["name"] == "django.db.close_old_connections"


Expand Down Expand Up @@ -1635,19 +1635,19 @@ def test_signals_spans_filtering(
render_span_tree(spans)
== """\
- sentry.op="http.server": name="/send-myapp-custom-signal"
- sentry.op="event.django": name="django.db.reset_queries"
- sentry.op="event.django": name="django.db.close_old_connections"
- sentry.op="event.django": name="tests.integrations.django.myapp.signals.signal_handler"\
- sentry.op="function": name="django.db.reset_queries"
- sentry.op="function": name="django.db.close_old_connections"
- sentry.op="function": name="tests.integrations.django.myapp.signals.signal_handler"\
"""
)

assert spans[0]["attributes"]["sentry.op"] == "event.django"
assert spans[0]["attributes"]["sentry.op"] == OP.FUNCTION
assert spans[0]["name"] == "django.db.reset_queries"

assert spans[1]["attributes"]["sentry.op"] == "event.django"
assert spans[1]["attributes"]["sentry.op"] == OP.FUNCTION
assert spans[1]["name"] == "django.db.close_old_connections"

assert spans[2]["attributes"]["sentry.op"] == "event.django"
assert spans[2]["attributes"]["sentry.op"] == OP.FUNCTION
assert spans[2]["name"] == "tests.integrations.django.myapp.signals.signal_handler"


Expand Down Expand Up @@ -1793,7 +1793,7 @@ def test_span_origin(

for span in spans:
assert span["attributes"]["sentry.origin"] == "auto.http.django"
if span["attributes"]["sentry.op"] == "event.django":
if span["attributes"]["sentry.op"] == OP.FUNCTION:
signal_span_found = True

assert signal_span_found
Expand Down
Loading