vllm.tracing.otel ¶
Functions:
-
extract_trace_context–Extracts context from HTTP headers.
-
init_otel_tracer–Initializes the OpenTelemetry tracer provider.
-
init_otel_worker_tracer–Backend-specific initialization for OpenTelemetry in a worker process.
-
instrument_otel–Internal wrapper logic for sync and async functions.
-
manual_instrument_otel–Manually create and end a span with explicit timestamps.
-
propagate_trace_to_env–Temporarily injects the current OTel context into os.environ.
_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(headers) ¶
Extracts context from HTTP headers.
init_otel_tracer(instrumenting_module_name, otlp_traces_endpoint, extra_attributes=None) ¶
Initializes the OpenTelemetry tracer provider.
Source code in vllm/tracing/otel.py
init_otel_worker_tracer(instrumenting_module_name, process_kind, process_name) ¶
Backend-specific initialization for OpenTelemetry in a worker process.
Source code in vllm/tracing/otel.py
instrument_otel(func, span_name, attributes, record_exception) ¶
Internal wrapper logic for sync and async functions.
Source code in vllm/tracing/otel.py
manual_instrument_otel(span_name, start_time, end_time=None, attributes=None, context=None, kind=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.