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): change out.host tags to point to celery broker #10750

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

ZStriker19
Copy link
Contributor

@ZStriker19 ZStriker19 commented Sep 20, 2024

Motivation

Change out.host tags to point towards the celery broker, instead of the local celery hostname. Fixes service-representation issues.

Fixes 11491

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Sep 20, 2024

CODEOWNERS have been resolved as:

releasenotes/notes/update-celery-out-host-tag-be8da4f2ab88b4cf.yaml     @DataDog/apm-python
tests/contrib/celery/test_tagging.py                                    @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/celery/signals.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/celery/base.py                                            @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/celery/test_integration.py                                @DataDog/apm-core-python @DataDog/apm-idm-python

@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Sep 20, 2024

Datadog Report

Branch report: zachg/fix_celery_outgoing_tags
Commit report: d644a36
Test service: dd-trace-py

✅ 0 Failed, 1097 Passed, 281 Skipped, 8m 50.59s Total duration (17m 43.95s time saved)

@pr-commenter
Copy link

pr-commenter bot commented Sep 20, 2024

Benchmarks

Benchmark execution time: 2024-11-22 22:02:14

Comparing candidate commit 3021b57 in PR branch zachg/fix_celery_outgoing_tags with baseline commit 688fa7f in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 388 metrics, 2 unstable metrics.

@wconti27 wconti27 marked this pull request as ready for review November 22, 2024 18:31
@wconti27 wconti27 requested review from a team as code owners November 22, 2024 18:31
@wconti27 wconti27 changed the title fix(celery): add message.destination and change out.host tags fix(celery): change out.host tags to point to celery broker Nov 22, 2024
@wconti27 wconti27 requested a review from a team as a code owner November 22, 2024 21:20
@wconti27 wconti27 self-assigned this Nov 22, 2024
def test_amqp_task(instrument_celery, traced_amqp_celery_app):
tracer = Pin.get_from(traced_amqp_celery_app).tracer

with start_worker( # <-- Important!
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: What is this comment for? Could we maybe elaborate?

assert_traces(tracer, "add", t, "amqp")


def assert_traces(tracer, task_name, task, backend):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just make this into a snapshot test?

Copy link
Contributor

@erikayasuda erikayasuda left a comment

Choose a reason for hiding this comment

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

Forgot to approve, oops


host = ""
if parsed_url.scheme:
host += parsed_url.scheme + "://"
Copy link

Choose a reason for hiding this comment

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

out.host should contain only the host (server.address in otel terms), so we should omit the "scheme" in this case.

Copy link
Collaborator

@wantsui wantsui Nov 22, 2024

Choose a reason for hiding this comment

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

Since one of the assertions is assert async_span.get_tag("out.host") == "memory://", I think we should only omit it if it doesn't say memory.

Otherwise, that span tag will be completely blank in the "memory scenario".

Copy link

Choose a reason for hiding this comment

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

Since one of the assertions is assert async_span.get_tag("out.host") == "memory://", I think we should only omit it if it doesn't say memory.

OK, that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants