diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index ddb541cbb2..453a785d69 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -239,6 +239,11 @@ class SPANDATA: e.g. the queue name or topic. """ + MESSAGING_MESSAGE_ID = "messaging.message.id" + """ + The message's identifier. + """ + MESSAGING_MESSAGE_RETRY_COUNT = "messaging.message.retry.count" """ Number of retries/attempts to process a message. diff --git a/sentry_sdk/integrations/celery/__init__.py b/sentry_sdk/integrations/celery/__init__.py index 85f7108ff0..6d118a6b44 100644 --- a/sentry_sdk/integrations/celery/__init__.py +++ b/sentry_sdk/integrations/celery/__init__.py @@ -357,7 +357,7 @@ def _inner(*args, **kwargs): ) as span: _set_messaging_destination_name(task, span) with capture_internal_exceptions(): - span.set_data("messaging.message.id", task.request.id) + span.set_data(SPANDATA.MESSAGING_MESSAGE_ID, task.request.id) with capture_internal_exceptions(): span.set_data( SPANDATA.MESSAGING_MESSAGE_RETRY_COUNT, task.request.retries