-
Notifications
You must be signed in to change notification settings - Fork 7k
[RLlib] Add Prometheus metrics to the selected RLlib components #57932
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
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.
Code Review
This pull request introduces Prometheus metrics to various components within RLlib, enhancing observability and monitoring capabilities. The changes are extensive and systematically add timing and counting metrics using a new TimerAndPrometheusLogger and ray.util.metrics. The implementation is consistent and well-structured. My review focuses on improving code clarity and design.
Signed-off-by: joshlee <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]>
It used to be in 3 different groups, now unionized in 1. Signed-off-by: kevin <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]>
…nter (#56848) * Updated preprocessors to use a callback-based approach for stat computation. This improves code organization and reduces duplication. * Added ValueCounter aggregator and value_counts method to BlockColumnAccessor. Includes implementations for both Arrow and Pandas backends. <!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [ ] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [ ] 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/. - [ ] 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. - [ ] 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 - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: cem <[email protected]> Signed-off-by: cem-anyscale <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Kamil Kaczmarek <[email protected]>
…ging with Timer context manager Signed-off-by: Kamil Kaczmarek <[email protected]>
… only once." (#57917) This PR fixes the Ray check failure RayEventRecorder::StartExportingEvents() should be called only once.. The failure can occur in the following scenario: - The metric_agent_client successfully establishes a connection with the dashboard agent. In this case, RayEventRecorder::StartExportingEvents is correctly invoked to start sending events. - At the same time, the metric_agent_client exceeds its maximum number of connection retries. In this case, RayEventRecorder::StartExportingEvents is invoked again incorrectly, causing duplicate attempts to start exporting events. This PR introduces two fixes: - In metric_agent_client, the connection success and retry logic are now synchronized (previously they ran asynchronously, allowing both paths to trigger). - Do not call StartExportingEvents if the connection cannot be established. Test: - CI --------- Signed-off-by: Cuong Nguyen <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]>
## Description
Ray data can't serialize zero (byte) length numpy arrays:
```python3
import numpy as np
import ray.data
array = np.empty((2, 0), dtype=np.int8)
ds = ray.data.from_items([{"array": array}])
for batch in ds.iter_batches(batch_size=1):
print(batch)
```
What I expect to see:
```
{'array': array([], shape=(1, 2, 0), dtype=int8)}
```
What I see:
```
/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py:736: RuntimeWarning: invalid value encountered in scalar divide
offsets = np.arange(
2025-10-17 17:18:09,499 WARNING arrow.py:189 -- Failed to convert column 'array' into pyarrow array due to: Error converting data to Arrow: column: 'array', shape: (1, 2, 0), dtype: int8, data: []; falling back to serialize as pickled python objects
Traceback (most recent call last):
File "/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py", line 672, in from_numpy
return cls._from_numpy(arr)
^^^^^^^^^^^^^^^^^^^^
File "/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py", line 736, in _from_numpy
offsets = np.arange(
^^^^^^^^^^
ValueError: arange: cannot compute length
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py", line 141, in convert_to_pyarrow_array
return ArrowTensorArray.from_numpy(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris.ohara/Downloads/.venv/lib/python3.12/site-packages/ray/air/util/tensor_extensions/arrow.py", line 678, in from_numpy
raise ArrowConversionError(data_str) from e
ray.air.util.tensor_extensions.arrow.ArrowConversionError: Error converting data to Arrow: column: 'array', shape: (1, 2, 0), dtype: int8, data: []
2025-10-17 17:18:09,789 INFO logging.py:293 -- Registered dataset logger for dataset dataset_0_0
2025-10-17 17:18:09,815 WARNING resource_manager.py:134 -- ⚠️ Ray's object store is configured to use only 33.5% of available memory (2.0GiB out of 6.0GiB total). For optimal Ray Data performance, we recommend setting the object store to at least 50% of available memory. You can do this by setting the 'object_store_memory' parameter when calling ray.init() or by setting the RAY_DEFAULT_OBJECT_STORE_MEMORY_PROPORTION environment variable.
{'array': array([array([], shape=(2, 0), dtype=int8)], dtype=object)}
```
This PR fixes the issue so that zero-length arrays are serialized
correctly, and the shape and dtype is preserved.
## Additional information
This is `ray==2.50.0`.
---------
Signed-off-by: Chris O'Hara <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Kamil Kaczmarek <[email protected]>
use awscli directly; stop installing extra dependencies Signed-off-by: Lonnie Liu <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]>
Signed-off-by: joshlee <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]>
## Description Found this while reading the docs. Not sure what this "Note that" is referring to or why it is there. Signed-off-by: Max van Dijck <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]>
…#57891) Signed-off-by: Seiji Eicher <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]>
it should not run on macos intel silicon anymore Signed-off-by: Lonnie Liu <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]>
f71c2ae to
88f6e3f
Compare
ArturNiederfahrenhorst
left a comment
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.
stamp
Signed-off-by: Kamil Kaczmarek <[email protected]>
…o kk/rllib-prometheus-metrics
Signed-off-by: Kamil Kaczmarek <[email protected]>
Signed-off-by: Kamil Kaczmarek <[email protected]>
…project#57932) ## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]> Signed-off-by: kevin <[email protected]> Signed-off-by: cem <[email protected]> Signed-off-by: cem-anyscale <[email protected]> Signed-off-by: Cuong Nguyen <[email protected]> Signed-off-by: Chris O'Hara <[email protected]> Signed-off-by: Lonnie Liu <[email protected]> Signed-off-by: Max van Dijck <[email protected]> Signed-off-by: Seiji Eicher <[email protected]> Co-authored-by: Joshua Lee <[email protected]> Co-authored-by: Kevin H. Luu <[email protected]> Co-authored-by: cem-anyscale <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <[email protected]> Co-authored-by: Chris O'Hara <[email protected]> Co-authored-by: Lonnie Liu <[email protected]> Co-authored-by: Max van Dijck <[email protected]> Co-authored-by: Seiji Eicher <[email protected]> Signed-off-by: xgui <[email protected]>
## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]> Signed-off-by: kevin <[email protected]> Signed-off-by: cem <[email protected]> Signed-off-by: cem-anyscale <[email protected]> Signed-off-by: Cuong Nguyen <[email protected]> Signed-off-by: Chris O'Hara <[email protected]> Signed-off-by: Lonnie Liu <[email protected]> Signed-off-by: Max van Dijck <[email protected]> Signed-off-by: Seiji Eicher <[email protected]> Co-authored-by: Joshua Lee <[email protected]> Co-authored-by: Kevin H. Luu <[email protected]> Co-authored-by: cem-anyscale <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <[email protected]> Co-authored-by: Chris O'Hara <[email protected]> Co-authored-by: Lonnie Liu <[email protected]> Co-authored-by: Max van Dijck <[email protected]> Co-authored-by: Seiji Eicher <[email protected]> Signed-off-by: elliot-barn <[email protected]>
…project#57932) ## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]> Signed-off-by: kevin <[email protected]> Signed-off-by: cem <[email protected]> Signed-off-by: cem-anyscale <[email protected]> Signed-off-by: Cuong Nguyen <[email protected]> Signed-off-by: Chris O'Hara <[email protected]> Signed-off-by: Lonnie Liu <[email protected]> Signed-off-by: Max van Dijck <[email protected]> Signed-off-by: Seiji Eicher <[email protected]> Co-authored-by: Joshua Lee <[email protected]> Co-authored-by: Kevin H. Luu <[email protected]> Co-authored-by: cem-anyscale <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <[email protected]> Co-authored-by: Chris O'Hara <[email protected]> Co-authored-by: Lonnie Liu <[email protected]> Co-authored-by: Max van Dijck <[email protected]> Co-authored-by: Seiji Eicher <[email protected]>
…project#57932) ## Description This PR add prometheus metrics to the selected RLlib components. --------- Signed-off-by: joshlee <[email protected]> Signed-off-by: Kamil Kaczmarek <[email protected]> Signed-off-by: kevin <[email protected]> Signed-off-by: cem <[email protected]> Signed-off-by: cem-anyscale <[email protected]> Signed-off-by: Cuong Nguyen <[email protected]> Signed-off-by: Chris O'Hara <[email protected]> Signed-off-by: Lonnie Liu <[email protected]> Signed-off-by: Max van Dijck <[email protected]> Signed-off-by: Seiji Eicher <[email protected]> Co-authored-by: Joshua Lee <[email protected]> Co-authored-by: Kevin H. Luu <[email protected]> Co-authored-by: cem-anyscale <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Cuong Nguyen <[email protected]> Co-authored-by: Chris O'Hara <[email protected]> Co-authored-by: Lonnie Liu <[email protected]> Co-authored-by: Max van Dijck <[email protected]> Co-authored-by: Seiji Eicher <[email protected]> Signed-off-by: Aydin Abiar <[email protected]>
Description
This PR add prometheus metrics to the selected RLlib components.