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 {
|
||||
resp *milvuspb.GetMetricsResponse
|
||||
err error
|
||||
resp *milvuspb.GetMetricsResponse
|
||||
err error
|
||||
nodeID UniqueID // used when error occurred.
|
||||
}
|
||||
|
||||
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)
|
||||
wg.Add(cnt)
|
||||
respChan := make(chan queryNodeGetMetricsResponse, cnt)
|
||||
for _, node := range c.nodes {
|
||||
for nodeID, node := range c.nodes {
|
||||
nodeID := nodeID
|
||||
go func(node Node) {
|
||||
defer wg.Done()
|
||||
resp, err := node.getMetrics(ctx, in)
|
||||
respChan <- queryNodeGetMetricsResponse{
|
||||
resp: resp,
|
||||
err: err,
|
||||
resp: resp,
|
||||
err: err,
|
||||
nodeID: nodeID,
|
||||
}
|
||||
}(node)
|
||||
}
|
||||
|
|
|
@ -98,9 +98,8 @@ func getSystemInfoMetrics(
|
|||
BaseComponentInfos: metricsinfo.BaseComponentInfos{
|
||||
HasError: true,
|
||||
ErrorReason: nodeMetrics.err.Error(),
|
||||
// Name doesn't matter here because we can't get it when error occurs, using address as the Name?
|
||||
Name: "",
|
||||
ID: int64(uniquegenerator.GetUniqueIntGeneratorIns().GetInt()),
|
||||
Name: metricsinfo.ConstructComponentName(typeutil.QueryNodeRole, nodeMetrics.nodeID),
|
||||
ID: int64(uniquegenerator.GetUniqueIntGeneratorIns().GetInt()),
|
||||
},
|
||||
})
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue