mirror of
https://github.com/wassname/ray.git
synced 2026-07-01 00:17:23 +08:00
[Stats] add nodeaddress tag for stats test (#8423)
This commit is contained in:
@@ -41,11 +41,12 @@ class MockExporter : public opencensus::stats::StatsExporter::Handler {
|
||||
|
||||
ASSERT_EQ("current_worker", descriptor.name());
|
||||
ASSERT_EQ(opencensus::stats::ViewData::Type::kDouble, view_data.type());
|
||||
|
||||
for (const auto row : view_data.double_data()) {
|
||||
for (size_t i = 0; i < descriptor.columns().size(); ++i) {
|
||||
if (descriptor.columns()[i].name() == "NodeAddress") {
|
||||
ASSERT_EQ("Localhost", row.first[i]);
|
||||
if (descriptor.columns()[i].name() == "WorkerPidKey") {
|
||||
ASSERT_EQ("1000", row.first[i]);
|
||||
} else if (descriptor.columns()[i].name() == "LanguageKey") {
|
||||
ASSERT_EQ("CPP", row.first[i]);
|
||||
}
|
||||
}
|
||||
// row.second store the data of this metric.
|
||||
@@ -58,7 +59,9 @@ class MockExporter : public opencensus::stats::StatsExporter::Handler {
|
||||
class StatsTest : public ::testing::Test {
|
||||
public:
|
||||
void SetUp() {
|
||||
ray::stats::Init("127.0.0.1:8888", {{stats::NodeAddressKey, "Localhost"}}, false);
|
||||
const stats::TagsType global_tags = {{stats::LanguageKey, "CPP"},
|
||||
{stats::WorkerPidKey, "1000"}};
|
||||
ray::stats::Init("127.0.0.1:8888", global_tags, false);
|
||||
MockExporter::Register();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user