corvix.observability.tracing¶
Optional OpenTelemetry tracing for Corvix.
Tracing is opt-in: it requires the otel extra to be installed and
CORVIX_OTEL_ENABLED to be truthy. When either is missing, span() is a
zero-overhead no-op so call sites never need to branch on availability.
The OTLP exporter honours the standard OTEL_* environment variables (e.g.
OTEL_EXPORTER_OTLP_ENDPOINT); only CORVIX_OTEL_ENABLED and an optional
service-name override are Corvix-specific.
Attributes¶
Functions¶
|
|
|
Return whether tracing has been successfully configured. |
|
Configure the global tracer provider when tracing is requested. |
|
Start a span as the current context, or no-op when tracing is disabled. |
Module Contents¶
- corvix.observability.tracing.is_enabled() bool[source][source]¶
Return whether tracing has been successfully configured.
- corvix.observability.tracing.setup_tracing(service_name: str | None = None) bool[source][source]¶
Configure the global tracer provider when tracing is requested.
Returns
Truewhen tracing is active afterwards. A no-op (returningFalse) whenCORVIX_OTEL_ENABLEDis not truthy or theotelextra is not installed. Safe to call multiple times.
- corvix.observability.tracing.span(name: str, attributes: collections.abc.Mapping[str, Any] | None = None) collections.abc.Iterator[Any][source][source]¶
Start a span as the current context, or no-op when tracing is disabled.
Yields the active span (or
Nonewhen disabled). Exceptions raised in the block are recorded on the span and re-raised.