-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Refactor Prometheus and Add Request Level Metrics #2316
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
Changes from 42 commits
56d398b
2239e73
1e6ad74
10d5353
5199cdd
f69f639
0c24fc3
874df77
63aecbc
7782baf
92dda00
6e7f715
67aaed7
69093b2
114a4c9
f68f4f7
ce0534f
05b3206
450dfc2
0e65765
9fee85f
9cdd6c4
d1dcac6
a42c3ca
e2207db
a90d447
567d32f
f363df7
519581b
551a3c0
1f38f15
32d2259
14f36ae
6a81d89
3a28d48
9c465c7
d800e7f
f117808
30e88e4
6bbba50
3cff058
38578d3
629e1d3
cef0432
dc4eaa5
d517924
0b726c5
9b76d60
6fed96c
7f1379b
3c18cb5
6b9afa2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,72 @@ | ||||||||||||||||||||||||||||||||||||||
| # vLLM + Prometheus/Grafana | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| This is a simple example that shows you how to connect vLLM metric logging to the Prometheus/Grafana stack. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| For this example, we launch Prometheus and Grafana via Docker. Install: | ||||||||||||||||||||||||||||||||||||||
| - [`docker`](https://docs.docker.com/engine/install/) | ||||||||||||||||||||||||||||||||||||||
| - [`docker compose`](https://docs.docker.com/compose/install/linux/#install-using-the-repository) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ### Launch | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Prometheus metric logging is enabled by default in the OpenAI-compatible server. Launch via the entrypoint: | ||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||
| python3 ../../vllm/entrypoints/openai/api_server.py \ | ||||||||||||||||||||||||||||||||||||||
robertgshaw2-redhat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||
| --model mistralai/Mistral-7B-v0.1 \ | ||||||||||||||||||||||||||||||||||||||
| --max-model-len 2048 \ | ||||||||||||||||||||||||||||||||||||||
| --disable-log-requests | ||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Launch Prometheus and Grafana servers with `docker compose`: | ||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||
| docker compose up | ||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Submit some sample requests to the server: | ||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||
| wget https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json | ||||||||||||||||||||||||||||||||||||||
| python3 ../../benchmarks/benchmark_serving.py \ | ||||||||||||||||||||||||||||||||||||||
| --model mistralai/Mistral-7B-v0.1 \ | ||||||||||||||||||||||||||||||||||||||
| --tokenizer mistralai/Mistral-7B-v0.1 \ | ||||||||||||||||||||||||||||||||||||||
| --endpoint /v1/completions \ | ||||||||||||||||||||||||||||||||||||||
| --dataset ShareGPT_V3_unfiltered_cleaned_split.json \ | ||||||||||||||||||||||||||||||||||||||
| --num-prompts 200 \ | ||||||||||||||||||||||||||||||||||||||
| --request-rate 3.0 | ||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Navigating to [`http://localhost:8000/metrics`](http://localhost:8000/metrics) will show the raw Prometheus metrics being exposed by vLLM. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ### Grafana Dashboard | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Navigate to [`http://localhost:3000`](http://localhost:3000). Log in with the default username (`admin`) and password (`admin`). | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| #### Add Prometheus Data Source | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Navigate to [`http://localhost:3000/connections/datasources/new`](http://localhost:3000/connections/datasources/new) and select Prometheus. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| On Prometheus configuration page, we need to add the `Prometheus Server URL` in `Connection`. For this setup, Grafana and Prometheus are running in separate containers, so we need the IP address of the Prometheus container. Run the following to lookup the name of your Prometheus container: | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||
| docker container ls | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| >> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||||||||||||||||||||||||||||||||||||||
| >> 6b2eb9d7aa99 grafana/grafana:latest "/run.sh" 45 minutes ago Up 45 minutes 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp production_monitoring-grafana-1 | ||||||||||||||||||||||||||||||||||||||
| >> d9b32bc6a02b prom/prometheus:latest "/bin/prometheus --c…" 45 minutes ago Up 45 minutes 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp production_monitoring-prometheus-1 | ||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Run the following to lookup the IP address (replace `production_monitoring-prometheus-1` with your container name): | ||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||
| docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' production_monitoring-prometheus-1 | ||||||||||||||||||||||||||||||||||||||
| >> 172.18.0.2 | ||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| So, in our case, the `Prometheus Server URL` should be: `http://172.18.0.2:9090`. | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| On Prometheus configuration page, we need to add the `Prometheus Server URL` in `Connection`. For this setup, Grafana and Prometheus are running in separate containers, so we need the IP address of the Prometheus container. Run the following to lookup the name of your Prometheus container: | |
| ```bash | |
| docker container ls | |
| >> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
| >> 6b2eb9d7aa99 grafana/grafana:latest "/run.sh" 45 minutes ago Up 45 minutes 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp production_monitoring-grafana-1 | |
| >> d9b32bc6a02b prom/prometheus:latest "/bin/prometheus --c…" 45 minutes ago Up 45 minutes 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp production_monitoring-prometheus-1 | |
| ``` | |
| Run the following to lookup the IP address (replace `production_monitoring-prometheus-1` with your container name): | |
| ```bash | |
| docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' production_monitoring-prometheus-1 | |
| >> 172.18.0.2 | |
| ``` | |
| So, in our case, the `Prometheus Server URL` should be: `http://172.18.0.2:9090`. | |
| On Prometheus configuration page, we need to add the `Prometheus Server URL` in `Connection`. For this setup, Grafana and Prometheus are running in separate containers, but Docker creates DNS name for each containers. You can just use `http://prometheus:9090`. |
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.
lol this is so much better
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.
ill just double check this works
robertgshaw2-redhat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # docker-compose.yaml | ||
| version: "3" | ||
|
|
||
| services: | ||
| prometheus: | ||
| image: prom/prometheus:latest | ||
| extra_hosts: | ||
| - "host.docker.internal:host-gateway" # allow a direct connection from container to the local machine | ||
| ports: | ||
| - "9090:9090" # the default port used by Prometheus | ||
| volumes: | ||
| - ${PWD}/prometheus.yaml:/etc/prometheus/prometheus.yml # mount Prometheus config file | ||
|
|
||
| grafana: | ||
| image: grafana/grafana:latest | ||
| depends_on: | ||
| - prometheus | ||
| ports: | ||
| - "3000:3000" # the default port used by Grafana | ||
robertgshaw2-redhat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.