The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(otel): cover websocket trace propagation with forwarding on and off
shivam7ba073aa2668
diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py b/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.pyindex a21f695493b..0603b5cb2ff 100644--- a/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py+++ b/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py@@ -4912,7 +4912,8 @@ async def test_websocket_passthrough_forwards_non_ascii_first_frame():@pytest.mark.asyncio-async def test_websocket_passthrough_propagates_active_trace_context(monkeypatch):[email protected]("forward_headers", [True, False])+async def test_websocket_passthrough_propagates_active_trace_context(monkeypatch, forward_headers: bool):from opentelemetry.sdk.trace import TracerProviderfrom opentelemetry.trace import get_current_spanfrom opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator@@ -4959,14 +4960,14 @@ async def test_websocket_passthrough_propagates_active_trace_context(monkeypatchtarget="wss://upstream.example.test/v1/realtime",custom_headers={},user_api_key_dict=UserAPIKeyAuth(),- forward_headers=True,+ forward_headers=forward_headers,endpoint="/realtime",accept_websocket=True,)propagated = get_current_span(TraceContextTextMapPropagator().extract(captured["headers"]))assert propagated.get_span_context().trace_id == span.get_span_context().trace_id- assert captured["headers"]["authorization"] == "Bearer client"+ assert captured["headers"].get("authorization") == ("Bearer client" if forward_headers else None)class ClosingUpstreamWebSocket: