2121#include < utility>
2222
2323#include " ray/stats/metric.h"
24- #include " ray/stats/metric_defs.h"
2524#include " ray/util/time.h"
2625
2726namespace {
@@ -66,9 +65,9 @@ std::shared_ptr<StatsHandle> EventTracker::RecordStart(
6665 }
6766
6867 if (emit_metrics) {
69- ray::stats::STATS_operation_count .Record (1 , event_context_name.value_or (name));
70- ray::stats::STATS_operation_active_count .Record (curr_count,
71- event_context_name.value_or (name));
68+ operation_count_metric_ .Record (1 , {{ " Name " , event_context_name.value_or (name)}} );
69+ operation_active_gauge_metric_ .Record (curr_count,
70+ {{ " Name " , event_context_name.value_or (name)}} );
7271 }
7372
7473 return std::make_shared<StatsHandle>(
@@ -89,10 +88,11 @@ void EventTracker::RecordEnd(std::shared_ptr<StatsHandle> handle) {
8988
9089 if (handle->emit_stats ) {
9190 // Update event-specific stats.
92- ray::stats::STATS_operation_run_time_ms.Record (
93- execution_time_ns / 1000000 , handle->context_name .value_or (handle->event_name ));
94- ray::stats::STATS_operation_active_count.Record (
95- curr_count, handle->context_name .value_or (handle->event_name ));
91+ operation_run_time_ms_histogram_metric_.Record (
92+ execution_time_ns / 1000000 ,
93+ {{" Name" , handle->context_name .value_or (handle->event_name )}});
94+ operation_active_gauge_metric_.Record (
95+ curr_count, {{" Name" , handle->context_name .value_or (handle->event_name )}});
9696 }
9797
9898 handle->end_or_execution_recorded = true ;
@@ -135,13 +135,15 @@ void EventTracker::RecordExecution(const std::function<void()> &fn,
135135
136136 if (handle->emit_stats ) {
137137 // Update event-specific stats.
138- ray::stats::STATS_operation_run_time_ms.Record (
139- execution_time_ns / 1000000 , handle->context_name .value_or (handle->event_name ));
140- ray::stats::STATS_operation_active_count.Record (
141- curr_count, handle->context_name .value_or (handle->event_name ));
138+ operation_run_time_ms_histogram_metric_.Record (
139+ execution_time_ns / 1000000 ,
140+ {{" Name" , handle->context_name .value_or (handle->event_name )}});
141+ operation_active_gauge_metric_.Record (
142+ curr_count, {{" Name" , handle->context_name .value_or (handle->event_name )}});
142143 // Update global stats.
143- ray::stats::STATS_operation_queue_time_ms.Record (
144- queue_time_ns / 1000000 , handle->context_name .value_or (handle->event_name ));
144+ operation_queue_time_ms_histogram_metric_.Record (
145+ queue_time_ns / 1000000 ,
146+ {{" Name" , handle->context_name .value_or (handle->event_name )}});
145147 }
146148
147149 {
0 commit comments