Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions django_opentracing/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ def wrapper(request, *args, **kwargs):
return wrapper
return decorator

def another_trace(self, name, is_method=False):
def decorator(func):
def wrapper(*args, **kwargs):
# check if `func' is a method or not
if is_method:
fname = type(args[0]).__name__ + '.' + name
else:
fname = name

with self.tracer.start_active_span(fname):
r = func(*args, **kwargs)
return r

return wrapper
return decorator

def _apply_tracing(self, request, view_func, attributes):
'''
Helper function to avoid rewriting for middleware and decorator.
Expand Down