Skip to content

ext/celery: propagate the span and link the publisher to the runner#957

Closed
nightmared wants to merge 3 commits intoopen-telemetry:masterfrom
nightmared:celery-propagate-span
Closed

ext/celery: propagate the span and link the publisher to the runner#957
nightmared wants to merge 3 commits intoopen-telemetry:masterfrom
nightmared:celery-propagate-span

Conversation

@nightmared
Copy link
Copy Markdown
Contributor

Description

This change propagates the {trace_id, span_id} of the parent span and the span_id of the span of the publisher task.

Fixes #876

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Screenshot_2020-07-29 Jaeger UI
django-email-celery.zip

@nightmared nightmared requested a review from a team July 29, 2020 13:39
@nightmared nightmared force-pushed the celery-propagate-span branch from 2e02a47 to bd70461 Compare August 5, 2020 15:59
@nightmared nightmared force-pushed the celery-propagate-span branch from bd70461 to 3e3b159 Compare August 26, 2020 07:36
@codeboten codeboten added the instrumentation Related to the instrumentation of third party libraries or frameworks label Sep 3, 2020
parent=parent,
links=links,
kind=trace.SpanKind.CONSUMER,
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can the else condition be removed and parent be passed to the function always. If it is None, it shouldn't have any effect on the span right? Rest of the arguments seem to be exactly the same.

headers[CTX_PUBLISHER_SPAN_ID] = str(ctx.span_id)
headers[CTX_PARENT_TRACE_FLAGS_SAMPLED] = getattr(
parent_ctx.trace_flags, "sampled", False,
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should just use the configured propagator here to inject trace context and use propagator again to extract the context on the other side. No reason celery instrumentation should ignore globally configured propagators.

@nightmared
Copy link
Copy Markdown
Contributor Author

Thanks for the review, alas I no longer work for the company where I worked on this (I only did a short internship there). I will probably take a look at this, but maybe not very soon (I no longer have access to the project upon which I tested this, and this is not my uttermost priority currently). I will keep you posted.

@owais
Copy link
Copy Markdown
Contributor

owais commented Sep 17, 2020

@nightmared Thanks for replying. Do you mind if I submit another PR for this? I kinda need it urgently and can submit a PR within the next day or two.

@nightmared
Copy link
Copy Markdown
Contributor Author

No worries, sure thing ! To be honest, I am even happier if I don't have to do it myself ;) Thanks !

@codeboten
Copy link
Copy Markdown
Contributor

The issue this PR was addressing was fixed in #1135

@codeboten codeboten closed this Sep 29, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 2020
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

instrumentation Related to the instrumentation of third party libraries or frameworks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Celery Instrumentation with apply_async function

3 participants