diff options
| author | chenzizhan <[email protected]> | 2023-08-14 15:37:28 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2023-08-14 15:37:28 +0800 |
| commit | 100b21a56aab3ceb43ac2fa72920e8960b6f38f5 (patch) | |
| tree | 94c668f007f32fd2c8e0a3bf9acddbc60ae202d9 /test/test_metric_counter.cpp | |
| parent | bda1514192077a33ca892a99306f9cd2c4c0a470 (diff) | |
couner merge mode
Diffstat (limited to 'test/test_metric_counter.cpp')
| -rw-r--r-- | test/test_metric_counter.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/test_metric_counter.cpp b/test/test_metric_counter.cpp index 76efbf3..9b63e13 100644 --- a/test/test_metric_counter.cpp +++ b/test/test_metric_counter.cpp @@ -13,7 +13,7 @@ struct fieldstat *test_init_standard_instance_one_cube_one_metric_one_cell_count int cube_id = fieldstat_register_cube(instance, &TEST_SHARED_TAG, 1, SAMPLING_MODE_COMPREHENSIVE, 10); EXPECT_EQ(cube_id, 0); - int metric_id = fieldstat_register_counter(instance, cube_id, "czz_test counter metric", is_gauge); + int metric_id = fieldstat_register_counter(instance, cube_id, "czz_test counter metric", is_gauge ? COUNTER_MERGE_BY_MAX : COUNTER_MERGE_BY_SUM); EXPECT_EQ(metric_id, 0); int cell_id = fieldstat_cube_add(instance, cube_id, &TEST_TAG_STRING, 1, 1); @@ -194,7 +194,7 @@ TEST(metric_test_counter, topk_add_and_test_accuracy) { struct fieldstat *instance = fieldstat_new(); fieldstat_register_cube(instance, &TEST_TAG_INT_collided, 1, SAMPLING_MODE_TOPK, 10); - fieldstat_register_counter(instance, 0, "test", 0); + fieldstat_register_counter(instance, 0, "test", COUNTER_MERGE_BY_SUM); int tag_list_num = 10000; Fieldstat_tag_list_wrapper *tags[tag_list_num]; @@ -253,7 +253,7 @@ TEST(metric_test_counter, topk_add_with_monotonically_increasing_flow_expecting_ { struct fieldstat *instance = fieldstat_new(); fieldstat_register_cube(instance, &TEST_TAG_INT_collided, 1, SAMPLING_MODE_TOPK, 10); - fieldstat_register_counter(instance, 0, "test", 0); + fieldstat_register_counter(instance, 0, "test", COUNTER_MERGE_BY_SUM); const int end_cell_id = 10 * 8; const int tag_list_num = 100; @@ -282,7 +282,7 @@ TEST(metric_test_counter, add_or_set_with_wrong_cell_id_expecting_fail) { struct fieldstat *instance = fieldstat_new(); fieldstat_register_cube(instance, &TEST_TAG_INT_collided, 1, SAMPLING_MODE_TOPK, 10); - fieldstat_register_counter(instance, 0, "test", 0); + fieldstat_register_counter(instance, 0, "test", COUNTER_MERGE_BY_SUM); int ret = fieldstat_counter_incrby(instance, 0, 0, 1, 1); EXPECT_EQ(ret, -3); @@ -309,7 +309,7 @@ TEST(metric_test_counter, add_with_wrong_metric_id_expecting_fail) { struct fieldstat *instance = fieldstat_new(); int cube_id = fieldstat_register_cube(instance, &TEST_TAG_INT_collided, 1, SAMPLING_MODE_TOPK, 10); - int metric_id = fieldstat_register_counter(instance, cube_id, "test", 0); + int metric_id = fieldstat_register_counter(instance, cube_id, "test", COUNTER_MERGE_BY_SUM); int ret = fieldstat_counter_incrby(instance, cube_id, metric_id + 1, 1, 1); EXPECT_EQ(ret, -2); @@ -323,7 +323,7 @@ TEST(metric_test_counter, set_with_wrong_cell_id_expecting_fail) { struct fieldstat *instance = fieldstat_new(); fieldstat_register_cube(instance, &TEST_TAG_INT_collided, 1, SAMPLING_MODE_TOPK, 10); - fieldstat_register_counter(instance, 0, "test", 1); + fieldstat_register_counter(instance, 0, "test", COUNTER_MERGE_BY_MAX); int ret = fieldstat_counter_set(instance, 0, 0, 1, 1); EXPECT_EQ(ret, -3); @@ -350,7 +350,7 @@ TEST(metric_test_counter, set_with_wrong_metric_id_expecting_fail) { struct fieldstat *instance = fieldstat_new(); int cube_id = fieldstat_register_cube(instance, &TEST_TAG_INT_collided, 1, SAMPLING_MODE_TOPK, 10); - int metric_id = fieldstat_register_counter(instance, cube_id, "test", 1); + int metric_id = fieldstat_register_counter(instance, cube_id, "test", COUNTER_MERGE_BY_MAX); int ret = fieldstat_counter_set(instance, cube_id, metric_id + 1, 1, 1); EXPECT_EQ(ret, -2); |
