remove collector from config (#939)

* #931 remove collector from config

* #931 fix test_metrics build error
This commit is contained in:
Cai Yudong 2020-01-07 16:14:38 +08:00 committed by Jin Hai
parent a92a43e282
commit 69d42a3d70
13 changed files with 81 additions and 164 deletions

View File

@ -30,6 +30,7 @@ Please mark all change in change log and use the issue from GitHub
- \#848 - Add ready-to-use config files to the Milvus repo for enhanced user experince
- \#860 - Remove redundant checks in CacheMgr's constructor
- \#908 - Move "primary_path" and "secondary_path" to storage config
- \#931 - Remove "collector" from config
## Task

View File

@ -20,7 +20,7 @@ version: 0.1
#----------------------+------------------------------------------------------------+------------+-----------------+
# Server Config | Description | Type | Default |
#----------------------+------------------------------------------------------------+------------+-----------------+
# address | IP address that Milvus server monitors. | Ip | 0.0.0.0 |
# address | IP address that Milvus server monitors. | IP | 0.0.0.0 |
#----------------------+------------------------------------------------------------+------------+-----------------+
# port | Port that Milvus server monitors. Port range (1024, 65535) | Integer | 19530 |
#----------------------+------------------------------------------------------------+------------+-----------------+
@ -68,7 +68,7 @@ db_config:
#----------------------+------------------------------------------------------------+------------+-----------------+
# minio_enable | Enable MinIO storage or not. | Boolean | false |
#----------------------+------------------------------------------------------------+------------+-----------------+
# minio_address | MinIO storage service IP address. | Ip | 127.0.0.1 |
# minio_address | MinIO storage service IP address. | IP | 127.0.0.1 |
#----------------------+------------------------------------------------------------+------------+-----------------+
# minio_port | MinIO storage service port. Port range (1024, 65535) | Integer | 9000 |
#----------------------+------------------------------------------------------------+------------+-----------------+
@ -93,23 +93,19 @@ storage_config:
#----------------------+------------------------------------------------------------+------------+-----------------+
# enable_monitor | Enable monitoring function or not. | Boolean | false |
#----------------------+------------------------------------------------------------+------------+-----------------+
# collector | Connected monitoring system to collect metrics. | String | Prometheus |
#----------------------+------------------------------------------------------------+------------+-----------------+
# address | Pushgateway address | IP | 127.0.0.1 +
#----------------------+------------------------------------------------------------+------------+-----------------+
# port | Pushgateway port, port range (1024, 65535) | Integer | 9091 |
#----------------------+------------------------------------------------------------+------------+-----------------+
metric_config:
enable_monitor: false
collector: prometheus
prometheus_config:
address: 127.0.0.1
port: 9091
address: 127.0.0.1
port: 9091
#----------------------+------------------------------------------------------------+------------+-----------------+
# Cache Config | Description | Type | Default |
#----------------------+------------------------------------------------------------+------------+-----------------+
# cpu_cache_capacity | The size of CPU memory used for caching data for faster | Integet | 4 (GB) |
# cpu_cache_capacity | The size of CPU memory used for caching data for faster | Integer | 4 (GB) |
# | query. The sum of 'cpu_cache_capacity' and | | |
# | 'insert_buffer_size' must be less than system memory size. | | |
#----------------------+------------------------------------------------------------+------------+-----------------+

View File

@ -20,7 +20,7 @@ version: 0.1
#----------------------+------------------------------------------------------------+------------+-----------------+
# Server Config | Description | Type | Default |
#----------------------+------------------------------------------------------------+------------+-----------------+
# address | IP address that Milvus server monitors. | Ip | 0.0.0.0 |
# address | IP address that Milvus server monitors. | IP | 0.0.0.0 |
#----------------------+------------------------------------------------------------+------------+-----------------+
# port | Port that Milvus server monitors. Port range (1024, 65535) | Integer | 19530 |
#----------------------+------------------------------------------------------------+------------+-----------------+
@ -68,7 +68,7 @@ db_config:
#----------------------+------------------------------------------------------------+------------+-----------------+
# minio_enable | Enable MinIO storage or not. | Boolean | false |
#----------------------+------------------------------------------------------------+------------+-----------------+
# minio_address | MinIO storage service IP address. | Ip | 127.0.0.1 |
# minio_address | MinIO storage service IP address. | IP | 127.0.0.1 |
#----------------------+------------------------------------------------------------+------------+-----------------+
# minio_port | MinIO storage service port. Port range (1024, 65535) | Integer | 9000 |
#----------------------+------------------------------------------------------------+------------+-----------------+
@ -93,23 +93,19 @@ storage_config:
#----------------------+------------------------------------------------------------+------------+-----------------+
# enable_monitor | Enable monitoring function or not. | Boolean | false |
#----------------------+------------------------------------------------------------+------------+-----------------+
# collector | Connected monitoring system to collect metrics. | String | Prometheus |
#----------------------+------------------------------------------------------------+------------+-----------------+
# address | Pushgateway address | IP | 127.0.0.1 +
#----------------------+------------------------------------------------------------+------------+-----------------+
# port | Pushgateway port, port range (1024, 65535) | Integer | 9091 |
#----------------------+------------------------------------------------------------+------------+-----------------+
metric_config:
enable_monitor: false
collector: prometheus
prometheus_config:
address: 127.0.0.1
port: 9091
address: 127.0.0.1
port: 9091
#----------------------+------------------------------------------------------------+------------+-----------------+
# Cache Config | Description | Type | Default |
#----------------------+------------------------------------------------------------+------------+-----------------+
# cpu_cache_capacity | The size of CPU memory used for caching data for faster | Integet | 4 (GB) |
# cpu_cache_capacity | The size of CPU memory used for caching data for faster | Integer | 4 (GB) |
# | query. The sum of 'cpu_cache_capacity' and | | |
# | 'insert_buffer_size' must be less than system memory size. | | |
#----------------------+------------------------------------------------------------+------------+-----------------+

View File

@ -68,7 +68,7 @@ db_config:
#----------------------+------------------------------------------------------------+------------+-----------------+
# minio_enable | Enable MinIO storage or not. | Boolean | false |
#----------------------+------------------------------------------------------------+------------+-----------------+
# minio_address | MinIO storage service IP address. | Ip | 127.0.0.1 |
# minio_address | MinIO storage service IP address. | IP | 127.0.0.1 |
#----------------------+------------------------------------------------------------+------------+-----------------+
# minio_port | MinIO storage service port. Port range (1024, 65535) | Integer | 9000 |
#----------------------+------------------------------------------------------------+------------+-----------------+
@ -93,23 +93,19 @@ storage_config:
#----------------------+------------------------------------------------------------+------------+-----------------+
# enable_monitor | Enable monitoring function or not. | Boolean | false |
#----------------------+------------------------------------------------------------+------------+-----------------+
# collector | Connected monitoring system to collect metrics. | String | Prometheus |
#----------------------+------------------------------------------------------------+------------+-----------------+
# address | Pushgateway address | IP | 127.0.0.1 +
#----------------------+------------------------------------------------------------+------------+-----------------+
# port | Pushgateway port, port range (1024, 65535) | Integer | 9091 |
#----------------------+------------------------------------------------------------+------------+-----------------+
metric_config:
enable_monitor: false
collector: prometheus
prometheus_config:
address: 127.0.0.1
port: 9091
address: 127.0.0.1
port: 9091
#----------------------+------------------------------------------------------------+------------+-----------------+
# Cache Config | Description | Type | Default |
#----------------------+------------------------------------------------------------+------------+-----------------+
# cpu_cache_capacity | The size of CPU memory used for caching data for faster | Integet | 4 (GB) |
# cpu_cache_capacity | The size of CPU memory used for caching data for faster | Integer | 4 (GB) |
# | query. The sum of 'cpu_cache_capacity' and | | |
# | 'insert_buffer_size' must be less than system memory size. | | |
#----------------------+------------------------------------------------------------+------------+-----------------+

View File

@ -34,17 +34,8 @@ Metrics::GetInstance() {
MetricsBase&
Metrics::CreateMetricsCollector() {
Config& config = Config::GetInstance();
std::string collector_type_str;
config.GetMetricConfigCollector(collector_type_str);
#ifdef MILVUS_WITH_PROMETHEUS
if (collector_type_str == "prometheus") {
return PrometheusMetrics::GetInstance();
} else {
return MetricsBase::GetInstance();
}
return PrometheusMetrics::GetInstance();
#else
return MetricsBase::GetInstance();
#endif

View File

@ -31,27 +31,18 @@ Status
PrometheusMetrics::Init() {
try {
Config& config = Config::GetInstance();
Status s = config.GetMetricConfigEnableMonitor(startup_);
if (!s.ok()) {
return s;
}
CONFIG_CHECK(config.GetMetricConfigEnableMonitor(startup_));
if (!startup_) {
return Status::OK();
}
// Following should be read from config file.
std::string push_port, push_address;
s = config.GetMetricConfigPrometheusPort(push_port);
if (!s.ok()) {
return s;
}
s = config.GetMetricConfigPrometheusAddress(push_address);
if (!s.ok()) {
return s;
}
CONFIG_CHECK(config.GetMetricConfigPort(push_port));
CONFIG_CHECK(config.GetMetricConfigAddress(push_address));
const std::string uri = std::string("/metrics");
const std::size_t num_threads = 2;
// const std::size_t num_threads = 2;
auto labels = prometheus::Gateway::GetInstanceLabel("pushgateway");

View File

@ -131,14 +131,11 @@ Config::ValidateConfig() {
bool metric_enable_monitor;
CONFIG_CHECK(GetMetricConfigEnableMonitor(metric_enable_monitor));
std::string metric_collector;
CONFIG_CHECK(GetMetricConfigCollector(metric_collector));
std::string metric_address;
CONFIG_CHECK(GetMetricConfigAddress(metric_address));
std::string metric_prometheus_address;
CONFIG_CHECK(GetMetricConfigPrometheusAddress(metric_prometheus_address));
std::string metric_prometheus_port;
CONFIG_CHECK(GetMetricConfigPrometheusPort(metric_prometheus_port));
std::string metric_port;
CONFIG_CHECK(GetMetricConfigPort(metric_port));
/* cache config */
int64_t cache_cpu_cache_capacity;
@ -216,9 +213,8 @@ Config::ResetDefaultConfig() {
/* metric config */
CONFIG_CHECK(SetMetricConfigEnableMonitor(CONFIG_METRIC_ENABLE_MONITOR_DEFAULT));
CONFIG_CHECK(SetMetricConfigCollector(CONFIG_METRIC_COLLECTOR_DEFAULT));
CONFIG_CHECK(SetMetricConfigPrometheusAddress(CONFIG_METRIC_PROMETHEUS_ADDRESS_DEFAULT));
CONFIG_CHECK(SetMetricConfigPrometheusPort(CONFIG_METRIC_PROMETHEUS_PORT_DEFAULT));
CONFIG_CHECK(SetMetricConfigAddress(CONFIG_METRIC_ADDRESS_DEFAULT));
CONFIG_CHECK(SetMetricConfigPort(CONFIG_METRIC_PORT_DEFAULT));
/* cache config */
CONFIG_CHECK(SetCacheConfigCpuCacheCapacity(CONFIG_CACHE_CPU_CACHE_CAPACITY_DEFAULT));
@ -551,36 +547,24 @@ Config::CheckMetricConfigEnableMonitor(const std::string& value) {
}
Status
Config::CheckMetricConfigCollector(const std::string& value) {
if (value != "prometheus") {
std::string msg =
"Invalid metric collector: " + value + ". Possible reason: metric_config.collector is invalid.";
return Status(SERVER_INVALID_ARGUMENT, msg);
}
return Status::OK();
}
Status
Config::CheckMetricConfigPrometheusAddress(const std::string& value) {
Config::CheckMetricConfigAddress(const std::string& value) {
if (!ValidationUtil::ValidateIpAddress(value).ok()) {
std::string msg =
"Invalid metric ip: " + value + ". Possible reason: metric_config.prometheus_config.ip is invalid.";
return Status(SERVER_INVALID_ARGUMENT, "Invalid metric config prometheus_ip: " + value);
std::string msg = "Invalid metric ip: " + value + ". Possible reason: metric_config.ip is invalid.";
return Status(SERVER_INVALID_ARGUMENT, "Invalid metric config ip: " + value);
}
return Status::OK();
}
Status
Config::CheckMetricConfigPrometheusPort(const std::string& value) {
Config::CheckMetricConfigPort(const std::string& value) {
if (!ValidationUtil::ValidateStringIsNumber(value).ok()) {
std::string msg = "Invalid prometheus port: " + value +
". Possible reason: metric_config.prometheus_config.port is not a number.";
std::string msg = "Invalid metric port: " + value + ". Possible reason: metric_config.port is not a number.";
return Status(SERVER_INVALID_ARGUMENT, msg);
} else {
int32_t port = std::stoi(value);
if (!(port > 1024 && port < 65535)) {
std::string msg = "Invalid prometheus port: " + value +
". Possible reason: metric_config.prometheus_config.port is not in range (1024, 65535).";
std::string msg = "Invalid metric port: " + value +
". Possible reason: metric_config.port is not in range (1024, 65535).";
return Status(SERVER_INVALID_ARGUMENT, msg);
}
}
@ -948,13 +932,13 @@ Config::GetDBConfigPreloadTable(std::string& value) {
/* storage config */
Status
Config::GetStorageConfigPrimaryPath(std::string& value) {
value = GetConfigStr(CONFIG_DB, CONFIG_STORAGE_PRIMARY_PATH, CONFIG_STORAGE_PRIMARY_PATH_DEFAULT);
value = GetConfigStr(CONFIG_STORAGE, CONFIG_STORAGE_PRIMARY_PATH, CONFIG_STORAGE_PRIMARY_PATH_DEFAULT);
return CheckStorageConfigPrimaryPath(value);
}
Status
Config::GetStorageConfigSecondaryPath(std::string& value) {
value = GetConfigStr(CONFIG_DB, CONFIG_STORAGE_SECONDARY_PATH, CONFIG_STORAGE_SECONDARY_PATH_DEFAULT);
value = GetConfigStr(CONFIG_STORAGE, CONFIG_STORAGE_SECONDARY_PATH, CONFIG_STORAGE_SECONDARY_PATH_DEFAULT);
return CheckStorageConfigSecondaryPath(value);
}
@ -1008,21 +992,15 @@ Config::GetMetricConfigEnableMonitor(bool& value) {
}
Status
Config::GetMetricConfigCollector(std::string& value) {
value = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_COLLECTOR, CONFIG_METRIC_COLLECTOR_DEFAULT);
Config::GetMetricConfigAddress(std::string& value) {
value = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_ADDRESS, CONFIG_METRIC_ADDRESS_DEFAULT);
return Status::OK();
}
Status
Config::GetMetricConfigPrometheusAddress(std::string& value) {
value = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_PROMETHEUS_ADDRESS, CONFIG_METRIC_PROMETHEUS_ADDRESS_DEFAULT);
return Status::OK();
}
Status
Config::GetMetricConfigPrometheusPort(std::string& value) {
value = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_PROMETHEUS_PORT, CONFIG_METRIC_PROMETHEUS_PORT_DEFAULT);
return CheckMetricConfigPrometheusPort(value);
Config::GetMetricConfigPort(std::string& value) {
value = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_PORT, CONFIG_METRIC_PORT_DEFAULT);
return CheckMetricConfigPort(value);
}
/* cache config */
@ -1234,19 +1212,19 @@ Config::SetDBConfigInsertBufferSize(const std::string& value) {
Status
Config::SetStorageConfigPrimaryPath(const std::string& value) {
CONFIG_CHECK(CheckStorageConfigPrimaryPath(value));
return SetConfigValueInMem(CONFIG_DB, CONFIG_STORAGE_PRIMARY_PATH, value);
return SetConfigValueInMem(CONFIG_STORAGE, CONFIG_STORAGE_PRIMARY_PATH, value);
}
Status
Config::SetStorageConfigSecondaryPath(const std::string& value) {
CONFIG_CHECK(CheckStorageConfigSecondaryPath(value));
return SetConfigValueInMem(CONFIG_DB, CONFIG_STORAGE_SECONDARY_PATH, value);
return SetConfigValueInMem(CONFIG_STORAGE, CONFIG_STORAGE_SECONDARY_PATH, value);
}
Status
Config::SetStorageConfigMinioEnable(const std::string& value) {
CONFIG_CHECK(CheckStorageConfigMinioEnable(value));
return SetConfigValueInMem(CONFIG_METRIC, CONFIG_METRIC_ENABLE_MONITOR, value);
return SetConfigValueInMem(CONFIG_STORAGE, CONFIG_STORAGE_MINIO_ENABLE, value);
}
Status
@ -1287,21 +1265,15 @@ Config::SetMetricConfigEnableMonitor(const std::string& value) {
}
Status
Config::SetMetricConfigCollector(const std::string& value) {
CONFIG_CHECK(CheckMetricConfigCollector(value));
return SetConfigValueInMem(CONFIG_METRIC, CONFIG_METRIC_COLLECTOR, value);
Config::SetMetricConfigAddress(const std::string& value) {
CONFIG_CHECK(CheckMetricConfigAddress(value));
return SetConfigValueInMem(CONFIG_METRIC, CONFIG_METRIC_ADDRESS, value);
}
Status
Config::SetMetricConfigPrometheusAddress(const std::string& value) {
CONFIG_CHECK(CheckMetricConfigPrometheusAddress(value));
SetConfigValueInMem(CONFIG_METRIC, CONFIG_METRIC_PROMETHEUS_ADDRESS, value);
}
Status
Config::SetMetricConfigPrometheusPort(const std::string& value) {
CONFIG_CHECK(CheckMetricConfigPrometheusPort(value));
return SetConfigValueInMem(CONFIG_METRIC, CONFIG_METRIC_PROMETHEUS_PORT, value);
Config::SetMetricConfigPort(const std::string& value) {
CONFIG_CHECK(CheckMetricConfigPort(value));
return SetConfigValueInMem(CONFIG_METRIC, CONFIG_METRIC_PORT, value);
}
/* cache config */

View File

@ -95,13 +95,10 @@ static const char* CONFIG_CACHE_CACHE_INSERT_DATA_DEFAULT = "false";
static const char* CONFIG_METRIC = "metric_config";
static const char* CONFIG_METRIC_ENABLE_MONITOR = "enable_monitor";
static const char* CONFIG_METRIC_ENABLE_MONITOR_DEFAULT = "false";
static const char* CONFIG_METRIC_COLLECTOR = "collector";
static const char* CONFIG_METRIC_COLLECTOR_DEFAULT = "prometheus";
static const char* CONFIG_METRIC_PROMETHEUS = "prometheus_config";
static const char* CONFIG_METRIC_PROMETHEUS_ADDRESS = "address";
static const char* CONFIG_METRIC_PROMETHEUS_ADDRESS_DEFAULT = "127.0.0.1";
static const char* CONFIG_METRIC_PROMETHEUS_PORT = "port";
static const char* CONFIG_METRIC_PROMETHEUS_PORT_DEFAULT = "9091";
static const char* CONFIG_METRIC_ADDRESS = "address";
static const char* CONFIG_METRIC_ADDRESS_DEFAULT = "127.0.0.1";
static const char* CONFIG_METRIC_PORT = "port";
static const char* CONFIG_METRIC_PORT_DEFAULT = "9091";
/* engine config */
static const char* CONFIG_ENGINE = "engine_config";
@ -212,11 +209,9 @@ class Config {
Status
CheckMetricConfigEnableMonitor(const std::string& value);
Status
CheckMetricConfigCollector(const std::string& value);
CheckMetricConfigAddress(const std::string& value);
Status
CheckMetricConfigPrometheusAddress(const std::string& value);
Status
CheckMetricConfigPrometheusPort(const std::string& value);
CheckMetricConfigPort(const std::string& value);
/* cache config */
Status
@ -302,11 +297,9 @@ class Config {
Status
GetMetricConfigEnableMonitor(bool& value);
Status
GetMetricConfigCollector(std::string& value);
GetMetricConfigAddress(std::string& value);
Status
GetMetricConfigPrometheusAddress(std::string& value);
Status
GetMetricConfigPrometheusPort(std::string& value);
GetMetricConfigPort(std::string& value);
/* cache config */
Status
@ -386,11 +379,9 @@ class Config {
Status
SetMetricConfigEnableMonitor(const std::string& value);
Status
SetMetricConfigCollector(const std::string& value);
SetMetricConfigAddress(const std::string& value);
Status
SetMetricConfigPrometheusAddress(const std::string& value);
Status
SetMetricConfigPrometheusPort(const std::string& value);
SetMetricConfigPort(const std::string& value);
/* cache config */
Status

View File

@ -61,13 +61,12 @@ static const char* CONFIG_STR =
"\n"
"metric_config:\n"
" enable_monitor: false # enable monitoring or not\n"
" collector: prometheus # prometheus\n"
" prometheus_config:\n"
" port: 8080 # port prometheus used to fetch metrics\n"
" address: 127.0.0.1\n"
" port: 9091 # port prometheus used to fetch metrics\n"
"\n"
"cache_config:\n"
" cpu_mem_capacity: 16 # GB, CPU memory used for cache\n"
" cpu_mem_threshold: 0.85 # percentage of data kept when cache cleanup triggered\n"
" cpu_cache_capacity: 4 # GB, CPU memory used for cache\n"
" cpu_cache_threshold: 0.85 # percentage of data kept when cache cleanup triggered\n"
" cache_insert_data: false # whether load inserted data into cache\n"
"\n"
"engine_config:\n"

View File

@ -30,17 +30,9 @@
#include "db/meta/SqliteMetaImpl.h"
TEST_F(MetricTest, METRIC_TEST) {
milvus::server::Config::GetInstance().SetMetricConfigCollector("zabbix");
milvus::server::Metrics::GetInstance();
milvus::server::Config::GetInstance().SetMetricConfigCollector("prometheus");
milvus::server::Metrics::GetInstance();
milvus::server::SystemInfo::GetInstance().Init();
// server::Metrics::GetInstance().Init();
// server::Metrics::GetInstance().exposer_ptr()->RegisterCollectable(server::Metrics::GetInstance().registry_ptr());
milvus::server::Metrics::GetInstance().Init();
// server::PrometheusMetrics::GetInstance().exposer_ptr()->RegisterCollectable(server::PrometheusMetrics::GetInstance().registry_ptr());
milvus::cache::CpuCacheMgr::GetInstance()->SetCapacity(1UL * 1024 * 1024 * 1024);
std::cout << milvus::cache::CpuCacheMgr::GetInstance()->CacheCapacity() << std::endl;

View File

@ -177,7 +177,7 @@ TEST_F(ConfigTest, SERVER_CONFIG_VALID_TEST) {
ASSERT_TRUE(config.GetStorageConfigSecondaryPath(str_val).ok());
ASSERT_TRUE(str_val == storage_secondary_path);
bool storage_minio_enable = false;
bool storage_minio_enable = true;
ASSERT_TRUE(config.SetStorageConfigMinioEnable(std::to_string(storage_minio_enable)).ok());
ASSERT_TRUE(config.GetStorageConfigMinioEnable(bool_val).ok());
ASSERT_TRUE(bool_val == storage_minio_enable);
@ -213,19 +213,15 @@ TEST_F(ConfigTest, SERVER_CONFIG_VALID_TEST) {
ASSERT_TRUE(config.GetMetricConfigEnableMonitor(bool_val).ok());
ASSERT_TRUE(bool_val == metric_enable_monitor);
std::string metric_collector = "prometheus";
ASSERT_TRUE(config.SetMetricConfigCollector(metric_collector).ok());
ASSERT_TRUE(config.GetMetricConfigCollector(str_val).ok());
ASSERT_TRUE(str_val == metric_collector);
std::string metric_address = "192.168.0.2";
ASSERT_TRUE(config.SetMetricConfigAddress(metric_address).ok());
ASSERT_TRUE(config.GetMetricConfigAddress(str_val).ok());
ASSERT_TRUE(str_val == metric_address);
std::string metric_prometheus_address = "127.0.0.1";
ASSERT_TRUE(config.GetMetricConfigPrometheusAddress(str_val).ok());
ASSERT_TRUE(str_val == metric_prometheus_address);
std::string metric_prometheus_port = "2222";
ASSERT_TRUE(config.SetMetricConfigPrometheusPort(metric_prometheus_port).ok());
ASSERT_TRUE(config.GetMetricConfigPrometheusPort(str_val).ok());
ASSERT_TRUE(str_val == metric_prometheus_port);
std::string metric_port = "2222";
ASSERT_TRUE(config.SetMetricConfigPort(metric_port).ok());
ASSERT_TRUE(config.GetMetricConfigPort(str_val).ok());
ASSERT_TRUE(str_val == metric_port);
/* cache config */
int64_t cache_cpu_cache_capacity = 1;
@ -523,11 +519,9 @@ TEST_F(ConfigTest, SERVER_CONFIG_INVALID_TEST) {
/* metric config */
ASSERT_FALSE(config.SetMetricConfigEnableMonitor("Y").ok());
ASSERT_FALSE(config.SetMetricConfigCollector("zilliz").ok());
ASSERT_FALSE(config.SetMetricConfigAddress("127.0.0").ok());
ASSERT_FALSE(config.SetMetricConfigPrometheusAddress("127.0.0").ok());
ASSERT_FALSE(config.SetMetricConfigPrometheusPort("0xff").ok());
ASSERT_FALSE(config.SetMetricConfigPort("0xff").ok());
/* cache config */
ASSERT_FALSE(config.SetCacheConfigCpuCacheCapacity("a").ok());

View File

@ -48,12 +48,11 @@ static const char* VALID_CONFIG_STR =
"\n"
"metric_config:\n"
" enable_monitor: false # enable monitoring or not\n"
" collector: prometheus # prometheus\n"
" prometheus_config:\n"
" port: 8080 # port prometheus uses to fetch metrics\n"
" address: 127.0.0.1\n"
" port: 8080 # port prometheus uses to fetch metrics\n"
"\n"
"cache_config:\n"
" cpu_cache_capacity: 4 # GB, CPU memory used for cache\n"
" cpu_cache_capacity: 4 # GB, CPU memory used for cache\n"
" cpu_cache_threshold: 0.85 \n"
" cache_insert_data: false # whether to load inserted data into cache\n"
"\n"

View File

@ -45,13 +45,12 @@ static const char* CONFIG_STR =
"\n"
"metric_config:\n"
" enable_monitor: false # enable monitoring or not\n"
" collector: prometheus # prometheus\n"
" prometheus_config:\n"
" port: 8080 # port prometheus used to fetch metrics\n"
" address: 127.0.0.1\n"
" port: 8080 # port prometheus used to fetch metrics\n"
"\n"
"cache_config:\n"
" cpu_mem_capacity: 16 # GB, CPU memory used for cache\n"
" cpu_mem_threshold: 0.85 # percentage of data kept when cache cleanup triggered\n"
" cpu_cache_capacity: 4 # GB, CPU memory used for cache\n"
" cpu_cache_threshold: 0.85 # percentage of data kept when cache cleanup triggered\n"
" cache_insert_data: false # whether load inserted data into cache\n"
"\n"
"engine_config:\n"