Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(celery): add message.destination and change out.host tags #10750

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
12 changes: 7 additions & 5 deletions ddtrace/contrib/internal/celery/signals.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from urllib.parse import urlparse

from celery import current_app
from celery import registry
from celery.utils import nodenames

from ddtrace import Pin
from ddtrace import config
Expand Down Expand Up @@ -167,10 +169,10 @@ def trace_after_publish(*args, **kwargs):
if span is None:
return
else:
nodename = span.get_tag("celery.hostname")
if nodename is not None:
_, host = nodenames.nodesplit(nodename)
span.set_tag_str(net.TARGET_HOST, host)
broker_url = current_app.conf.broker_url
parsed_url = urlparse(broker_url)
host = parsed_url.hostname
span.set_tag_str(net.TARGET_HOST, host)

span.finish()
detach_span(task, task_id, is_publish=True)
Expand Down
1 change: 1 addition & 0 deletions ddtrace/contrib/internal/celery/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
("id", "celery.id"),
("priority", "celery.priority"),
("queue", "celery.queue"),
("messaging.destination", "celery.queue"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
("messaging.destination", "celery.queue"),
("queue", "messaging.destination"),

("reply_to", "celery.reply_to"),
("retries", "celery.retries"),
("routing_key", "celery.routing_key"),
Expand Down
Loading