Skip to content

Commit

Permalink
test(celery): Test that messaging.system gets set
Browse files Browse the repository at this point in the history
The messaging.system span data attribute should be set to the Celery broker being used, e.g. "amqp" for RabbitMQ, "redis" for Redis, and "sqs" for Amazon SQS.

ref #2951
  • Loading branch information
szokeasaurusrex committed May 3, 2024
1 parent 0e19e51 commit 55ba199
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/integrations/celery/test_celery.py
Expand Up @@ -704,3 +704,21 @@ def task(): ...
(event,) = events
(span,) = event["spans"]
assert span["data"]["messaging.message.retry.count"] == 3


@pytest.mark.parametrize("system", ("redis", "amqp"))
def test_messaging_system(system, init_celery, capture_events):
celery = init_celery(enable_tracing=True)
events = capture_events()

# Does not need to be a real URL, since we use always eager
celery.conf.broker_url = f"{system}://example.com"

@celery.task()
def task(): ...

task.apply_async()

(event,) = events
(span,) = event["spans"]
assert span["data"]["messaging.system"] == system

0 comments on commit 55ba199

Please sign in to comment.