alter server_config

Former-commit-id: abb109f62d540d3b0d1b53ae49308692a04e17af
This commit is contained in:
yu yunfeng 2019-06-26 11:21:55 +08:00
parent 1ae34c2762
commit c497ce5d18
3 changed files with 4 additions and 3 deletions

View File

@ -12,7 +12,7 @@ db_config:
index_building_threshold: 1024 #build index file when raw data file size larger than this value, unit: MB index_building_threshold: 1024 #build index file when raw data file size larger than this value, unit: MB
metric_config: 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 collector: prometheus # prometheus, now we only have prometheus
prometheus_config: prometheus_config:
collect_type: pull # pull means prometheus pull the message from server, push means server push metric to push gateway collect_type: pull # pull means prometheus pull the message from server, push means server push metric to push gateway

View File

@ -17,7 +17,8 @@ ServerError
PrometheusMetrics::Init() { PrometheusMetrics::Init() {
try { try {
ConfigNode &configNode = ServerConfig::GetInstance().GetConfig(CONFIG_METRIC); 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. // Following should be read from config file.
const std::string bind_address = configNode.GetChild(CONFIG_PROMETHEUS).GetValue(CONFIG_METRIC_PROMETHEUS_PORT); const std::string bind_address = configNode.GetChild(CONFIG_PROMETHEUS).GetValue(CONFIG_METRIC_PROMETHEUS_PORT);
const std::string uri = std::string("/metrics"); const std::string uri = std::string("/metrics");

View File

@ -102,7 +102,7 @@ TEST_F(DBTest, Metric_Tes) {
} }
}); });
int loop = 10; int loop = 10000;
for (auto i=0; i<loop; ++i) { for (auto i=0; i<loop; ++i) {
if (i==40) { if (i==40) {