Skip to content

Commit

Permalink
ref(celery): MESSAGNING_DESTINATION_NAME constant
Browse files Browse the repository at this point in the history
ref #2961
  • Loading branch information
szokeasaurusrex committed May 10, 2024
1 parent 6a284ed commit c589e6c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions sentry_sdk/consts.py
Expand Up @@ -233,6 +233,12 @@ class SPANDATA:
Example: 418
"""

MESSAGING_DESTINATION_NAME = "messaging.destination.name"
"""
The destination name where the message is being consumed from,
e.g. the queue name or topic.
"""

SERVER_ADDRESS = "server.address"
"""
Name of the database host.
Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/celery/__init__.py
Expand Up @@ -4,7 +4,7 @@
import sentry_sdk
from sentry_sdk import isolation_scope
from sentry_sdk.api import continue_trace
from sentry_sdk.consts import OP
from sentry_sdk.consts import OP, SPANDATA
from sentry_sdk.integrations import Integration, DidNotEnable
from sentry_sdk.integrations.celery.beat import (
_patch_beat_apply_entry,
Expand Down Expand Up @@ -334,7 +334,7 @@ def _set_messaging_destination_name(task, span):
if delivery_info.get("exchange") == "" and routing_key is not None:
# Empty exchange indicates the default exchange, meaning the tasks
# are sent to the queue with the same name as the routing key.
span.set_data("messaging.destination.name", routing_key)
span.set_data(SPANDATA.MESSAGING_DESTINATION_NAME, routing_key)


def _wrap_task_call(task, f):
Expand Down

0 comments on commit c589e6c

Please sign in to comment.