MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / genCommonWheres

Method genCommonWheres

module/catalogue/iml.go:159–184  ·  view source on GitHub ↗
(ctx context.Context, clusterIds ...string)

Source from the content-addressed store, hash-verified

157}
158
159func (i *imlCatalogueModule) genCommonWheres(ctx context.Context, clusterIds ...string) ([]monitor.MonWhereItem, error) {
160
161 clusters, err := i.clusterService.List(ctx, clusterIds...)
162 if err != nil {
163 return nil, err
164 }
165 clusterIds = utils.SliceToSlice(clusters, func(item *cluster.Cluster) string {
166 return item.Uuid
167 })
168
169 wheres := make([]monitor.MonWhereItem, 0, 1)
170 nodes, err := i.clusterService.Nodes(ctx, clusterIds...)
171 if err != nil {
172 return nil, err
173 }
174 nodeIds := utils.SliceToSlice(nodes, func(s *cluster.Node) string {
175 return s.Name
176 })
177 wheres = append(wheres, monitor.MonWhereItem{
178 Key: "node",
179 Operation: "in",
180 Values: nodeIds,
181 })
182
183 return wheres, nil
184}
185
186func (i *imlCatalogueModule) ProviderStatistics(ctx context.Context, start, end time.Time, serviceIds ...string) (map[string]int64, error) {
187 // 判断是否配置influxdb

Callers 1

ProviderStatisticsMethod · 0.95

Calls 2

ListMethod · 0.65
NodesMethod · 0.65

Tested by

no test coverage detected