Skip to content

[Core/Auth] Add RAY_AUTH_SKIP_METRICS to serve Ray's metrics endpoints without the auth token - #67264

Merged
rueian merged 2 commits into
ray-project:masterfrom
MortalHappiness:feat/token-auth-67251-skip-metrics
Oct 22, 2026
Merged

rueian merged 2 commits into
ray-project:masterfrom
MortalHappiness:feat/token-auth-67251-skip-metrics

Conversation

@MortalHappiness

Copy link
Copy Markdown
Member

Description

With token auth on, Ray's metrics endpoints require the token since #67128, and the only way to scrape them without one was to turn auth off for the whole cluster. Some scrapers can't send a bearer token, and some users protect the metrics port at the network layer instead. Setting RAY_AUTH_SKIP_METRICS=1 on every node now serves Ray's metrics endpoints (each node's metrics port, the dashboard head and both autoscaler monitors) without the token, while RAY_AUTH_MODE=token still protects everything else.

metrics request (get_token_auth_wsgi_app)
  auth off                       -> serve metrics (unchanged)
  RAY_AUTH_SKIP_METRICS=1        -> serve metrics without a token
  otherwise                      -> token check from #67128 (401 / 403 / serve)

All three metrics servers already go through get_token_auth_wsgi_app, so the skip is checked there once. The env var is read with env_bool, so true works as well as 1. Each Ray process reads it from its own environment, so it must be set wherever a node starts, for example in ray up start commands or KubeRay pod specs.

When the skip is also set in the shell that runs ray metrics launch-prometheus, it writes no authorization block and runs Prometheus with the bundled config unchanged. Its warning for when it finds no token now says that every Ray target returns 401 unless the cluster's nodes set RAY_AUTH_SKIP_METRICS=1, since the launcher can't see the nodes' setting. With auth off, the env var changes nothing.

Related issues

Closes #67251

Additional information

The opt-out is off unless the env var is set, so clusters that don't set it behave exactly as after #67128.

@MortalHappiness MortalHappiness added the go add ONLY when ready to merge, run all tests label Oct 22, 2026
@MortalHappiness
MortalHappiness marked this pull request as ready for review October 22, 2026 02:22
@MortalHappiness
MortalHappiness requested a review from a team as a code owner October 22, 2026 02:22

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces the RAY_AUTH_SKIP_METRICS environment variable, which allows users to bypass token authentication specifically for Ray's metrics endpoints while keeping other endpoints protected. The changes update the WSGI token authentication middleware, Prometheus configuration generation, and add corresponding unit and integration tests to verify this behavior. I have no feedback to provide as there are no review comments.

@ray-gardener ray-gardener Bot added the core Issues that should be addressed in Ray Core label Oct 22, 2026
@rueian
rueian merged commit a82c56e into ray-project:master Oct 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core/Auth] Add RAY_AUTH_SKIP_METRICS to serve Ray's metrics endpoints without the auth token

2 participants