Repository navigation
[Data] Make distribution metric export directly testable - #65750
bveeramani merged 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors Prometheus metric creation and recording in Ray Data. It introduces helper functions _create_prometheus_metric and _record_prometheus_metric to handle different metric types (Gauge, Histogram, Counter, and Distribution) and defines a new DistributionStats TypedDict along with corresponding type aliases. Unit tests are also added to verify these helpers. The reviewer identified a potential runtime TypeError in _record_prometheus_metric when value is None, suggesting an early return guard to prevent passing None to the underlying Prometheus client.
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
Signed-off-by: viiccwen <[email protected]>
Head branch was pushed to by a user without write access
1d0a87d to
132d0a6
Compare
…#65750) ## Description Refactor Ray Data's Prometheus metric export logic so distribution metrics can be tested without accessing the private `__ray_metadata__` attribute of the remote StatsActor. The changes: - Define the dictionary schema returned by `DistributionTracker.as_dict()`. - Extract Prometheus metric creation and recording into helper functions. - Add direct tests for creating and updating distribution Gauges. This is a follow-up to ray-project#65666. - Use real `Gauge` instances in the metric creation test and inspect their public `info` property. ## Duplicate work This PR is a focused follow-up to ray-project#65666 and does not duplicate another implementation. ## Tests - `pytest python/ray/data/tests/test_stats.py -q -k 'test_create_distribution_prometheus_metric or test_record_distribution_prometheus_metric'` — 2 passed, 108 deselected. - `pre-commit run --files python/ray/data/tests/test_stats.py` — passed. AI assistance was used. The submitter reviewed the changes and test results. Signed-off-by: viiccwen <[email protected]>
Description
Refactor Ray Data's Prometheus metric export logic so distribution metrics can be tested without accessing the private
__ray_metadata__attribute of the remote StatsActor.The changes:
DistributionTracker.as_dict().Gaugeinstances in the metric creation test and inspect their publicinfoproperty.Duplicate work
This PR is a focused follow-up to #65666 and does not duplicate another implementation.
Tests
pytest python/ray/data/tests/test_stats.py -q -k 'test_create_distribution_prometheus_metric or test_record_distribution_prometheus_metric'— 2 passed, 108 deselected.pre-commit run --files python/ray/data/tests/test_stats.py— passed.AI assistance was used. The submitter reviewed the changes and test results.