Skip to content

Commit

Permalink
docs(opentracing): add celery example (#1329)
Browse files Browse the repository at this point in the history
* Document how to propagate the tracer across celery tasks

* docs(opentracing): add celery distributed tracing example

Co-authored-by: Lie Ryan <lie.1296@gmail.com>
Co-authored-by: Tahir H. Butt <tahir.butt@datadoghq.com>
  • Loading branch information
3 people committed Apr 2, 2020
1 parent 3911e64 commit e76a588
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
1 change: 0 additions & 1 deletion ddtrace/contrib/celery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def run(self):
By default, reported service names are:
* ``celery-producer`` when tasks are enqueued for processing
* ``celery-worker`` when tasks are processed by a Celery process
"""
from ...utils.importlib import require_modules

Expand Down
25 changes: 24 additions & 1 deletion docs/advanced_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,30 @@ the :ref:`ddtrace-run<ddtracerun>` command to invoke your OpenTraced
application.


**Opentracer API**
Examples
^^^^^^^^

**Celery**

Distributed Tracing across celery tasks with OpenTracing.

1. Install Celery OpenTracing:

pip install Celery-OpenTracing

2. Replace your Celery app with the version that comes with Celery-OpenTracing:

from celery_opentracing import CeleryTracing
from ddtrace.opentracer import set_global_tracer, Tracer

ddtracer = Tracer()
set_global_tracer(ddtracer)

app = CeleryTracing(app, tracer=ddtracer)


Opentracer API
^^^^^^^^^^^^^^

.. autoclass:: ddtrace.opentracer.Tracer
:members:
Expand Down

0 comments on commit e76a588

Please sign in to comment.