vllm.tracing.otel ¶
_get_smart_context ¶
Determines the parent context. 1. If a Span is already active in this process, use it. 2. If not, extract from os.environ, handling the case-sensitivity mismatch.
Source code in vllm/tracing/otel.py
extract_trace_context ¶
Extracts context from HTTP headers.
init_otel_tracer ¶
init_otel_tracer(
instrumenting_module_name: str,
otlp_traces_endpoint: str,
extra_attributes: dict[str, str] | None = None,
) -> Tracer
Initializes the OpenTelemetry tracer provider.
Source code in vllm/tracing/otel.py
init_otel_worker_tracer ¶
init_otel_worker_tracer(
instrumenting_module_name: str,
process_kind: str,
process_name: str,
) -> Tracer
Backend-specific initialization for OpenTelemetry in a worker process.
Source code in vllm/tracing/otel.py
instrument_otel ¶
Internal wrapper logic for sync and async functions.
Source code in vllm/tracing/otel.py
manual_instrument_otel ¶
manual_instrument_otel(
span_name: str,
start_time: int,
end_time: int | None = None,
attributes: dict[str, Any] | None = None,
context: Context | None = None,
kind: Any = None,
)
Manually create and end a span with explicit timestamps.
Source code in vllm/tracing/otel.py
propagate_trace_to_env ¶
Temporarily injects the current OTel context into os.environ. This ensures that any subprocesses (like vLLM workers) spawned within this context inherit the correct traceparent.