Noop Tracer

class opencensus.trace.tracers.noop_tracer.NoopTracer[source]

Bases: opencensus.trace.tracers.base.Tracer

No-op implementation of the Tracer interface, all methods are no-ops. Should be used when tracing is not enabled or not sampled.

add_attribute_to_current_span(attribute_key, attribute_value)[source]

Add attribute to current span.

Parameters

attribute_key (str) -- Attribute key.

:type attribute_value:str :param attribute_value: Attribute value.

current_span()[source]

Return the current span.

end_span()[source]

End a span. Remove the span from the span stack, and update the span_id in TraceContext as the current span_id which is the peek element in the span stack.

finish()[source]

End spans and send to reporter.

list_collected_spans()[source]

List collected spans.

span(name='span')[source]

Create a new span with the trace using the context information.

Parameters

name (str) -- The name of the span.

Return type

Span

Returns

The Span object.

start_span(name='span')[source]

Start a span.

Parameters

name (str) -- The name of the span.

Return type

Span

Returns

The Span object.