-
Notifications
You must be signed in to change notification settings - Fork 567
[Feature] metrics support #3534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Conflicts: lmdeploy/messages.py lmdeploy/pytorch/engine/engine.py lmdeploy/pytorch/engine/engine_instance.py lmdeploy/pytorch/messages.py lmdeploy/pytorch/paging/scheduler.py
Conflicts: lmdeploy/serve/openai/api_server.py
the design is changed
- job_name: lmdeploy | ||
static_configs: | ||
- targets: | ||
- '$host_ip:$api_server_port1' # <= Modify this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we config all dp server urls in here and show data in grafana board?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Objective
Align with vLLM v1 metrics system and beyond. Here are several key alignments
-- Uses
time.perf_counter()
for interval calculations (avoids clock drift issues).-- Gauges: Active requests, cache usage, etc
-- Counters: Token totals, request success / failure counts, etc
-- Histograms: TTFT (Time-To-First-Token), TPOT (Inter-Token Latency), end-to-end latency, etc
-- CLI logging
-- Prometheus & Grafana
We only record critical timestamps and events inside the engine process without further processing. Heavy-weight metrics calculations or publishing are separated from the main loop to minimize overhead.
For convenient Grafana visualization and usage, we align with SGLang.
TODO
prometheus_client
, only install / import when neededFeature: Expert information collections (deferred in another PR)generate()
and engine_async_loop_main()
time.perf_counter()
Usage
Start the server with
--enable-metrics
Metrics Publishing - Logging

With
--enable-metrics
, key metrics (e.g., finished / unfinished / running / waiting requests, token throughputs, cache usage) are printed to the terminal every 10 seconds.Metrics Publishing - Prometheus & Grafana



-- Raw Metrics
Access the raw Prometheus metrics via http://localhost:23333/metrics/ .
You can also curl the metrics endpoint
curl http:///localhost:23333/metrics/
to view raw Prometheus results. No extra setups are required for this step.-- Prometheus Panel
Access the Prometheus panel via http://localhost:9090 (
9090
is the current default port for the Prometheus panel). You need extra setups to access the Prometheus panel; please check the user guide for details.-- Grafana Panel
Access the Grafana panel via http://localhost:3000 (
3000
is the current default port for the Grafana panel). You need extra setups to access the Grafana panel; please check the user guide for details.Request Timeline
The following diagram depicts how we define and calculate time intervals during the request lifecycle, which adheres to vLLM.

Performance Impacts
Tested with Qwen2.5-0.5B / Qwen2.5-7B / Qwen2.5-32B, no obvious performance impacts. (Requires #3627)
Check the following tables for output throughput details. We conducted tests using 1,000 prompts, with input length 1k and output length 1k. Each model was tested three times to reduce the impact of performance fluctuations.
Related Issues & PR