litellm/tests/unit/integrations/otel
adityajoy-1902 20da5b949c
feat(proxy): return the W3C traceresponse header on traced responses (#42079)
* feat(proxy): expose trace ID response header

* style(otel): format trace correlation middleware

* test(otel): cover websocket trace middleware

* fix(otel): disable correlation on setup failure

* refactor(otel): inject instrumentation setup

* fix(proxy): drop a relayed upstream traceresponse when the gateway sends its own

* fix(proxy): preserve upstream traceresponse without gateway injection

* fix(proxy): replace relayed streaming traceresponse

* test(otel): cover trace response fallback paths

* test(proxy): cover the streaming pass-through relay when the gateway propagator is off

* fix(proxy): keep a relayed upstream traceresponse and stamp the call id on the server span

The gateway's response propagator now leaves a response that already carries an upstream traceresponse untouched, so pass-through, file content and plugin proxy routes return one header and untraced pass-through routes keep the upstream's. The per-helper strips are gone. The propagator also sets litellm.call_id on the server span from the response's x-litellm-call-id.

* fix(proxy): add traceresponse only to sampled HTTP responses, tuple headers and unhandled 500s included

* fix(proxy): write only traceresponse and link a relayed header from a restarted upstream trace

* fix(proxy): send traceresponse only from the proxy app and expose it through CORS only with OTel V2

* test(proxy): check the CORS expose list contains the UI headers instead of pinning its identity

* test(integration): check traceresponse names the gateway server span across routes, errors, pass-through and chaos

* test(integration): read the cache-hit spend row by response id and assert only the traceresponse expose entry

---------

Co-authored-by: adityajoy-1902 <bittu19jain@gmail.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-10-14 18:12:34 -07:00
..
__init__.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_db_endpoint.py fix(otel): name postgres service spans by operation and table (#44240) 2026-10-03 09:20:28 -07:00
test_langfuse_logger.py feat(otel)!: let a team capture_message_content override the global setting for its OTel v2 destination (#44264) 2026-10-10 13:52:32 -07:00
test_otel_v2_baggage.py fix(otel): emit OpenInference tool calls and metadata on Arize OTel v2 spans (#43698) 2026-10-08 15:53:07 -07:00
test_otel_v2_components.py fix(otel): nest cache spans under their operation and name service spans by purpose (#44150) 2026-10-03 09:20:27 -07:00
test_otel_v2_config_baggage_parenting_guardrails.py fix(otel): tolerate non-dict callback_settings.otel and ignore bare EXCLUDED_SERVICES env (#44086) 2026-10-02 12:36:46 -07:00
test_otel_v2_destinations.py test(unit): wait on the work itself instead of fixed sleeps (#46261) 2026-10-13 12:41:06 -07:00
test_otel_v2_dynamic.py feat(otel): add SigNoz preset for OpenTelemetry v2 (#43296) 2026-09-26 18:15:45 -07:00
test_otel_v2_emitter.py fix(otel): emit OpenInference tool calls and metadata on Arize OTel v2 spans (#43698) 2026-10-08 15:53:07 -07:00
test_otel_v2_logger.py feat(otel)!: let a team capture_message_content override the global setting for its OTel v2 destination (#44264) 2026-10-10 13:52:32 -07:00
test_otel_v2_metrics.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_otel_v2_mount.py feat(proxy): return the W3C traceresponse header on traced responses (#42079) 2026-10-14 18:12:34 -07:00
test_otel_v2_multibackend.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_otel_v2_presets.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
test_otel_v2_sources_of_truth.py feat(otel)!: let a team capture_message_content override the global setting for its OTel v2 destination (#44264) 2026-10-10 13:52:32 -07:00
test_otel_v2_vendor_mappers.py fix(otel): emit OpenInference tool calls and metadata on Arize OTel v2 spans (#43698) 2026-10-08 15:53:07 -07:00
test_runtime.py feat(otel): trace auto-router configuration and classifier failures (#44926) 2026-10-06 15:40:34 -07:00