Skip to content

Commit

Permalink
fix: Initialize the
Browse files Browse the repository at this point in the history
This lets us reference the global store of spans for requests and so on
  • Loading branch information
mikebryant committed Dec 24, 2017
1 parent e625a63 commit 1d7aa68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django_opentracing/middleware.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.conf import settings
from django_opentracing.tracer import initialize_global_tracer, DjangoTracer
from django_opentracing.tracer import initialize_global_tracer
try:
# Django >= 1.10
from django.utils.deprecation import MiddlewareMixin
Expand All @@ -20,7 +20,7 @@ def __init__(self, get_response=None):
'''
self.get_response = get_response
initialize_global_tracer()
self._tracer = DjangoTracer()
self._tracer = settings.OPENTRACING_TRACER

def process_view(self, request, view_func, view_args, view_kwargs):
# determine whether this middleware should be applied
Expand Down
1 change: 1 addition & 0 deletions django_opentracing/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def initialize_global_tracer():
tracer_callable = getattr(settings, 'OPENTRACING_TRACER_CALLABLE', 'opentracing.Tracer')
tracer_parameters = getattr(settings, 'OPENTRACING_TRACER_PARAMETERS', {})
opentracing.tracer = import_string(tracer_callable)(**tracer_parameters)
settings.OPENTRACING_TRACER = DjangoTracer()
initialize_global_tracer.complete = True


Expand Down

0 comments on commit 1d7aa68

Please sign in to comment.