Skip to content

Add extra_labelnames to PrometheusStatLogger for extensibility#42743

Open
vraiti wants to merge 2 commits into
vllm-project:mainfrom
vraiti:feat/metrics-extra-labels
Open

Add extra_labelnames to PrometheusStatLogger for extensibility#42743
vraiti wants to merge 2 commits into
vllm-project:mainfrom
vraiti:feat/metrics-extra-labels

Conversation

@vraiti
Copy link
Copy Markdown

@vraiti vraiti commented May 15, 2026

Purpose

Allow metrics to be extended with additional labels. This is useful when downstream use cases wish to collect vLLM metrics with enriched metadata

This came up in vLLM-Omni (vllm-project/vllm-omni#3362 (comment)): engines can be identified by two non-unique attributes: stage ID and replica ID. Adding extra_labelnames and extra_labelvalues to PrometheusStatLogger provides a clean mechanism for enriching vLLM metrics with this extra metadata.

Test Plan

Deploy vLLM-Omni with this patch of vLLM, using multiple replicas, and observe metric metadata correctly populating.

Test Result

Scraped from vLLM-Omni /metrics:
vllm_omni_metrics.txt


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

@vraiti vraiti requested a review from markmc as a code owner May 15, 2026 13:41
@github-actions
Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

PRs do not trigger a full CI run by default. Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

@mergify mergify Bot added the v1 label May 15, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for custom labels in the PrometheusStatLogger by adding extra_labelnames and extra_labelvalues parameters to its constructor. The implementation updates the metric initialization logic to dynamically include these additional labels across various engine metrics. Feedback was provided regarding a lack of validation for these new inputs; specifically, the code should ensure that both label names and values are provided together and that the number of values matches the number of names for each engine index to prevent ValueError or KeyError exceptions during metric registration.

Comment thread vllm/v1/metrics/loggers.py
Signed-off-by: vraiti <vraiti@redhat.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: vraiti <vraiti@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant