Skip to content

Commit

Permalink
FIX UT COMPILE
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiang-hhhh committed Dec 23, 2024
1 parent 4cb10a5 commit 18d380e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions be/test/util/doris_metrics_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ TEST_F(DorisMetricsTest, Normal) {
auto server_entity = DorisMetrics::instance()->server_entity();
// check metric
{
DorisMetrics::instance()->fragment_requests_total->reset();
DorisMetrics::instance()->fragment_requests_total->set_value(0);
DorisMetrics::instance()->fragment_requests_total->increment(12);
auto metric = server_entity->get_metric("fragment_requests_total");
EXPECT_TRUE(metric != nullptr);
EXPECT_STREQ("12", metric->to_string().c_str());
}
{
DorisMetrics::instance()->fragment_request_duration_us->reset();
DorisMetrics::instance()->fragment_request_duration_us->set_value(0);
DorisMetrics::instance()->fragment_request_duration_us->increment(101);
auto metric = server_entity->get_metric("fragment_request_duration_us");
EXPECT_TRUE(metric != nullptr);
Expand Down Expand Up @@ -92,15 +92,15 @@ TEST_F(DorisMetricsTest, Normal) {
}
// engine request
{
DorisMetrics::instance()->create_tablet_requests_total->reset();
DorisMetrics::instance()->create_tablet_requests_total->set_value(0);
DorisMetrics::instance()->create_tablet_requests_total->increment(15);
auto metric =
server_entity->get_metric("create_tablet_requests_total", "engine_requests_total");
EXPECT_TRUE(metric != nullptr);
EXPECT_STREQ("15", metric->to_string().c_str());
}
{
DorisMetrics::instance()->drop_tablet_requests_total->reset();
DorisMetrics::instance()->drop_tablet_requests_total->set_value(0);
DorisMetrics::instance()->drop_tablet_requests_total->increment(16);
auto metric =
server_entity->get_metric("drop_tablet_requests_total", "engine_requests_total");
Expand Down Expand Up @@ -129,7 +129,7 @@ TEST_F(DorisMetricsTest, Normal) {
EXPECT_STREQ("20", metric->to_string().c_str());
}
{
DorisMetrics::instance()->storage_migrate_requests_total->reset();
DorisMetrics::instance()->storage_migrate_requests_total->set_value(0);
DorisMetrics::instance()->storage_migrate_requests_total->increment(21);
auto metric = server_entity->get_metric("storage_migrate_requests_total",
"engine_requests_total");
Expand Down
8 changes: 4 additions & 4 deletions be/test/util/metrics_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST_F(MetricsTest, Counter) {
EXPECT_STREQ("100", counter.to_string().c_str());
}
{
IntAtomicCounter counter;
IntCounter counter;
EXPECT_EQ(0, counter.value());
counter.increment(100);
EXPECT_EQ(100, counter.value());
Expand Down Expand Up @@ -99,7 +99,7 @@ TEST_F(MetricsTest, CounterPerf) {
}
// IntAtomicCounter
{
IntAtomicCounter counter;
IntCounter counter;
MonotonicStopWatch watch;
watch.start();
for (int i = 0; i < kLoopCount; ++i) {
Expand Down Expand Up @@ -141,11 +141,11 @@ TEST_F(MetricsTest, CounterPerf) {
}
// multi-thread for IntAtomicCounter
{
IntAtomicCounter mt_counter;
IntCounter mt_counter;
std::vector<std::thread> updaters;
std::atomic<uint64_t> used_time(0);
for (int i = 0; i < 8; ++i) {
updaters.emplace_back(&mt_updater<IntAtomicCounter>, kThreadLoopCount, &mt_counter,
updaters.emplace_back(&mt_updater<IntCounter>, kThreadLoopCount, &mt_counter,
&used_time);
}
for (int i = 0; i < 8; ++i) {
Expand Down

0 comments on commit 18d380e

Please sign in to comment.