zalando-zmon / opentracing-utils

Convenient utilities for adding OpenTracing support in your python projects
MIT License
20 stars 8 forks source link

Add support for scope manager #54

Closed mohabusama closed 3 years ago

mohabusama commented 3 years ago

opentracing==2.0 introduced scope manager API. The tracer is responsible for scope_manager implementation.

The order for detecting parent spans needs to be updated. I suggest one of the following two orders:

Scope manager first

  1. Using opentracing.tracer.active_span managed by the tracer context manager. The new span will be using the scope manager.
  2. Using span_extractor.
  3. Detecting span in kwargs.
  4. Using call stack frames inspection.

Explicit first

  1. Using span_extractor.
  2. Detecting span in kwargs.
  3. Using opentracing.tracer.active_span managed by the tracer context manager. The new span will be using the scope manager.
  4. Using call stack frames inspection.

as span_extractor and passing spans in kwargs is more explicit.