mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 03:18:29 +08:00
Signed-off-by: caosiyang <csy3228@gmail.com>
This commit is contained in:
parent
104cda1a76
commit
7b0998885c
@ -48,6 +48,7 @@ Please mark all change in change log and use the issue from GitHub
|
||||
- \#2185 Change id to string format in http module
|
||||
- \#2186 Update endpoints in http module
|
||||
- \#2190 Fix memory usage is twice of index size when using GPU searching
|
||||
- \#2248 Use hostname and port as instance label of metrics
|
||||
- \#2252 Upgrade mishards to v0.9.0
|
||||
|
||||
## Task
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "metrics/SystemInfo.h"
|
||||
#include "utils/Log.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@ -31,14 +32,23 @@ PrometheusMetrics::Init() {
|
||||
}
|
||||
|
||||
// Following should be read from config file.
|
||||
std::string push_port, push_address;
|
||||
std::string server_port, push_port, push_address;
|
||||
CONFIG_CHECK(config.GetServerConfigPort(server_port));
|
||||
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;
|
||||
|
||||
auto labels = prometheus::Gateway::GetInstanceLabel("pushgateway");
|
||||
std::string hostportstr;
|
||||
char hostname[1024];
|
||||
if (gethostname(hostname, sizeof(hostname)) == 0) {
|
||||
hostportstr = std::string(hostname) + ":" + server_port;
|
||||
} else {
|
||||
hostportstr = "pushgateway";
|
||||
}
|
||||
|
||||
auto labels = prometheus::Gateway::GetInstanceLabel(hostportstr);
|
||||
|
||||
// Init pushgateway
|
||||
gateway_ = std::make_shared<prometheus::Gateway>(push_address, push_port, "milvus_metrics", labels);
|
||||
|
Loading…
Reference in New Issue
Block a user