You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[core][metric] Redefine gcs STATS using metric interface (#56201)
This PR is in the series of unifying all metric definition infra.
This PR migrates all GCS metrics to use the metric interface. It does
that by creating the metric object inside gcs_server and pass them down
as interfaces to sub-components.
Purely refactoring code and repetitive patterns, easier to review than
the number of file changed tells you.
Test:
- CI
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Refactors GCS and core worker to use injected MetricInterface objects
for all metrics, adding new metric helpers and rewiring constructors,
server startup, storage client, and tests accordingly.
>
> - **Metrics Infrastructure**:
> - Introduce metric helpers in `src/ray/common/metrics.h` and
`src/ray/gcs/metrics.h` (gauges/histograms/counters for actors, jobs,
placement groups, task events, and GCS storage).
> - Replace direct `stats` usage with `MetricInterface` across GCS and
core worker; rename helpers (e.g., `GetTaskMetric` ->
`GetTaskByStateGaugeMetric`, `GetRayEventRecorderDroppedEventsMetric` ->
`GetRayEventRecorderDroppedEventsCounterMetric`).
> - **GCS Server Refactor**:
> - `GcsServer` now constructs/accepts metric instances and passes them
to subcomponents via `Start`/`DoStart` and init methods.
> - `GcsActorManager`, `GcsJobManager`, `GcsPlacementGroupManager`, and
`GcsTaskManager` constructors updated to receive and record via
`MetricInterface`.
> - `ObservableStoreClient` wraps delegate and records storage metrics
via injected interfaces.
> - **Core Worker**:
> - `TaskCounter` and `CoreWorker` updated to use task/actor state
gauges via injected `MetricInterface`.
> - **Tests/Mocks/Build**:
> - Update mocks and tests to use
`FakeGauge`/`FakeCounter`/`FakeHistogram`; validate metric tags/values.
> - Add Bazel targets/deps for new metric headers and fakes; minor BUILD
wiring adjustments.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
bd5ff5a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Signed-off-by: Cuong Nguyen <can@anyscale.com>
0 commit comments