Skip to content

added extraction of top level metadata for custom lables in prometheu…#18087

Merged
krrishdholakia merged 1 commit intoBerriAI:litellm_staging_12_17_2025from
shivamrawat1:feat/top-level-metadata-for-custom-labels
Dec 17, 2025
Merged

added extraction of top level metadata for custom lables in prometheu…#18087
krrishdholakia merged 1 commit intoBerriAI:litellm_staging_12_17_2025from
shivamrawat1:feat/top-level-metadata-for-custom-labels

Conversation

@shivamrawat1
Copy link
Collaborator

Relevant issues

The custom_prometheus_metadata_labels feature could only extract labels from nested metadata dictionaries (requester_metadata, user_api_key_auth_metadata), but not from top-level metadata fields like requester_ip_address.

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • [] My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
✅ Test

Changes

Modified litellm/integrations/prometheus.py to include top-level metadata fields in combined_metadata. The code now:

  • Extracts all top-level non-dictionary fields from metadata
  • Merges them with nested metadata contents (requester_metadata and user_api_key_auth_metadata)

This enables get_custom_labels_from_metadata() to access fields like requester_ip_address directly from top-level metadata.

@vercel
Copy link

vercel bot commented Dec 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Dec 17, 2025 1:27am

@CLAassistant
Copy link

CLAassistant commented Dec 17, 2025

CLA assistant check
All committers have signed the CLA.

@krrishdholakia krrishdholakia changed the base branch from main to litellm_staging_12_17_2025 December 17, 2025 05:47
@krrishdholakia krrishdholakia merged commit 14a4a9c into BerriAI:litellm_staging_12_17_2025 Dec 17, 2025
4 of 7 checks passed
ishaan-jaff added a commit that referenced this pull request Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants