noc.core.span

Module Contents

noc.core.span.forensic_logger
noc.core.span.SpanItemFields = ['date', 'ts', 'ctx', 'id', 'parent', 'server', 'service', 'client', 'duration', 'error_code', 'error_text', 'sample', 'in_label', 'out_label']
noc.core.span.SpanItem
noc.core.span.span_lock
noc.core.span.tls
noc.core.span.spans = []
noc.core.span.DEFAULT_CLIENT = NOC
noc.core.span.DEFAULT_SERVER = NOC
noc.core.span.DEFAULT_SERVICE = unknown
noc.core.span.DEFAULT_SAMPLE_RATE = 1
noc.core.span.PARENT_SAMPLE
noc.core.span.DEFAULT_ERROR_TEXT =
noc.core.span.DEFAULT_LABEL =
noc.core.span.DEFAULT_ID = 0
noc.core.span.US = 1000000.0
class noc.core.span.Span(client=DEFAULT_CLIENT, server=DEFAULT_SERVER, service=DEFAULT_SERVICE, sample=PARENT_SAMPLE, in_label=DEFAULT_LABEL, parent=DEFAULT_ID, context=DEFAULT_ID, hist=None, quantile=None, suppress_trace=False)

Bases: object

__enter__(self)
__exit__(self, exc_type, exc_val, exc_tb)
set_error(self, code: Optional[int] = None, text: Optional[str] = None)

Set error result and code for current span :param code: Optional error code :param text: Optional error text :return:

set_error_from_exc(self, exc: Exception, code: Optional[int] = ERR_UNKNOWN)

Set error result and code for current span from exception :param exc: Raised exception :param code: Optional error code :return:

noc.core.span.get_spans()

Get and flush all spans :return:

noc.core.span.span_to_dict(span)

Convert span to object :param span: :return:

noc.core.span.get_current_span()

Get current span if active

Returns

Current context, span or None, None