caikit.runtime.trace ==================== .. py:module:: caikit.runtime.trace .. autoapi-nested-parse:: The trace module holds utilities for tracing runtime requests. Attributes ---------- .. autoapisummary:: caikit.runtime.trace.log caikit.runtime.trace.error caikit.runtime.trace._TRACE_MODULE caikit.runtime.trace._PROPAGATE_MODULE caikit.runtime.trace._CONTEXT_TRACER_ATTR Classes ------- .. autoapisummary:: caikit.runtime.trace._NoOpProxy Functions --------- .. autoapisummary:: caikit.runtime.trace.configure caikit.runtime.trace.get_tracer caikit.runtime.trace.get_trace_context caikit.runtime.trace.set_tracer caikit.runtime.trace.start_child_span caikit.runtime.trace._load_tls_secret Module Contents --------------- .. py:data:: log .. py:data:: error .. py:data:: _TRACE_MODULE :value: None .. py:data:: _PROPAGATE_MODULE :value: None .. py:function:: configure() Configure all tracing based on config and installed packages .. py:function:: get_tracer(name: str) -> Union[_NoOpProxy, opentelemetry.trace.Tracer] Get a tracer that can be called with the opentelemetry API. If not configured, this will be a No-Op Proxy. .. py:function:: get_trace_context(runtime_context: caikit.core.data_model.runtime_context.RuntimeServerContextType) -> Optional[opentelemetry.Context] Extract the trace context from the runtime request context .. py:function:: set_tracer(runtime_context: caikit.core.data_model.runtime_context.RuntimeServerContextType, tracer: opentelemetry.trace.Tracer) Helper to decorate a runtime context with a tracer if enabled .. py:function:: start_child_span(runtime_context: caikit.core.data_model.runtime_context.RuntimeServerContextType, span_name: str) -> Iterable[Union[opentelemetry.trace.Span, _NoOpProxy]] Context manager that wraps start_as_current_span if enabled and tries to fetch a parent span from the runtime context .. py:data:: _CONTEXT_TRACER_ATTR :value: '__tracer__' .. py:function:: _load_tls_secret(tls_config_val: str) -> bytes If the config value points at a file, load it, otherwise assume it's an inline string .. py:class:: _NoOpProxy This dummy class is infinitely callable and will return itself on any getattr call or context enter/exit. It can be used to provide a no-op stand-in for all of the classes in the opentelemetry ecosystem when they are either not configured or not available. .. py:method:: __getattr__(*_, **__) .. py:method:: __call__(*_, **__) -> _NoOpProxy .. py:method:: __enter__(*_, **__) -> _NoOpProxy .. py:method:: __exit__(*_, **__)