Skip to content

[Grafana] add Cluster variable to enable filtering of different RayClusters on Kubernetes - #49498

Merged
jjyao merged 5 commits into
ray-project:masterfrom
win5923:ray_io_cluster/filter
Jan 9, 2025
Merged

jjyao merged 5 commits into
ray-project:masterfrom
win5923:ray_io_cluster/filter

Conversation

@win5923

@win5923 win5923 commented Dec 30, 2024 •

Copy link
Copy Markdown
Member

Why are these changes needed?

Addresses kuberay-project/kuberay#2502

Currently, the ray_io_cluster label is only available when using K8s with PodMonitor, but this does not affect users who only use Ray. Below are the results.

  • ray data dashboard from /tmp/ray/session_latest/metrics/grafana/dashboards
    image

  • ray core dashboard from /tmp/ray/session_latest/metrics/grafana/dashboards
    image

Related issue number

Closes kuberay-project/kuberay#2502

Checks

@win5923

win5923 commented Dec 30, 2024

Copy link
Copy Markdown
Member Author

@kevin85421 PTAL when you are free.

@win5923
win5923 force-pushed the ray_io_cluster/filter branch from a94f86c to c7065ca Compare December 30, 2024 16:10
@win5923
win5923 marked this pull request as draft December 31, 2024 00:57
@win5923
win5923 marked this pull request as ready for review December 31, 2024 00:57
@jcotant1 jcotant1 added the dashboard Issues specific to the Ray Dashboard label Dec 31, 2024
@kevin85421

Copy link
Copy Markdown
Member

also cc @MengjinYan @alanwguo who own observability / dashboard

@MengjinYan MengjinYan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Only minor comments on the python files.

We also need further review from the observability team on the dashboard json files.

@win5923
win5923 force-pushed the ray_io_cluster/filter branch 3 times, most recently from c76065e to b4e89a6 Compare January 4, 2025 04:14
@win5923
win5923 force-pushed the ray_io_cluster/filter branch from b4e89a6 to 894dff2 Compare January 4, 2025 04:22
@win5923
win5923 requested a review from kevin85421 January 4, 2025 08:47
@win5923 win5923 changed the title [Grafana] add ray_io_cluster varaible to enable filtering of different RayClusters on Kubernetes [Grafana] add RayClusterName varaible to enable filtering of different RayClusters on Kubernetes Jan 4, 2025

@MengjinYan MengjinYan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Probably need Alan's shipit as well.

@win5923
win5923 force-pushed the ray_io_cluster/filter branch 2 times, most recently from 38c6ce8 to eb47376 Compare January 7, 2025 13:00

@alanwguo alanwguo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please rename Cluster_Name to Cluster

@kevin85421 kevin85421 added the go add ONLY when ready to merge, run all tests label Jan 7, 2025
@win5923
win5923 force-pushed the ray_io_cluster/filter branch from eb47376 to 786546d Compare January 8, 2025 01:30
@win5923
win5923 force-pushed the ray_io_cluster/filter branch from 786546d to 4181daf Compare January 8, 2025 01:32
@win5923 win5923 changed the title [Grafana] add RayClusterName varaible to enable filtering of different RayClusters on Kubernetes [Grafana] add Cluster varaible to enable filtering of different RayClusters on Kubernetes Jan 8, 2025
@win5923 win5923 changed the title [Grafana] add Cluster varaible to enable filtering of different RayClusters on Kubernetes [Grafana] add Cluster variable to enable filtering of different RayClusters on Kubernetes Jan 8, 2025
@win5923

win5923 commented Jan 8, 2025

Copy link
Copy Markdown
Member Author

For ray users, the Cluster variable will not display anything, and it will have no impact on usage.
image

For kube-ray users, we can use the Cluster variable to filter metrics from different Ray Clusters.
image
image

