mirror of https://github.com/milvus-io/milvus.git
Fix query cluster metrics (#18725)
Signed-off-by: longjiquan <jiquan.long@zilliz.com> Signed-off-by: longjiquan <jiquan.long@zilliz.com>pull/18290/head
parent
e05e9cb9b4
commit
cf730f6fcd
|
@ -460,8 +460,9 @@ func (c *queryNodeCluster) SyncReplicaSegments(ctx context.Context, leaderID Uni
|
||||||
}
|
}
|
||||||
|
|
||||||
type queryNodeGetMetricsResponse struct {
|
type queryNodeGetMetricsResponse struct {
|
||||||
resp *milvuspb.GetMetricsResponse
|
resp *milvuspb.GetMetricsResponse
|
||||||
err error
|
err error
|
||||||
|
nodeID UniqueID // used when error occurred.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *queryNodeCluster) GetMetrics(ctx context.Context, in *milvuspb.GetMetricsRequest) []queryNodeGetMetricsResponse {
|
func (c *queryNodeCluster) GetMetrics(ctx context.Context, in *milvuspb.GetMetricsRequest) []queryNodeGetMetricsResponse {
|
||||||
|
@ -470,13 +471,15 @@ func (c *queryNodeCluster) GetMetrics(ctx context.Context, in *milvuspb.GetMetri
|
||||||
cnt := len(c.nodes)
|
cnt := len(c.nodes)
|
||||||
wg.Add(cnt)
|
wg.Add(cnt)
|
||||||
respChan := make(chan queryNodeGetMetricsResponse, cnt)
|
respChan := make(chan queryNodeGetMetricsResponse, cnt)
|
||||||
for _, node := range c.nodes {
|
for nodeID, node := range c.nodes {
|
||||||
|
nodeID := nodeID
|
||||||
go func(node Node) {
|
go func(node Node) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
resp, err := node.getMetrics(ctx, in)
|
resp, err := node.getMetrics(ctx, in)
|
||||||
respChan <- queryNodeGetMetricsResponse{
|
respChan <- queryNodeGetMetricsResponse{
|
||||||
resp: resp,
|
resp: resp,
|
||||||
err: err,
|
err: err,
|
||||||
|
nodeID: nodeID,
|
||||||
}
|
}
|
||||||
}(node)
|
}(node)
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,9 +98,8 @@ func getSystemInfoMetrics(
|
||||||
BaseComponentInfos: metricsinfo.BaseComponentInfos{
|
BaseComponentInfos: metricsinfo.BaseComponentInfos{
|
||||||
HasError: true,
|
HasError: true,
|
||||||
ErrorReason: nodeMetrics.err.Error(),
|
ErrorReason: nodeMetrics.err.Error(),
|
||||||
// Name doesn't matter here because we can't get it when error occurs, using address as the Name?
|
Name: metricsinfo.ConstructComponentName(typeutil.QueryNodeRole, nodeMetrics.nodeID),
|
||||||
Name: "",
|
ID: int64(uniquegenerator.GetUniqueIntGeneratorIns().GetInt()),
|
||||||
ID: int64(uniquegenerator.GetUniqueIntGeneratorIns().GetInt()),
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue