@@ -167,8 +167,10 @@ JobID GetProcessJobID(const CoreWorkerOptions &options) {
167167 return options.job_id ;
168168}
169169
170- TaskCounter::TaskCounter (ray::observability::MetricInterface &task_by_state_counter)
171- : task_by_state_counter_(task_by_state_counter) {
170+ TaskCounter::TaskCounter (ray::observability::MetricInterface &task_by_state_counter,
171+ ray::observability::MetricInterface &actor_by_state_counter)
172+ : task_by_state_counter_(task_by_state_counter),
173+ actor_by_state_counter_ (actor_by_state_counter) {
172174 counter_.SetOnChangeCallback (
173175 [this ](const std::tuple<std::string, TaskStatusType, bool >
174176 &key) ABSL_EXCLUSIVE_LOCKS_REQUIRED (&mu_) mutable {
@@ -234,26 +236,26 @@ void TaskCounter::RecordMetrics() {
234236 } else {
235237 idle = 1.0 ;
236238 }
237- ray::stats::STATS_actors .Record (idle,
238- {{" State" , " IDLE" },
239- {" Name" , actor_name_},
240- {" Source" , " executor" },
241- {" JobId" , job_id_}});
242- ray::stats::STATS_actors .Record (running,
243- {{" State" , " RUNNING_TASK" },
244- {" Name" , actor_name_},
245- {" Source" , " executor" },
246- {" JobId" , job_id_}});
247- ray::stats::STATS_actors .Record (in_get,
248- {{" State" , " RUNNING_IN_RAY_GET" },
249- {" Name" , actor_name_},
250- {" Source" , " executor" },
251- {" JobId" , job_id_}});
252- ray::stats::STATS_actors .Record (in_wait,
253- {{" State" , " RUNNING_IN_RAY_WAIT" },
254- {" Name" , actor_name_},
255- {" Source" , " executor" },
256- {" JobId" , job_id_}});
239+ actor_by_state_counter_ .Record (idle,
240+ {{" State" sv , " IDLE" },
241+ {" Name" sv , actor_name_},
242+ {" Source" sv , " executor" },
243+ {" JobId" sv , job_id_}});
244+ actor_by_state_counter_ .Record (running,
245+ {{" State" sv , " RUNNING_TASK" },
246+ {" Name" sv , actor_name_},
247+ {" Source" sv , " executor" },
248+ {" JobId" sv , job_id_}});
249+ actor_by_state_counter_ .Record (in_get,
250+ {{" State" sv , " RUNNING_IN_RAY_GET" },
251+ {" Name" sv , actor_name_},
252+ {" Source" sv , " executor" },
253+ {" JobId" sv , job_id_}});
254+ actor_by_state_counter_ .Record (in_wait,
255+ {{" State" sv , " RUNNING_IN_RAY_WAIT" },
256+ {" Name" sv , actor_name_},
257+ {" Source" sv , " executor" },
258+ {" JobId" sv , job_id_}});
257259 }
258260}
259261
@@ -321,7 +323,8 @@ CoreWorker::CoreWorker(
321323 instrumented_io_context &task_execution_service,
322324 std::unique_ptr<worker::TaskEventBuffer> task_event_buffer,
323325 uint32_t pid,
324- ray::observability::MetricInterface &task_by_state_counter)
326+ ray::observability::MetricInterface &task_by_state_counter,
327+ ray::observability::MetricInterface &actor_by_state_counter)
325328 : options_(std::move(options)),
326329 get_call_site_(RayConfig::instance().record_ref_creation_sites()
327330 ? options_.get_lang_stack
@@ -360,7 +363,7 @@ CoreWorker::CoreWorker(
360363 task_execution_service_(task_execution_service),
361364 exiting_detail_(std::nullopt ),
362365 max_direct_call_object_size_(RayConfig::instance().max_direct_call_object_size()),
363- task_counter_(task_by_state_counter),
366+ task_counter_(task_by_state_counter, actor_by_state_counter ),
364367 task_event_buffer_(std::move(task_event_buffer)),
365368 pid_(pid),
366369 actor_shutdown_callback_(std::move(options_.actor_shutdown_callback)),
0 commit comments