From 411c29b22c9ffe365f57cb03d615cb0b1bf06dea Mon Sep 17 00:00:00 2001 From: yu yunfeng Date: Wed, 26 Jun 2019 11:21:55 +0800 Subject: [PATCH] alter server_config Former-commit-id: fe8d5604005b155cfd602d449b0e346d65fddb89 --- cpp/conf/server_config.yaml | 2 +- cpp/src/metrics/PrometheusMetrics.cpp | 3 ++- cpp/unittest/metrics/metrics_test.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cpp/conf/server_config.yaml b/cpp/conf/server_config.yaml index 9f60f0f2..95fa6156 100644 --- a/cpp/conf/server_config.yaml +++ b/cpp/conf/server_config.yaml @@ -14,7 +14,7 @@ db_config: index_building_threshold: 1024 #build index file when raw data file size larger than this value, unit: MB metric_config: - is_startup: true # true is on, false is off + is_startup: off # on is activated, otherwise is down. note: case sensitive collector: prometheus # prometheus, now we only have prometheus prometheus_config: collect_type: pull # pull means prometheus pull the message from server, push means server push metric to push gateway diff --git a/cpp/src/metrics/PrometheusMetrics.cpp b/cpp/src/metrics/PrometheusMetrics.cpp index 07e1d2ee..d0d50800 100644 --- a/cpp/src/metrics/PrometheusMetrics.cpp +++ b/cpp/src/metrics/PrometheusMetrics.cpp @@ -17,7 +17,8 @@ ServerError PrometheusMetrics::Init() { try { ConfigNode &configNode = ServerConfig::GetInstance().GetConfig(CONFIG_METRIC); - startup_ = configNode.GetValue(CONFIG_METRIC_IS_STARTUP) == "true" ? true : false; + startup_ = configNode.GetValue(CONFIG_METRIC_IS_STARTUP) == "on"; + if(!startup_) return SERVER_SUCCESS; // Following should be read from config file. const std::string bind_address = configNode.GetChild(CONFIG_PROMETHEUS).GetValue(CONFIG_METRIC_PROMETHEUS_PORT); const std::string uri = std::string("/metrics"); diff --git a/cpp/unittest/metrics/metrics_test.cpp b/cpp/unittest/metrics/metrics_test.cpp index 00075fbb..72596dc7 100644 --- a/cpp/unittest/metrics/metrics_test.cpp +++ b/cpp/unittest/metrics/metrics_test.cpp @@ -102,7 +102,7 @@ TEST_F(DBTest, Metric_Tes) { } }); - int loop = 10; + int loop = 10000; for (auto i=0; i