Tracing tasks in celery 4.1.1 using sample code. Each worker runs:
import logging
from jaeger_client import Config
import opentracing
def get_tracer(service="Vienna"):
config = Config(
config={
'sampler': {
'type': 'const',
'param': 1,
},
'logging': True,
},
service_name=service,
)
return config.initialize_tracer() or opentracing.global_tracer()
When I first start celery and run tasks each worker gets a working tracer and there is a log output for each of:
[2019-07-04 19:17:00,527: INFO/ForkPoolWorker-2] Initializing Jaeger Tracer with UDP reporter
[2019-07-04 19:17:00,546: INFO/ForkPoolWorker-2] opentracing.tracer initialized to <jaeger_client.tracer.Tracer object at 0x7f804d079c10>[app_name=SocketIOTask]
Any task that runs after the initial gets the global tracer
from Config.initialze_tracer
(which returns None
) and a log warning Jaeger tracer already initialized, skipping
.
Watching tcpdump on the console shows that the UDP packets aren't being sent, I think I'm getting an uninitialized default tracer and it's using the noop reporter.
I've pored over the code in opentracing and jaeger_client and I can't find a canonical way around this.