@@ -164,7 +164,7 @@ def send_all(self):
164
164
self .tracer_impl .finish_span (span )
165
165
span = self .tracer_impl .get_active_span ()
166
166
167
- def wrap (self , name , trace_id = None , parent_id = None ):
167
+ def traced (self , name , trace_id = None , parent_id = None ):
168
168
def wrapped (fn , * args , ** kwargs ):
169
169
def inner (* args , ** kwargs ):
170
170
with self .tracer (name = name , trace_id = trace_id , parent_id = parent_id ):
@@ -518,24 +518,25 @@ def close():
518
518
519
519
_GBL = None
520
520
521
- def wrap (name , trace_id = None , parent_id = None ):
521
+ def traced (name , trace_id = None , parent_id = None ):
522
522
'''
523
- Function decorator to wrap an entire function in a span. If no trace
524
- is active, starts a new trace, and the wrapping span will be a root
525
- span.
523
+ Function decorator to wrap an entire function in a trace span. If no trace
524
+ is active in the current thread, starts a new trace, and the wrapping span
525
+ will be a root span. If a trace is active, creates a child span of the
526
+ existing trace.
526
527
527
528
Example use:
528
529
529
530
```
530
- @wrap (name="my_expensive_function")
531
+ @traced (name="my_expensive_function")
531
532
def my_func(n):
532
533
recursive_fib(n)
533
534
534
535
my_func(100)
535
536
```
536
537
537
538
Args:
538
- - `name`: a descriptive name for the this trace span, i.e. "function_name"
539
+ - `name`: a descriptive name for the this trace span, i.e. "function_name". This is required.
539
540
- `trace_id`: the trace_id to use. If None, will be automatically generated.
540
541
Use this if you want to explicitly resume a trace in this application that was
541
542
initiated in another application, and you have the upstream trace_id.
@@ -553,4 +554,4 @@ def inner(*args, **kwargs):
553
554
554
555
return wrapped
555
556
556
- return _beeline .wrap (name , trace_id , parent_id )
557
+ return _beeline .traced (name , trace_id , parent_id )
0 commit comments