make metrics label configurable (#4677)

* update to 0.10.6

Signed-off-by: shengjun.li <shengjun.li@zilliz.com>

* Configurable metric labels

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Roll back clienTest modify

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

Co-authored-by: shengjun.li <shengjun.li@zilliz.com>
pull/4694/head
yukun 2021-02-02 10:45:36 +08:00 committed by GitHub
parent 87c48faf4f
commit 3efbab1df5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 56 additions and 15 deletions

View File

@ -1,6 +1,17 @@
# Changelog
Please mark all change in change log and use the issue from GitHub
# Milvus 0.10.6 (TBD)
## Bug
## Feature
- \#4676 make metrics label configurable
## Improvement
## Task
# Milvus 0.10.5 (2021-01-07)
## Bug
- \#4296,#4554 Fix mishards add name-mismatched pod to read-only group

View File

@ -1,7 +1,7 @@
#!/usr/bin/env groovy
String cron_timezone = "TZ=Asia/Shanghai"
String cron_string = BRANCH_NAME == "0.10.5" ? "50 22 * * * " : ""
String cron_string = BRANCH_NAME == "0.10.6" ? "50 22 * * * " : ""
pipeline {
agent none

View File

@ -90,7 +90,7 @@ if (MILVUS_VERSION_MAJOR STREQUAL ""
OR MILVUS_VERSION_MINOR STREQUAL ""
OR MILVUS_VERSION_PATCH STREQUAL "")
message(WARNING "Failed to determine Milvus version from git branch name")
set(MILVUS_VERSION "0.10.5")
set(MILVUS_VERSION "0.10.6")
endif ()
message(STATUS "Build version = ${MILVUS_VERSION}")

View File

@ -106,6 +106,10 @@ const char* CONFIG_METRIC_ADDRESS = "address";
const char* CONFIG_METRIC_ADDRESS_DEFAULT = "127.0.0.1";
const char* CONFIG_METRIC_PORT = "port";
const char* CONFIG_METRIC_PORT_DEFAULT = "9091";
const char* CONFIG_METRIC_CLUSTER_LABEL = "cluster_label";
const char* CONFIG_METRIC_CLUSTER_LABEL_DEFAULT = "milvus_cluster";
const char* CONFIG_METRIC_INSTANCE_LABEL = "instance_label";
const char* CONFIG_METRIC_INSTANCE_LABEL_DEFAULT = "";
/* engine config */
const char* CONFIG_ENGINE = "engine_config";
@ -205,7 +209,8 @@ static const std::unordered_map<std::string, std::string> milvus_config_version_
{"0.10.2", "0.5"},
{"0.10.3", "0.5"},
{"0.10.4", "0.5"},
{"0.10.5", "0.5"}});
{"0.10.5", "0.5"},
{"0.10.6", "0.5"}});
/////////////////////////////////////////////////////////////
Config::Config() {
@ -366,6 +371,12 @@ Config::ValidateConfig() {
std::string metric_port;
STATUS_CHECK(GetMetricConfigPort(metric_port));
std::string metric_cluster_label;
STATUS_CHECK(GetMetricConfigClusterLabel(metric_cluster_label));
std::string metric_instance_label;
STATUS_CHECK(GetMetricConfigInstanceLabel(metric_instance_label));
/* cache config */
int64_t cache_cpu_cache_capacity;
STATUS_CHECK(GetCacheConfigCpuCacheCapacity(cache_cpu_cache_capacity));
@ -2342,6 +2353,18 @@ Config::GetMetricConfigPort(std::string& value) {
return CheckMetricConfigPort(value);
}
Status
Config::GetMetricConfigClusterLabel(std::string& value) {
value = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_CLUSTER_LABEL, CONFIG_METRIC_CLUSTER_LABEL_DEFAULT);
return Status::OK();
}
Status
Config::GetMetricConfigInstanceLabel(std::string& value) {
value = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_INSTANCE_LABEL, CONFIG_METRIC_INSTANCE_LABEL_DEFAULT);
return Status::OK();
}
/* cache config */
Status
Config::GetCacheConfigCpuCacheCapacity(int64_t& value) {

View File

@ -401,6 +401,10 @@ class Config {
GetMetricConfigAddress(std::string& value);
Status
GetMetricConfigPort(std::string& value);
Status
GetMetricConfigClusterLabel(std::string& value);
Status
GetMetricConfigInstanceLabel(std::string& value);
/* cache config */
Status

View File

@ -32,23 +32,27 @@ PrometheusMetrics::Init() {
}
// Following should be read from config file.
std::string server_port, push_port, push_address;
std::string server_port, push_port, push_address, cluster_label, instance_label;
STATUS_CHECK(config.GetNetworkConfigBindPort(server_port));
STATUS_CHECK(config.GetMetricConfigPort(push_port));
STATUS_CHECK(config.GetMetricConfigAddress(push_address));
STATUS_CHECK(config.GetMetricConfigClusterLabel(cluster_label));
STATUS_CHECK(config.GetMetricConfigInstanceLabel(instance_label));
const std::string uri = std::string("/metrics");
// const std::size_t num_threads = 2;
std::string hostportstr;
char hostname[1024];
if (gethostname(hostname, sizeof(hostname)) == 0) {
hostportstr = std::string(hostname) + ":" + server_port;
} else {
hostportstr = "pushgateway";
if (instance_label.empty()) {
char hostname[1024];
if (gethostname(hostname, sizeof(hostname)) == 0) {
instance_label = std::string(hostname) + ":" + server_port;
} else {
instance_label = "pushgateway";
}
}
auto labels = prometheus::Gateway::GetInstanceLabel(hostportstr);
auto labels = prometheus::Gateway::Labels{{"cluster", cluster_label}, {"instance", instance_label}};
// Init pushgateway
gateway_ = std::make_shared<prometheus::Gateway>(push_address, push_port, "milvus_metrics", labels);

View File

@ -306,7 +306,6 @@ ClientTest::Test() {
BuildSearchEntities(NQ, dim);
GetEntityByID(collection_name, search_id_array_);
// SearchEntities(collection_name, TOP_K, NPROBE);
SearchEntitiesByID(collection_name, TOP_K, NPROBE);
CreateIndex(collection_name, INDEX_TYPE, NLIST);
GetCollectionStats(collection_name);

View File

@ -6,7 +6,7 @@ pipeline {
}
parameters{
string defaultValue: '0.10.5', description: 'server image version', name: 'IMAGE_VERSION', trim: true
string defaultValue: '0.10.6', description: 'server image version', name: 'IMAGE_VERSION', trim: true
choice choices: ['single', 'shards'], description: 'server deploy mode', name: 'DEPLOY_MODE'
string defaultValue: '010_data.json', description: 'test suite config yaml', name: 'CONFIG_FILE', trim: true
string defaultValue: 'shards.json', description: 'shards test suite config yaml', name: 'SHARDS_CONFIG_FILE', trim: true
@ -15,9 +15,9 @@ pipeline {
environment {
HELM_URL = "https://github.com/milvus-io/milvus-helm.git"
HELM_BRANCH = "0.10.4"
HELM_BRANCH = "0.10.5"
TEST_URL = "git@192.168.1.105:Test/milvus_benchmark.git"
TEST_BRANCH = "0.10.5"
TEST_BRANCH = "0.10.6"
TEST_LIB_URL = "http://192.168.1.105:6060/Test/milvus_metrics.git"
HELM_RELEASE_NAME = "milvus-benchmark-test-${env.BUILD_NUMBER}"
HELM_SHARDS_RELEASE_NAME = "milvus-shards-benchmark-test-${env.BUILD_NUMBER}"

View File

@ -1,7 +1,7 @@
import logging
import pytest
__version__ = '0.10.5'
__version__ = '0.10.6'
class TestPing: