-
Notifications
You must be signed in to change notification settings - Fork 763
Closed
Description
In Java, we have a DefaultSpan which does nothing by default (it can propagate SpanContext too, but that's more of additional stuff), and can be used as both a no-op object.
Specifically, DefaultSpan.getInvalid() offers a static instance that can also be used when setting parent (through SpanBuilder.serParent()) and also for Tracer.getCurrentSpan() (so the user doesn't have to do a null check).
As Span at this moment already has this no-op functionality, maybe it makes sense to add a class field? This way we could do:
def start_span(..., parent = Span.invalid(), ...):
if parent is Span.invalid():
# fetch the actual current Span as parent.
def get_current_span(self):
...
# Return a no-op in case there's no current Span.
return Span.invalid()c24t
Metadata
Metadata
Assignees
Labels
No labels