OpenTracing¶
This module is available only if you have opentracing installed
trace_future¶
-
satella.opentracing.
trace_future
(future: Union[satella.cassandra.common.ResponseFuture, concurrent.futures._base.Future], span: satella.opentracing.trace.Span)¶ Install a handler that will close a span upon a future completing, attaching the exception contents if the future ends with an exception.
Parameters: - future – can be either a normal Future or a Cassandra’s ResponseFuture
- span – span to close on future’s completion
trace_function¶
-
satella.opentracing.
trace_function
(tracer, name: str, tags: Optional[dict] = None, tags_factory: Union[Dict[str, Callable], List[Tuple[str, Callable]], None] = None)¶ Return a decorator that will trace the execution of a given function using tracer.start_active_span.
Can optionally construct it’s tags from a predicate building, example:
>>> class Device: >>> device_id = 'test' >>> @trace_function(tracer, 'Processing', tags_factory=[('device_id', x[0].device_id)]) >>> def process(device: Device): >>> ...
Parameters:
trace_exception¶
-
satella.opentracing.
trace_exception
(span: Optional[satella.opentracing.trace.Span], exc_type: Optional[Type[Exception]] = None, exc_val: Optional[Exception] = None, exc_tb: Optional[traceback] = None, max_tb_length: Optional[int] = None) → None¶ Log an exception’s information to the chosen span, as logs and tags.
Parameters: - span – span to log into or None for a no-op
- exc_type – exception type. If None this will be taken from sys.exc_info.
- exc_val – exception value. If None this will be taken from sys.exc_info.
- exc_tb – exception traceback. If None this will be taken from sys.exc_info.
- max_tb_length – maximum traceback length. If traceback is longer than that,
it will be trimmed. The default is 65536. You can set it by
satella.opentracing.set_maximum_traceback_length()