Skip to content

Question: How use opentracing.global_tracer() when using jaeger_client lib #35

@jan25

Description

@jan25

This example https://github.com/opentracing-contrib/python-flask/blob/master/example/server.py#L28 uses the tracer returned by jaeger_client's initialize_tracer method. This method internally sets the opentracing.tracer to jaeger tracer object, this means for any request handler there after can do opentracing.global_tracer().start_span(...) and this sends traces to jaeger

I noticed when i run a flask dev server(using app.run) opentracing.global_tracer() is not the same as jaeger tracer i initialised earlier(as in the the link above) when starting up the server. Is there something i'm missing on flask side?

I could use returned jaeger_tracer from initialize_tracer(), which would mean i'd have to pass this around or create my own process/request local storage. I suppose according to jaeger tracer docs https://github.com/jaegertracing/jaeger-client-python#production, the initialised jaeger tracer must be available via opentracing.global_tracer()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions