Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def start_span( # pylint: disable=too-many-locals
self,
name: str,
parent: trace_api.ParentSpan = trace_api.Tracer.CURRENT_SPAN,
kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL,
attributes: Optional[types.Attributes] = None,
links: Sequence[trace_api.Link] = (),
start_time: Optional[int] = None,
set_status_on_exception: bool = True,
) -> trace_api.Span:
"""See `opentelemetry.trace.Tracer.start_span`."""
if parent is Tracer.CURRENT_SPAN:
parent = self.get_current_span()
parent_context = parent
if isinstance(parent_context, trace_api.Span):
parent_context = parent.get_context()
if parent_context is not None and not isinstance(
parent_context, trace_api.SpanContext
):
raise TypeError
if parent_context is None or not parent_context.is_valid():
parent = parent_context = None
trace_id = generate_trace_id()
trace_options = None
trace_state = None