@jjyao
jjyao merged commit 57d09ba into ray-project:master Jan 9, 2025
@win5923
win5923 deleted the ray_io_cluster/filter branch January 9, 2025 06:50
roshankathawate pushed a commit to roshankathawate/ray that referenced this pull request Jan 9, 2025
…Clusters on Kubernetes (ray-project#49498)

Signed-off-by: win5923 <[email protected]>
Signed-off-by: Roshan Kathawate <[email protected]>
HYLcool pushed a commit to HYLcool/ray that referenced this pull request Jan 13, 2025
…Clusters on Kubernetes (ray-project#49498)

Signed-off-by: win5923 <[email protected]>
Signed-off-by: lielin.hyl <[email protected]>
srinathk10 pushed a commit that referenced this pull request Feb 2, 2025
park12sj pushed a commit to park12sj/ray that referenced this pull request Mar 18, 2025
eicherseiji pushed a commit that referenced this pull request Jul 9, 2026
## Why are these changes needed?

Most Ray Grafana dashboards let users use `Cluster` to switch between
different Ray clusters. For example, I set `Cluster` to `kaihsun-test`
in the `Default Dashboard` to view the metrics related to my RayCluster.

<img width="1109" height="450" alt="image"
src="https://github.com/user-attachments/assets/0d46bd74-11a4-4c39-ab40-9302e109a130"
/>

However, the current `Serve LLM Dashboard` doesn't support `Cluster` as
a variable. See the screenshot below for an example. Therefore, I can
only see the serve deployment name, and I don't know which KubeRay
RayService the deployment is from.

<img width="1470" height="451" alt="image"
src="https://github.com/user-attachments/assets/25c019e5-30b0-4942-902c-9eb3efe2abe2"
/>

This PR adds `Cluster` as a variable, and the change is similar to
#49498. See the screenshot below
for an example.

<img width="1471" height="408" alt="Screenshot 2026-07-08 at 11 49
14 PM"
src="https://github.com/user-attachments/assets/cbc154d8-0616-407f-a7d6-009016b7fb45"
/>

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've signed off every commit (by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [x] I've added any new APIs to the API Reference. For example, if I
added a method in Tune, I've added it in `doc/source/tune/api/` under
the corresponding `.rst` file.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [x] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(

Signed-off-by: Kai-Hsun Chen <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…roject#64596)

## Why are these changes needed?

Most Ray Grafana dashboards let users use `Cluster` to switch between
different Ray clusters. For example, I set `Cluster` to `kaihsun-test`
in the `Default Dashboard` to view the metrics related to my RayCluster.

<img width="1109" height="450" alt="image"
src="https://github.com/user-attachments/assets/0d46bd74-11a4-4c39-ab40-9302e109a130"
/>

However, the current `Serve LLM Dashboard` doesn't support `Cluster` as
a variable. See the screenshot below for an example. Therefore, I can
only see the serve deployment name, and I don't know which KubeRay
RayService the deployment is from.

<img width="1470" height="451" alt="image"
src="https://github.com/user-attachments/assets/25c019e5-30b0-4942-902c-9eb3efe2abe2"
/>

This PR adds `Cluster` as a variable, and the change is similar to
ray-project#49498. See the screenshot below
for an example.

<img width="1471" height="408" alt="Screenshot 2026-07-08 at 11 49
14 PM"
src="https://github.com/user-attachments/assets/cbc154d8-0616-407f-a7d6-009016b7fb45"
/>

## Related issue number

<!-- For example: "Closes ray-project#1234" -->

## Checks

- [x] I've signed off every commit (by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [x] I've added any new APIs to the API Reference. For example, if I
added a method in Tune, I've added it in `doc/source/tune/api/` under
the corresponding `.rst` file.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [x] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(

Signed-off-by: Kai-Hsun Chen <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: 400Ping <[email protected]>
MengjinYan pushed a commit that referenced this pull request Nov 3, 2026
…na dashboard (#67470)

## Problem

- The Data LLM panel queries have no `{global_filters}` placeholder, so
no global filter ever reaches the panels. Filters set through
`RAY_GRAFANA_DATA_LLM_DASHBOARD_GLOBAL_FILTERS` only reach the model and
worker dropdowns.
- The dashboard has no `SessionName` or `Cluster` dropdown, unlike the
Data, Default and Serve dashboards.
- So with Worker ID set to All, every panel mixes vLLM engines from
every cluster that Prometheus scrapes. Choosing a cluster does not
narrow the panels.

## Change

- Add `{global_filters}` to every Data LLM panel selector (38 queries).
- Set `standard_global_filters` to the Data dashboard's filters:
`SessionName=~"$SessionName"` and `ray_io_cluster=~"$Cluster"`.
- Add `SessionName` and `Cluster` dropdowns, and narrow the model and
worker dropdowns to the selected session and cluster.

```
              before                                  after
SessionName ─ (no dropdown)            SessionName ─┬─> model & worker dropdowns
Cluster ───── (no dropdown)            Cluster ─────┤      and every panel selector
override ───> model & worker           override ────┘
              dropdowns only
```

Repro, which prints how many panel queries carry each filter and the
dropdown names:

```bash
RAY_GRAFANA_DATA_LLM_DASHBOARD_GLOBAL_FILTERS='ClusterId=~"$ClusterId"' python -c '
import json
from ray.dashboard.modules.metrics.grafana_dashboard_factory import generate_data_llm_grafana_dashboard
d = json.loads(generate_data_llm_grafana_dashboard()[0])
exprs = [t["expr"] for p in d["panels"] for t in p.get("targets", [])]
print(len(exprs), sum("ClusterId=~" in e for e in exprs), sum("ray_io_cluster=~" in e for e in exprs))
print([v["name"] for v in d["templating"]["list"]])'
```

| | Before | After |
|---|---|---|
| Panel queries carrying the override filter | 0 of 38 | 38 of 38 |
| Engines in Cache Utilization for one cluster, Worker ID = All (one
real job) | 13 (5 from other jobs) | 8 |

### Before / after

Cache Utilization on a managed Grafana, with one job's cluster selected
and Worker ID = All. Before, engines from another job appear from 14:16;
after, only this job's 8 engines appear, from 14:37.

**Before:**

<img width="1525" height="784" alt="1-cache-utilization-before"
src="https://github.com/user-attachments/assets/6dcb3e95-eb82-44ad-9b58-ecb2cf99d000"
/>


**After:**

<img width="1478" height="812"
alt="1-cache-utilization-after-session-cluster"
src="https://github.com/user-attachments/assets/c9c58477-7793-4d48-a3c6-894b7bcdd1ca"
/>

## Decisions to confirm

- The `SessionName` dropdown lists sessions from a vLLM metric
(`ray_vllm_request_prompt_tokens_sum`) instead of
`ray_data_output_bytes`. It then shows only sessions that ran vLLM.
- The `SessionName` "All" value is `.*` rather than the Data dashboard's
`.+`, so series without the label still show.

## Related

- Not a duplicate: no open issue or PR covers this. #64596 (Serve LLM)
and #49498 applied the same `Cluster` filter pattern to other
dashboards.
- Tests: `pytest python/ray/tests/test_metrics_head.py`: 15 passed, with
9 new Data LLM cases. Run on a checkout that matches the latest nightly
wheel; on current master, the 4 cluster-start tests need a nightly that
includes #67258.
- AI assistance: written with Claude Code. I reviewed every line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Marwan Sarieddine <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-backlog dashboard Issues specific to the Ray Dashboard go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Multiple RayCluster CRs share the same Grafana

7 participants