Skip to content

Conversation

@daniel-salib
Copy link
Contributor

@daniel-salib daniel-salib commented Mar 26, 2025

Track error count at the http service level in the app state.

Register as aggregated_error_count in the prometheus metrics

@github-actions
Copy link

👋 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.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

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.

🚀

@daniel-salib daniel-salib marked this pull request as ready for review March 26, 2025 05:40
@mergify mergify bot added the frontend label Mar 26, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit of a noob question – I'm not super familiar with FastAPI – but would it be cleaner to track 4xx/5xx responses via some custom middleware (e.g., app.add_middleware(ResponseCodeMiddleware))? That way, it's easier to reason about the code and make sure we don't miss a spot where the counter should be incremented.

Copy link
Contributor Author

@daniel-salib daniel-salib Mar 26, 2025

Choose a reason for hiding this comment

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

yea you're right, middleware is the cleanest way to handle this - however we've previously found when developing load_aware_call that the middleware approach negatively impacts performance. When running the benchmark with the decorator instead we don't see the same performance hit

"If set to True, enable tracking server_load_metrics in the app state."
)
parser.add_argument(
"--enable-http-middleware",
Copy link
Contributor

Choose a reason for hiding this comment

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

I view http-middleware decorator as a code structure extension instead of feature extension. No need to have a explicit control for this?
The feature we could control is the counter/logging, but I feel it's pretty standard and we should just enable it for all use cases? cc: @simon-mo

@simon-mo
Copy link
Collaborator

cc @markmc
Should we consider external package like this? https://github.com/stephenhillier/starlette_exporter

@daniel-salib
Copy link
Contributor Author

cc @markmc Should we consider external package like this? https://github.com/stephenhillier/starlette_exporter

prometheus_fastapi_instrumentator seems more popular and is already included in the common vllm requirements

I went ahead and implemented it here:
#15657

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.

5 participants