[Core] Fix pg stats not imported (#20288)

* Fix pg stats not imported

* Fix metrics are not exported to the test
This commit is contained in:
SangBin Cho 2021-11-15 12:05:57 +09:00 committed by GitHub
parent 6777a31751
commit 475e4dbf76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 7 deletions

View file

@ -59,6 +59,12 @@ _METRICS = [
"ray_operation_run_time_ms",
"ray_operation_queue_time_ms",
"ray_operation_active_count",
"ray_placement_group_creation_latency_ms_sum",
"ray_placement_group_scheduling_latency_ms_sum",
"ray_pending_placement_group",
"ray_registered_placement_group",
"ray_infeasible_placement_group",
"ray_placement_group_resource_persist_latency_ms_sum"
]
# This list of metrics should be kept in sync with
@ -104,6 +110,12 @@ def _setup_cluster_for_test(ray_start_cluster):
counter.inc(2)
ray.get(worker_should_exit.wait.remote())
# Generate some metrics for the placement group.
pg = ray.util.placement_group(bundles=[{"CPU": 1}])
ray.get(pg.ready())
print(ray.util.placement_group_table())
ray.util.remove_placement_group(pg)
@ray.remote
class A:
async def ping(self):

View file

@ -27,18 +27,18 @@
// are committed to nodes and available).
DEFINE_stats(placement_group_creation_latency_ms,
"end to end latency of placement group creation", (),
({0.1, 1, 10, 100, 1000, 10000}, ), ray::stats::Histogram);
({0.1, 1, 10, 100, 1000, 10000}, ), ray::stats::HISTOGRAM);
// The time from placement group scheduling has started
// <-> Placement group creation succeeds.
DEFINE_stats(placement_group_scheduling_latency_ms,
"scheduling latency of placement groups", (),
({0.1, 1, 10, 100, 1000, 10000}, ), ray::stats::Histogram);
({0.1, 1, 10, 100, 1000, 10000}, ), ray::stats::HISTOGRAM);
DEFINE_stats(pending_placement_group, "Number of total pending placement groups", (), (),
ray::stats::Gauge);
ray::stats::GAUGE);
DEFINE_stats(registered_placement_group, "Number of total registered placement groups",
(), (), ray::stats::Gauge);
(), (), ray::stats::GAUGE);
DEFINE_stats(infeasible_placement_group, "Number of total infeasible placement groups",
(), (), ray::stats::Gauge);
(), (), ray::stats::GAUGE);
namespace ray {
namespace gcs {

View file

@ -19,7 +19,7 @@
DEFINE_stats(placement_group_resource_persist_latency_ms,
"Time to persist placement resources to Redis.", (),
({0.1, 1, 10, 100, 1000, 10000}, ), ray::stats::Histogram);
({0.1, 1, 10, 100, 1000, 10000}, ), ray::stats::HISTOGRAM);
namespace ray {
namespace gcs {

View file

@ -15,10 +15,12 @@
#pragma once
#include <ctype.h>
#include <functional>
#include <memory>
#include <tuple>
#include <unordered_map>
#include "gtest/gtest_prod.h"
#include "opencensus/stats/stats.h"
#include "opencensus/stats/stats_exporter.h"
@ -260,7 +262,9 @@ void RegisterView(const std::string &name, const std::string &description,
template <typename T = void>
void RegisterViewWithTagList(const std::string &name, const std::string &description,
const std::vector<opencensus::tags::TagKey> &tag_keys,
const std::vector<double> &buckets) {}
const std::vector<double> &buckets) {
static_assert(std::is_same_v<T, void>);
}
template <StatsType T, StatsType... Ts>
void RegisterViewWithTagList(const std::string &name, const std::string &description,