Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
b435c422
M
milvus
项目概览
milvus
/
milvus
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
b435c422
编写于
2月 21, 2022
作者:
C
cai.zhang
提交者:
GitHub
2月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add prometheus metrics for IndexCoord (#15638)
Signed-off-by:
N
cai.zhang
<
cai.zhang@zilliz.com
>
上级
7a782546
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
93 addition
and
5 deletion
+93
-5
internal/indexcoord/index_coord.go
internal/indexcoord/index_coord.go
+14
-0
internal/indexcoord/meta_table.go
internal/indexcoord/meta_table.go
+5
-0
internal/indexcoord/node_manager.go
internal/indexcoord/node_manager.go
+4
-0
internal/metrics/indexcoord_metrics.go
internal/metrics/indexcoord_metrics.go
+70
-0
internal/metrics/metrics.go
internal/metrics/metrics.go
+0
-5
未找到文件。
internal/indexcoord/index_coord.go
浏览文件 @
b435c422
...
...
@@ -27,6 +27,8 @@ import (
"syscall"
"time"
"github.com/milvus-io/milvus/internal/metrics"
"go.etcd.io/etcd/api/v3/mvccpb"
"go.uber.org/zap"
...
...
@@ -392,6 +394,7 @@ func (i *IndexCoord) BuildIndex(ctx context.Context, req *indexpb.BuildIndexRequ
},
},
err
}
metrics
.
IndexCoordIndexRequestCounter
.
WithLabelValues
(
metrics
.
TotalLabel
)
.
Inc
()
log
.
Debug
(
"IndexCoord building index ..."
,
zap
.
Int64
(
"IndexBuildID"
,
req
.
IndexBuildID
),
zap
.
String
(
"IndexName = "
,
req
.
IndexName
),
...
...
@@ -445,6 +448,7 @@ func (i *IndexCoord) BuildIndex(ctx context.Context, req *indexpb.BuildIndexRequ
if
err
!=
nil
{
ret
.
Status
.
ErrorCode
=
commonpb
.
ErrorCode_UnexpectedError
ret
.
Status
.
Reason
=
err
.
Error
()
metrics
.
IndexCoordIndexRequestCounter
.
WithLabelValues
(
metrics
.
FailLabel
)
.
Inc
()
return
ret
,
nil
}
log
.
Debug
(
"IndexCoord BuildIndex Enqueue successfully"
,
zap
.
Int64
(
"IndexBuildID"
,
t
.
indexBuildID
))
...
...
@@ -454,11 +458,13 @@ func (i *IndexCoord) BuildIndex(ctx context.Context, req *indexpb.BuildIndexRequ
log
.
Error
(
"IndexCoord scheduler index task failed"
,
zap
.
Int64
(
"IndexBuildID"
,
t
.
indexBuildID
))
ret
.
Status
.
ErrorCode
=
commonpb
.
ErrorCode_UnexpectedError
ret
.
Status
.
Reason
=
err
.
Error
()
metrics
.
IndexCoordIndexRequestCounter
.
WithLabelValues
(
metrics
.
FailLabel
)
.
Inc
()
return
ret
,
nil
}
sp
.
SetTag
(
"IndexCoord-IndexBuildID"
,
strconv
.
FormatInt
(
t
.
indexBuildID
,
10
))
ret
.
Status
.
ErrorCode
=
commonpb
.
ErrorCode_Success
ret
.
IndexBuildID
=
t
.
indexBuildID
metrics
.
IndexCoordIndexRequestCounter
.
WithLabelValues
(
metrics
.
SuccessLabel
)
.
Inc
()
return
ret
,
nil
}
...
...
@@ -736,6 +742,7 @@ func (i *IndexCoord) recycleUnusedIndexFiles() {
log
.
Debug
(
"IndexCoord recycleUnusedIndexFiles"
,
zap
.
Int64
(
"Recycle the low version index files successfully of the index with indexBuildID"
,
meta
.
indexMeta
.
IndexBuildID
))
}
metrics
.
IndexCoordIndexTaskCounter
.
WithLabelValues
(
metrics
.
RecycledIndexTaskLabel
)
.
Inc
()
}
}
}
...
...
@@ -823,6 +830,13 @@ func (i *IndexCoord) watchMetaLoop() {
zap
.
Int64
(
"Finish by IndexNode"
,
indexMeta
.
NodeID
),
zap
.
Int64
(
"The version of the task"
,
indexMeta
.
Version
))
i
.
nodeManager
.
pq
.
IncPriority
(
indexMeta
.
NodeID
,
-
1
)
metrics
.
IndexCoordIndexTaskCounter
.
WithLabelValues
(
metrics
.
InProgressIndexTaskLabel
)
.
Dec
()
if
indexMeta
.
State
==
commonpb
.
IndexState_Finished
{
metrics
.
IndexCoordIndexTaskCounter
.
WithLabelValues
(
metrics
.
FinishedIndexTaskLabel
)
.
Inc
()
}
if
indexMeta
.
State
==
commonpb
.
IndexState_Failed
{
metrics
.
IndexCoordIndexTaskCounter
.
WithLabelValues
(
metrics
.
FailedIndexTaskLabel
)
.
Inc
()
}
}
case
mvccpb
.
DELETE
:
log
.
Debug
(
"IndexCoord watchMetaLoop DELETE"
,
zap
.
Int64
(
"The meta has been deleted of indexBuildID"
,
indexBuildID
))
...
...
internal/indexcoord/meta_table.go
浏览文件 @
b435c422
...
...
@@ -23,6 +23,8 @@ import (
"strconv"
"sync"
"github.com/milvus-io/milvus/internal/metrics"
"go.uber.org/zap"
"github.com/golang/protobuf/proto"
...
...
@@ -159,6 +161,7 @@ func (mt *metaTable) AddIndex(indexBuildID UniqueID, req *indexpb.BuildIndexRequ
},
revision
:
0
,
}
metrics
.
IndexCoordIndexTaskCounter
.
WithLabelValues
(
metrics
.
UnissuedIndexTaskLabel
)
.
Inc
()
return
mt
.
saveIndexMeta
(
meta
)
}
...
...
@@ -185,6 +188,8 @@ func (mt *metaTable) BuildIndex(indexBuildID UniqueID, nodeID int64) error {
}
meta
.
indexMeta
.
NodeID
=
nodeID
meta
.
indexMeta
.
State
=
commonpb
.
IndexState_InProgress
metrics
.
IndexCoordIndexTaskCounter
.
WithLabelValues
(
metrics
.
UnissuedIndexTaskLabel
)
.
Dec
()
metrics
.
IndexCoordIndexTaskCounter
.
WithLabelValues
(
metrics
.
InProgressIndexTaskLabel
)
.
Inc
()
err
:=
mt
.
saveIndexMeta
(
&
meta
)
if
err
!=
nil
{
...
...
internal/indexcoord/node_manager.go
浏览文件 @
b435c422
...
...
@@ -21,6 +21,8 @@ import (
"sync"
"time"
"github.com/milvus-io/milvus/internal/metrics"
"go.uber.org/zap"
grpcindexnodeclient
"github.com/milvus-io/milvus/internal/distributed/indexnode/client"
...
...
@@ -74,6 +76,7 @@ func (nm *NodeManager) RemoveNode(nodeID UniqueID) {
delete
(
nm
.
nodeClients
,
nodeID
)
nm
.
lock
.
Unlock
()
nm
.
pq
.
Remove
(
nodeID
)
metrics
.
IndexCoordIndexNodeNum
.
WithLabelValues
(
"index_node_num"
)
.
Dec
()
}
// AddNode adds the client of IndexNode.
...
...
@@ -94,6 +97,7 @@ func (nm *NodeManager) AddNode(nodeID UniqueID, address string) error {
log
.
Error
(
"IndexCoord NodeManager"
,
zap
.
Any
(
"Add node err"
,
err
))
return
err
}
metrics
.
IndexCoordIndexNodeNum
.
WithLabelValues
(
"index_node_num"
)
.
Inc
()
return
nm
.
setClient
(
nodeID
,
nodeClient
)
}
...
...
internal/metrics/indexcoord_metrics.go
0 → 100644
浏览文件 @
b435c422
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package
metrics
import
(
"github.com/milvus-io/milvus/internal/util/typeutil"
"github.com/prometheus/client_golang/prometheus"
)
const
(
SuccessLabel
=
"success"
FailLabel
=
"fail"
TotalLabel
=
"total"
UnissuedIndexTaskLabel
=
"unissued"
InProgressIndexTaskLabel
=
"in-progress"
FinishedIndexTaskLabel
=
"finished"
FailedIndexTaskLabel
=
"failed"
RecycledIndexTaskLabel
=
"recycled"
)
var
(
// IndexCoordIndexRequestCounter records the number of the index requests.
IndexCoordIndexRequestCounter
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
milvusNamespace
,
Subsystem
:
typeutil
.
IndexCoordRole
,
Name
:
"index_req_counter"
,
Help
:
"The number of requests to build index"
,
},
[]
string
{
"status"
})
// IndexCoordIndexTaskCounter records the number of index tasks of each type.
IndexCoordIndexTaskCounter
=
prometheus
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Namespace
:
milvusNamespace
,
Subsystem
:
typeutil
.
IndexCoordRole
,
Name
:
"index_task_counter"
,
Help
:
"The number of index tasks of each type"
,
},
[]
string
{
"type"
})
// IndexCoordIndexNodeNum records the number of IndexNodes managed by IndexCoord.
IndexCoordIndexNodeNum
=
prometheus
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Namespace
:
milvusNamespace
,
Subsystem
:
typeutil
.
IndexCoordRole
,
Name
:
"index_node_num"
,
Help
:
"The number of IndexNodes managed by IndexCoord"
,
},
[]
string
{
"type"
})
)
//RegisterIndexCoord registers IndexCoord metrics
func
RegisterIndexCoord
()
{
prometheus
.
MustRegister
(
IndexCoordIndexRequestCounter
)
prometheus
.
MustRegister
(
IndexCoordIndexTaskCounter
)
prometheus
.
MustRegister
(
IndexCoordIndexNodeNum
)
}
internal/metrics/metrics.go
浏览文件 @
b435c422
...
...
@@ -640,11 +640,6 @@ func RegisterDataNode() {
prometheus
.
MustRegister
(
DataNodeWatchDmChannelsCounter
)
}
//RegisterIndexCoord registers IndexCoord metrics
func
RegisterIndexCoord
()
{
}
//RegisterIndexNode registers IndexNode metrics
func
RegisterIndexNode
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录