From 9af532424635ae3d0eabe338d798c7d809f82fc7 Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Fri, 10 May 2024 14:04:34 +0200 Subject: [PATCH] ref(celery): Message ID SPANDATA constant ref #2974 --- sentry_sdk/consts.py | 5 +++++ sentry_sdk/integrations/celery/__init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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