zalando-zmon / opentracing-utils

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

Find django spans in the stack #39

Open wiedi opened 4 years ago

wiedi commented 4 years ago

The django middleware doesn't put the span on the stack directly but instead stores it on the request object. This helps find it anyway.

codecov[bot] commented 4 years ago

Codecov Report

Merging #39 (bee1d6a) into master (cc2c2b7) will decrease coverage by 0.78%. The diff coverage is 62.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
- Coverage   98.61%   97.83%   -0.79%     
==========================================
  Files           9        9              
  Lines         362      370       +8     
==========================================
+ Hits          357      362       +5     
- Misses          5        8       +3     
Impacted Files Coverage Δ
opentracing_utils/span.py 96.05% <62.50%> (-3.95%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update cc2c2b7...bee1d6a. Read the comment docs.

pitr commented 4 years ago

Could this code be added to libs/_django.py instead?

wiedi commented 4 years ago

I am not sure. Do you have a concrete idea what that should look like?

Just placing the span in the stack context instead of attaching it to the request object would probably not be enough since process_view itself won't always be in the stacktrace due to how the django middleware works.