diff options
| author | chenzizhan <[email protected]> | 2023-05-30 15:01:36 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2023-05-30 15:01:36 +0800 |
| commit | 9508f5d8d4aca576946dc82c269ba8e8013a05ac (patch) | |
| tree | 7eeaa977b679f4f5a9c83550dbad9a93193a8705 | |
| parent | 87ed25f469033eb8f636f2f1b4999540a93172a8 (diff) | |
try ciczz-dev3-hk
| -rw-r--r-- | .gitlab-ci.yml | 2 | ||||
| -rw-r--r-- | src/fieldstat.cpp | 5 | ||||
| -rw-r--r-- | src/file_output.cpp | 4 | ||||
| -rw-r--r-- | src/line_protocol_output.cpp | 7 | ||||
| -rw-r--r-- | test/src/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | test/src/gtest_dynamic_fieldstat.cpp | 6 | ||||
| -rw-r--r-- | test/src/gtest_fieldstat_topk.cpp | 2 | ||||
| -rw-r--r-- | test/src/test_utils.cpp | 1 |
8 files changed, 18 insertions, 21 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f70f1eb..cb9072c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ variables: BUILD_IMAGE_CENTOS7: "git.mesalab.cn:7443/mesa_platform/build-env:master" BUILD_IMAGE_CENTOS8: "git.mesalab.cn:7443/mesa_platform/build-env:rockylinux" BUILD_PADDING_PREFIX: /tmp/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX/ - INSTALL_DEPENDENCY_LIBRARY: libasan uuid uuid-devel libuuid libuuid-devel + INSTALL_DEPENDENCY_LIBRARY: libasan libuuid-devel INSTALL_PREFIX: "/opt/MESA/" stages: diff --git a/src/fieldstat.cpp b/src/fieldstat.cpp index 9b411e6..d89ff5a 100644 --- a/src/fieldstat.cpp +++ b/src/fieldstat.cpp @@ -201,7 +201,9 @@ void metric_free(struct metric *metric) { metric->table = NULL; } - free_heavy_keeper(&metric->heavy_keeper); + if (metric->field_type == FIELD_TYPE_TOPK) { + free_heavy_keeper(&metric->heavy_keeper); + } free(metric); @@ -515,7 +517,6 @@ long long hdr_count_le_value(const struct hdr_histogram* h, long long value) void fieldstat_passive_output(struct fieldstat_instance *instance) { - printf("enter fieldstat_passive_output\n"); struct timespec this_output_time; long long interval_ms = 0; int ret = 0; diff --git a/src/file_output.cpp b/src/file_output.cpp index 5165155..8697856 100644 --- a/src/file_output.cpp +++ b/src/file_output.cpp @@ -789,7 +789,8 @@ void output_file_type_topk_default(struct fieldstat_instance *instance, int curr // default int size = 10000 * metric_num; - char print_buf[size] = ""; + char print_buf[size]; + memset(print_buf, 0, size); int used_len = 0; const char *header[TOPK_COLUMN_NUM] = {"rank", "key", NULL}; @@ -813,7 +814,6 @@ void output_file_type_topk_default(struct fieldstat_instance *instance, int curr int file_output(struct fieldstat_instance *instance,long long interval_ms) { - printf("enter file_output\n"); int used_len = 0; int current_table_cnt = 0; int current_metric_cnt = 0; diff --git a/src/line_protocol_output.cpp b/src/line_protocol_output.cpp index 2e49ed1..99c1de0 100644 --- a/src/line_protocol_output.cpp +++ b/src/line_protocol_output.cpp @@ -307,16 +307,11 @@ void output_line_protocol_topk(struct fieldstat_instance *instance, struct metri used_len += add_user_tag_set(metric, line_buf + used_len, line_buf_size - used_len); used_len += snprintf(line_buf + used_len, line_buf_size - used_len, " "); - printf("remaining line_buf_size: %zu\n", line_buf_size - used_len); - // TODO: <key>=value,<key>=value... heavy_keeper_archieve_before_output(metric); struct heavy_keeper *hk = choose_heavy_keeper_for_output(metric); used_len += add_field_set_for_topk(hk, line_buf + used_len, line_buf_size - used_len); - if (used_len == 0) { - printf("ERROR: line protocol has no space in UDP buffer for writing field."); // line protocol packet has at lease one field - } - used_len += snprintf(line_buf + used_len, line_buf_size - used_len, "\n"); // TODO: 这个回车是干嘛的? + used_len += snprintf(line_buf + used_len, line_buf_size - used_len, "\n"); send_line_buf(&instance->line_protocol_output, line_buf, used_len); } diff --git a/test/src/CMakeLists.txt b/test/src/CMakeLists.txt index 7dafefd..67eda4e 100644 --- a/test/src/CMakeLists.txt +++ b/test/src/CMakeLists.txt @@ -6,17 +6,17 @@ add_definitions(-std=c++11) #add_executable(gtest_rule ${PROJECT_SOURCE_DIR}/src/tsg_rule.cpp ${PROJECT_SOURCE_DIR}/src/tsg_bridge.cpp ${PROJECT_SOURCE_DIR}/src/tsg_leaky_bucket.cpp gtest_common.cpp gtest_rule.cpp) #target_link_libraries(gtest_rule gtest-static ctemplate-static cjson MESA_prof_load MESA_handle_logger MESA_jump_layer MESA_field_stat2 maatframe) -# add_executable(gtest_fieldstat_interface ${SRC} gtest_fieldstat_interface.cpp) -# target_link_libraries(gtest_fieldstat_interface gtest-static heavykeeper) +add_executable(gtest_fieldstat_interface ${SRC} gtest_fieldstat_interface.cpp) +target_link_libraries(gtest_fieldstat_interface gtest-static heavykeeper) add_executable(gtest_fieldstat_counter_output ${SRC} gtest_fieldstat_counter_output.cpp) target_link_libraries(gtest_fieldstat_counter_output gtest-static heavykeeper) -# add_executable(gtest_dynamic_fieldstat ${SRC} gtest_dynamic_fieldstat.cpp) -# target_link_libraries(gtest_dynamic_fieldstat gtest-static heavykeeper) +add_executable(gtest_dynamic_fieldstat ${SRC} gtest_dynamic_fieldstat.cpp) +target_link_libraries(gtest_dynamic_fieldstat gtest-static heavykeeper) -# add_executable(gtest_dynamic_fieldstat_output ${SRC} gtest_dynamic_fieldstat_output.cpp) -# target_link_libraries(gtest_dynamic_fieldstat_output gtest-static heavykeeper) +add_executable(gtest_dynamic_fieldstat_output ${SRC} gtest_dynamic_fieldstat_output.cpp) +target_link_libraries(gtest_dynamic_fieldstat_output gtest-static heavykeeper) add_executable(gtest_fieldstat_output_file_instance ${SRC} gtest_fieldstat_output_file_instance.cpp) target_link_libraries(gtest_fieldstat_output_file_instance gtest-static heavykeeper) diff --git a/test/src/gtest_dynamic_fieldstat.cpp b/test/src/gtest_dynamic_fieldstat.cpp index 28e7f4b..8d8ee69 100644 --- a/test/src/gtest_dynamic_fieldstat.cpp +++ b/test/src/gtest_dynamic_fieldstat.cpp @@ -281,12 +281,15 @@ TEST(FeildStatDynamicAPI, FieldStatDynamicMetricValueSet) ret = fieldstat_dynamic_metric_value_set(instance, FIELD_TYPE_COUNTER, "Traffic_bytes", 10 + i, tags, sizeof(tags)/sizeof(tags[0]), i); EXPECT_EQ(0, ret); } - + printf("value set finish\n"); for(int i = 0; i < n_thread; i++) { + printf("loop :%d\n", i); + head = &instance->n_thread_dynamic_metric[i]; HASH_ITER(hh, *head, dyn_metric, tmp_dyn_metric) { + printf("loop hash\n"); metrics = dyn_metric->metrics; metric = metrics[0]; switch(metric->field_type) @@ -304,6 +307,7 @@ TEST(FeildStatDynamicAPI, FieldStatDynamicMetricValueSet) } } } + printf("done, going to free\n"); fieldstat_dynamic_instance_free(instance); } diff --git a/test/src/gtest_fieldstat_topk.cpp b/test/src/gtest_fieldstat_topk.cpp index 38d71ba..2d7479f 100644 --- a/test/src/gtest_fieldstat_topk.cpp +++ b/test/src/gtest_fieldstat_topk.cpp @@ -26,8 +26,6 @@ Heavy_keeper_tester *Construct_default_tester(int output_window = 1) tester->take_action("field2", "world", 10); tester->take_action("field2", "WORLD", 42); - printf("Construct_default_tester done\n"); - return tester; } diff --git a/test/src/test_utils.cpp b/test/src/test_utils.cpp index 5f082ad..8a7b5cf 100644 --- a/test/src/test_utils.cpp +++ b/test/src/test_utils.cpp @@ -195,7 +195,6 @@ std::string Heavy_keeper_tester::read_from_prometheus(const char *output_file_pa sleep(3); char cmd[128]; sprintf(cmd, "curl -s http://127.0.0.1:%lu/metrics -o %s", portal, output_file_path); - cout << "system " << cmd << endl; system(cmd); std::ifstream ifs(output_file_path); |
