Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
7b099888
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
Fork自
milvus / milvus
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
7b099888
编写于
5月 08, 2020
作者:
C
caosiyang
提交者:
GitHub
5月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #2248: use hostname and port as instance label of metrics (#2249)
Signed-off-by:
N
caosiyang
<
csy3228@gmail.com
>
上级
104cda1a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
2 deletion
+13
-2
CHANGELOG.md
CHANGELOG.md
+1
-0
core/src/metrics/prometheus/PrometheusMetrics.cpp
core/src/metrics/prometheus/PrometheusMetrics.cpp
+12
-2
未找到文件。
CHANGELOG.md
浏览文件 @
7b099888
...
...
@@ -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
...
...
core/src/metrics/prometheus/PrometheusMetrics.cpp
浏览文件 @
7b099888
...
...
@@ -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
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录