(ctx context.Context, input *monitor_dto.StatisticInput)
| 569 | } |
| 570 | |
| 571 | func (i *imlMonitorStatisticModule) SubscriberStatistics(ctx context.Context, input *monitor_dto.StatisticInput) ([]*monitor_dto.ServiceStatisticBasicItem, error) { |
| 572 | clusterId := cluster.DefaultClusterID |
| 573 | _, err := i.clusterService.Get(ctx, clusterId) |
| 574 | if err != nil { |
| 575 | return nil, err |
| 576 | } |
| 577 | |
| 578 | apps, err := i.serviceService.AppList(ctx, input.Services...) |
| 579 | if err != nil { |
| 580 | return nil, err |
| 581 | } |
| 582 | apps = append(apps, &service.Service{ |
| 583 | Id: "apipark-global", |
| 584 | Name: "System Consumer", |
| 585 | }) |
| 586 | appIds := utils.SliceToSlice(apps, func(p *service.Service) string { |
| 587 | return p.Id |
| 588 | }) |
| 589 | |
| 590 | wheres, err := i.genCommonWheres(ctx, clusterId) |
| 591 | if err != nil { |
| 592 | return nil, err |
| 593 | } |
| 594 | |
| 595 | if len(appIds) > 0 { |
| 596 | wheres = append(wheres, monitor.MonWhereItem{ |
| 597 | Key: "app", |
| 598 | Operation: "in", |
| 599 | Values: appIds, |
| 600 | }) |
| 601 | } |
| 602 | |
| 603 | return i.serviceStatistics(ctx, clusterId, apps, "app", formatTimeByMinute(input.Start), formatTimeByMinute(input.End), wheres, 0) |
| 604 | } |
| 605 | |
| 606 | func (i *imlMonitorStatisticModule) serviceStatistics(ctx context.Context, clusterId string, services []*service.Service, groupBy string, start time.Time, end time.Time, wheres []monitor.MonWhereItem, limit int) ([]*monitor_dto.ServiceStatisticBasicItem, error) { |
| 607 | statisticMap, err := i.statistics(ctx, clusterId, groupBy, start, end, wheres, limit) |
nothing calls this directly
no test coverage detected