Skip to content

Commit bfff9f1

Browse files
committed
Instrument celery worker
Signed-off-by: Federico Busetti <[email protected]>
1 parent 2fa3065 commit bfff9f1

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.idea/bootstrap-python-fastapi.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/celery_worker/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
without having to initialise the HTTP framework (or other ones)
55
"""
66

7+
from celery.signals import worker_process_init
8+
from opentelemetry.instrumentation.celery import CeleryInstrumentor
9+
710
from bootstrap import AppConfig, application_init
811

12+
13+
@worker_process_init.connect(weak=False)
14+
def init_celery_tracing(*args, **kwargs):
15+
CeleryInstrumentor().instrument()
16+
17+
918
app = application_init(AppConfig()).celery_app

0 commit comments

Comments
 (0)