litellm/tests/test_litellm/integrations/datadog
yucheng-berri e2741b5643
fix(datadog_llm_obs): keep the guardrail audit record under message redaction (#39702)
* fix(datadog_llm_obs): keep the guardrail audit record under message redaction

Redaction nulled `guardrail_information` on the span whole, so an operator
running `turn_off_message_logging` (or a caller sending
`x-litellm-enable-message-redaction`) lost the record of which guardrails ran,
what they returned, and what they masked. Four of the record's fields can quote
the prompt; the rest report what the guardrail decided without reproducing it.

Replace only those four, the way
`_sanitize_guardrail_information_for_spend_logs` already does for spend logs,
and declare the field list once in `litellm/types/utils.py` so both readers
share it.

* fix(datadog_llm_obs): keep a lone guardrail record, and test through the span

Review round 1.

A guardrail that writes the metadata key itself leaves a single record where
the type says list, which Prometheus already normalizes at
`_guardrail_overhead_seconds`. Redaction dropped that shape and the latency
extraction raised on it, so the span was lost outright. Normalize once and use
it in both places.

The new tests now drive `create_llm_obs_payload` instead of reading the module's
private helpers and the record's declared field names.
2026-09-04 18:24:16 -07:00
..
test_datadog_cost_management.py test(datadog): restore an empty DD_API_KEY instead of unsetting it (#37832) 2026-08-21 20:39:07 -07:00
test_datadog_llm_obs.py fix(datadog_llm_obs): keep the guardrail audit record under message redaction (#39702) 2026-09-04 18:24:16 -07:00
test_datadog_llm_obs_agent.py feat(datadog): add agent support for LLM Observability (#19574) 2026-01-22 19:49:22 -08:00
test_datadog_logger_batching.py fix(datadog): split log batches proactively under intake payload limits (#32860) 2026-07-10 20:54:42 -07:00
test_datadog_metrics.py test(datadog): restore an empty DD_API_KEY instead of unsetting it (#37832) 2026-08-21 20:39:07 -07:00
test_datadog_tags_regression.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_datadog_team_handler.py fix(datadog): read team callback dd_* params from kwargs instead of blocked dynamic params (#35115) (#35687) 2026-08-03 16:19:56 -07:00