Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
688a587f
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
688a587f
编写于
6月 21, 2021
作者:
X
XuanYang-cn
提交者:
GitHub
6月 21, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add metrics in datanode (#5926)
Signed-off-by:
N
yangxuan
<
xuan.yang@zilliz.com
>
上级
65bb336f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
3 deletion
+36
-3
internal/datanode/data_node.go
internal/datanode/data_node.go
+13
-2
internal/metrics/metrics.go
internal/metrics/metrics.go
+23
-1
未找到文件。
internal/datanode/data_node.go
浏览文件 @
688a587f
...
...
@@ -28,6 +28,7 @@ import (
"go.uber.org/zap"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/metrics"
"github.com/milvus-io/milvus/internal/msgstream"
"github.com/milvus-io/milvus/internal/types"
"github.com/milvus-io/milvus/internal/util/sessionutil"
...
...
@@ -42,6 +43,12 @@ import (
const
(
RPCConnectionTimeout
=
30
*
time
.
Second
// MetricRequestsTotal used to count the num of total requests
MetricRequestsTotal
=
"total"
// MetricRequestsSuccess used to count the num of successful requests
MetricRequestsSuccess
=
"success"
)
// DataNode struct communicates with outside services and unioun all
...
...
@@ -246,6 +253,7 @@ func (node *DataNode) UpdateStateCode(code internalpb.StateCode) {
// WatchDmChannels create a new dataSyncService for every unique dmlVchannel name, ignore if dmlVchannel existed.
func
(
node
*
DataNode
)
WatchDmChannels
(
ctx
context
.
Context
,
in
*
datapb
.
WatchDmChannelsRequest
)
(
*
commonpb
.
Status
,
error
)
{
metrics
.
DataNodeWatchDmChannelsCounter
.
WithLabelValues
(
MetricRequestsTotal
)
.
Inc
()
status
:=
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_UnexpectedError
,
}
...
...
@@ -253,11 +261,11 @@ func (node *DataNode) WatchDmChannels(ctx context.Context, in *datapb.WatchDmCha
switch
{
case
node
.
State
.
Load
()
!=
internalpb
.
StateCode_Healthy
:
status
.
Reason
=
fmt
.
Sprintf
(
"DataNode %d not healthy, please re-send message"
,
node
.
NodeID
)
return
status
,
errors
.
New
(
status
.
GetReason
())
return
status
,
nil
case
len
(
in
.
GetVchannels
())
==
0
:
status
.
Reason
=
"Illegal request"
return
status
,
errors
.
New
(
status
.
GetReason
())
return
status
,
nil
default
:
for
_
,
chanInfo
:=
range
in
.
GetVchannels
()
{
...
...
@@ -272,6 +280,7 @@ func (node *DataNode) WatchDmChannels(ctx context.Context, in *datapb.WatchDmCha
status
.
ErrorCode
=
commonpb
.
ErrorCode_Success
log
.
Debug
(
"DataNode WatchDmChannels Done"
)
metrics
.
DataNodeWatchDmChannelsCounter
.
WithLabelValues
(
MetricRequestsSuccess
)
.
Inc
()
return
status
,
nil
}
}
...
...
@@ -345,6 +354,7 @@ func (node *DataNode) ReadyToFlush() error {
//
// There are 1 precondition: The segmentID in req is in ascending order.
func
(
node
*
DataNode
)
FlushSegments
(
ctx
context
.
Context
,
req
*
datapb
.
FlushSegmentsRequest
)
(
*
commonpb
.
Status
,
error
)
{
metrics
.
DataNodeFlushSegmentsCounter
.
WithLabelValues
(
MetricRequestsTotal
)
.
Inc
()
status
:=
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_UnexpectedError
,
}
...
...
@@ -411,6 +421,7 @@ func (node *DataNode) FlushSegments(ctx context.Context, req *datapb.FlushSegmen
log
.
Debug
(
"FlushSegments Done"
)
status
.
ErrorCode
=
commonpb
.
ErrorCode_Success
metrics
.
DataNodeFlushSegmentsCounter
.
WithLabelValues
(
MetricRequestsSuccess
)
.
Inc
()
return
status
,
nil
}
...
...
internal/metrics/metrics.go
浏览文件 @
688a587f
...
...
@@ -14,6 +14,7 @@ const (
milvusNamespace
=
"milvus"
subSystemRootCoord
=
"rootcoord"
subSystemDataCoord
=
"dataCoord"
subSystemDataNode
=
"dataNode"
)
/*
...
...
@@ -247,9 +248,30 @@ func RegisterDataCoord() {
prometheus
.
Register
(
DataCoordDataNodeList
)
}
var
(
// DataNodeFlushSegmentsCounter used to count the num of calls of FlushSegments
DataNodeFlushSegmentsCounter
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
milvusNamespace
,
Subsystem
:
subSystemDataNode
,
Name
:
"flush_segments_total"
,
Help
:
"Counter of flush segments"
,
},
[]
string
{
"type"
})
// DataNodeWatchDmChannelCounter used to count the num of calls of WatchDmChannels
DataNodeWatchDmChannelsCounter
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
milvusNamespace
,
Subsystem
:
subSystemDataNode
,
Name
:
"watch_dm_channels_total"
,
Help
:
"Counter of watch dm channel"
,
},
[]
string
{
"type"
})
)
//RegisterDataNode register DataNode metrics
func
RegisterDataNode
()
{
prometheus
.
Register
(
DataNodeFlushSegmentsCounter
)
prometheus
.
Register
(
DataNodeWatchDmChannelsCounter
)
}
//RegisterIndexCoord register IndexCoord metrics
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录