MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / genCommonWheres

Method genCommonWheres

module/monitor/iml.go:970–995  ·  view source on GitHub ↗
(ctx context.Context, clusterIds ...string)

Source from the content-addressed store, hash-verified

968}
969
970func (i *imlMonitorStatisticModule) genCommonWheres(ctx context.Context, clusterIds ...string) ([]monitor.MonWhereItem, error) {
971
972 clusters, err := i.clusterService.List(ctx, clusterIds...)
973 if err != nil {
974 return nil, err
975 }
976 clusterIds = utils.SliceToSlice(clusters, func(item *cluster.Cluster) string {
977 return item.Uuid
978 })
979
980 wheres := make([]monitor.MonWhereItem, 0, 1)
981 nodes, err := i.clusterService.Nodes(ctx, clusterIds...)
982 if err != nil {
983 return nil, err
984 }
985 nodeIds := utils.SliceToSlice(nodes, func(s *cluster.Node) string {
986 return s.Name
987 })
988 wheres = append(wheres, monitor.MonWhereItem{
989 Key: "node",
990 Operation: "in",
991 Values: nodeIds,
992 })
993
994 return wheres, nil
995}
996
997func (i *imlMonitorStatisticModule) statistics(ctx context.Context, clusterId string, groupBy string, start, end time.Time, wheres []monitor.MonWhereItem, limit int) (map[string]monitor.MonCommonData, error) {
998 statisticMap, _ := i.monitorStatisticCacheService.GetStatisticsCache(ctx, clusterId, start, end, groupBy, wheres, limit)

Callers 15

genOverviewWhereMethod · 0.95
ApiStatisticsMethod · 0.95
SubscriberStatisticsMethod · 0.95
ProviderStatisticsMethod · 0.95
APITrendMethod · 0.95
ProviderTrendMethod · 0.95
SubscriberTrendMethod · 0.95
statisticOnApiMethod · 0.95

Calls 2

ListMethod · 0.65
NodesMethod · 0.65

Tested by

no test coverage detected