caikit.runtime.trace
The trace module holds utilities for tracing runtime requests.
Attributes
Classes
This dummy class is infinitely callable and will return itself on any |
Functions
Configure all tracing based on config and installed packages |
|
|
Get a tracer that can be called with the opentelemetry API. If not |
|
Extract the trace context from the runtime request context |
|
Helper to decorate a runtime context with a tracer if enabled |
|
Context manager that wraps start_as_current_span if enabled and tries to |
|
If the config value points at a file, load it, otherwise assume it's an |
Module Contents
- caikit.runtime.trace.error
- caikit.runtime.trace._TRACE_MODULE = None
- caikit.runtime.trace._PROPAGATE_MODULE = None
- caikit.runtime.trace.configure()[source]
Configure all tracing based on config and installed packages
- caikit.runtime.trace.get_tracer(name: str) _NoOpProxy | opentelemetry.trace.Tracer[source]
Get a tracer that can be called with the opentelemetry API. If not configured, this will be a No-Op Proxy.
- caikit.runtime.trace.get_trace_context(runtime_context: caikit.core.data_model.runtime_context.RuntimeServerContextType) opentelemetry.Context | None[source]
Extract the trace context from the runtime request context
- caikit.runtime.trace.set_tracer(runtime_context: caikit.core.data_model.runtime_context.RuntimeServerContextType, tracer: opentelemetry.trace.Tracer)[source]
Helper to decorate a runtime context with a tracer if enabled
- caikit.runtime.trace.start_child_span(runtime_context: caikit.core.data_model.runtime_context.RuntimeServerContextType, span_name: str) Iterable[opentelemetry.trace.Span | _NoOpProxy][source]
Context manager that wraps start_as_current_span if enabled and tries to fetch a parent span from the runtime context
- caikit.runtime.trace._CONTEXT_TRACER_ATTR = '__tracer__'
- caikit.runtime.trace._load_tls_secret(tls_config_val: str) bytes[source]
If the config value points at a file, load it, otherwise assume it’s an inline string
- class caikit.runtime.trace._NoOpProxy[source]
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.
- __call__(*_, **__) _NoOpProxy[source]
- __enter__(*_, **__) _NoOpProxy[source]