mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
Parallel when proxy get metrics from other components (#12980)
Signed-off-by: dragondriver <jiquan.long@zilliz.com>
This commit is contained in:
parent
89d712ebc3
commit
85c93b8844
@ -18,6 +18,7 @@ package proxy
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus/internal/proto/commonpb"
|
"github.com/milvus-io/milvus/internal/proto/commonpb"
|
||||||
|
|
||||||
@ -79,41 +80,70 @@ func getSystemInfoMetrics(
|
|||||||
}
|
}
|
||||||
metricsinfo.FillDeployMetricsWithEnv(&(proxyTopologyNode.Infos.(*metricsinfo.ProxyInfos).SystemInfo))
|
metricsinfo.FillDeployMetricsWithEnv(&(proxyTopologyNode.Infos.(*metricsinfo.ProxyInfos).SystemInfo))
|
||||||
|
|
||||||
queryCoordResp, queryCoordErr := node.queryCoord.GetMetrics(ctx, request)
|
var wg sync.WaitGroup
|
||||||
queryCoordRoleName := ""
|
|
||||||
|
var queryCoordResp *milvuspb.GetMetricsResponse
|
||||||
|
var queryCoordErr error
|
||||||
var queryCoordTopology metricsinfo.QueryCoordTopology
|
var queryCoordTopology metricsinfo.QueryCoordTopology
|
||||||
if queryCoordErr == nil && queryCoordResp != nil {
|
queryCoordRoleName := ""
|
||||||
|
|
||||||
|
var dataCoordResp *milvuspb.GetMetricsResponse
|
||||||
|
var dataCoordErr error
|
||||||
|
var dataCoordTopology metricsinfo.DataCoordTopology
|
||||||
|
dataCoordRoleName := ""
|
||||||
|
|
||||||
|
var indexCoordResp *milvuspb.GetMetricsResponse
|
||||||
|
var indexCoordErr error
|
||||||
|
var indexCoordTopology metricsinfo.IndexCoordTopology
|
||||||
|
indexCoordRoleName := ""
|
||||||
|
|
||||||
|
var rootCoordResp *milvuspb.GetMetricsResponse
|
||||||
|
var rootCoordErr error
|
||||||
|
var rootCoordTopology metricsinfo.RootCoordTopology
|
||||||
|
rootCoordRoleName := ""
|
||||||
|
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
queryCoordResp, queryCoordErr = node.queryCoord.GetMetrics(ctx, request)
|
||||||
queryCoordRoleName = queryCoordResp.ComponentName
|
queryCoordRoleName = queryCoordResp.ComponentName
|
||||||
queryCoordErr = metricsinfo.UnmarshalTopology(queryCoordResp.Response, &queryCoordTopology)
|
queryCoordErr = metricsinfo.UnmarshalTopology(queryCoordResp.Response, &queryCoordTopology)
|
||||||
identifierMap[queryCoordRoleName] = int(queryCoordTopology.Cluster.Self.ID)
|
}()
|
||||||
}
|
|
||||||
|
|
||||||
dataCoordResp, dataCoordErr := node.dataCoord.GetMetrics(ctx, request)
|
wg.Add(1)
|
||||||
dataCoordRoleName := ""
|
go func() {
|
||||||
var dataCoordTopology metricsinfo.DataCoordTopology
|
defer wg.Done()
|
||||||
if dataCoordErr == nil && dataCoordResp != nil {
|
|
||||||
|
dataCoordResp, dataCoordErr = node.dataCoord.GetMetrics(ctx, request)
|
||||||
dataCoordRoleName = dataCoordResp.ComponentName
|
dataCoordRoleName = dataCoordResp.ComponentName
|
||||||
dataCoordErr = metricsinfo.UnmarshalTopology(dataCoordResp.Response, &dataCoordTopology)
|
dataCoordErr = metricsinfo.UnmarshalTopology(dataCoordResp.Response, &dataCoordTopology)
|
||||||
identifierMap[dataCoordRoleName] = int(dataCoordTopology.Cluster.Self.ID)
|
}()
|
||||||
}
|
|
||||||
|
|
||||||
indexCoordResp, indexCoordErr := node.indexCoord.GetMetrics(ctx, request)
|
wg.Add(1)
|
||||||
indexCoordRoleName := ""
|
go func() {
|
||||||
var indexCoordTopology metricsinfo.IndexCoordTopology
|
defer wg.Done()
|
||||||
if indexCoordErr == nil && indexCoordResp != nil {
|
|
||||||
|
indexCoordResp, indexCoordErr = node.indexCoord.GetMetrics(ctx, request)
|
||||||
indexCoordRoleName = indexCoordResp.ComponentName
|
indexCoordRoleName = indexCoordResp.ComponentName
|
||||||
indexCoordErr = metricsinfo.UnmarshalTopology(indexCoordResp.Response, &indexCoordTopology)
|
indexCoordErr = metricsinfo.UnmarshalTopology(indexCoordResp.Response, &indexCoordTopology)
|
||||||
identifierMap[indexCoordRoleName] = int(indexCoordTopology.Cluster.Self.ID)
|
}()
|
||||||
}
|
|
||||||
|
|
||||||
rootCoordResp, rootCoordErr := node.rootCoord.GetMetrics(ctx, request)
|
wg.Add(1)
|
||||||
rootCoordRoleName := ""
|
go func() {
|
||||||
var rootCoordTopology metricsinfo.RootCoordTopology
|
defer wg.Done()
|
||||||
if rootCoordErr == nil && rootCoordResp != nil {
|
|
||||||
|
rootCoordResp, rootCoordErr = node.rootCoord.GetMetrics(ctx, request)
|
||||||
rootCoordRoleName = rootCoordResp.ComponentName
|
rootCoordRoleName = rootCoordResp.ComponentName
|
||||||
rootCoordErr = metricsinfo.UnmarshalTopology(rootCoordResp.Response, &rootCoordTopology)
|
rootCoordErr = metricsinfo.UnmarshalTopology(rootCoordResp.Response, &rootCoordTopology)
|
||||||
identifierMap[rootCoordRoleName] = int(rootCoordTopology.Self.ID)
|
}()
|
||||||
}
|
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
identifierMap[queryCoordRoleName] = int(queryCoordTopology.Cluster.Self.ID)
|
||||||
|
identifierMap[dataCoordRoleName] = int(dataCoordTopology.Cluster.Self.ID)
|
||||||
|
identifierMap[indexCoordRoleName] = int(indexCoordTopology.Cluster.Self.ID)
|
||||||
|
identifierMap[rootCoordRoleName] = int(rootCoordTopology.Self.ID)
|
||||||
|
|
||||||
if queryCoordErr == nil && queryCoordResp != nil {
|
if queryCoordErr == nil && queryCoordResp != nil {
|
||||||
proxyTopologyNode.Connected = append(proxyTopologyNode.Connected, metricsinfo.ConnectionEdge{
|
proxyTopologyNode.Connected = append(proxyTopologyNode.Connected, metricsinfo.ConnectionEdge{
|
||||||
|
Loading…
Reference in New Issue
Block a user