litellm/tests/enterprise/litellm_enterprise/integrations
devin-ai-integration[bot] a23aa47e1e
feat(prometheus): add global exclude_metrics and exclude_labels options (#34201)
* feat(prometheus): add global exclude_metrics and exclude_labels options

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(prometheus): apply global exclude_labels to hard-coded metric labels

Metrics built with hard-coded labelnames lists (guardrail, provider budget,
callback, managed file/batch, batch cost) bypassed prometheus_exclude_labels
because only labels resolved via get_labels_for_metric were filtered. Route
every metric through a factory that strips excluded labels at construction and
proxies labels() so excluded labels are dropped at emission too. Add the
non-enum hard-coded labels (guardrail_name, status, error_type, hook_type,
purpose, file_type, result) to exclude-config validation so they are accepted
instead of raising ValueError at logger init.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(prometheus): simplify exclude-label factory to the kwargs labelnames path

All metric definitions pass labelnames as a keyword argument, and the only
metrics that pass it positionally resolve their labels through
get_labels_for_metric, which already drops excluded labels, so they never carry
an excluded label into the factory. Drop the unreachable positional
reconstruction branch.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* chore: re-trigger CI (flaky unrelated bedrock agentcore test)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(prometheus): use immutable constructions to satisfy LIT002 budget

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: shivam <shivam@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-01 11:52:27 -07:00
..
test_custom_guardrail.py feat: allow multiple calls from tags 2026-03-07 11:24:18 +05:30
test_prometheus.py feat(prometheus): add global exclude_metrics and exclude_labels options (#34201) 2026-08-01 11:52:27 -07:00
test_prometheus_unit_tests.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00