(ctx context.Context, orgID uuid.UUID, tw *biz.TimeWindow, projectIDs []uuid.UUID)
| 46 | } |
| 47 | |
| 48 | func (repo *OrgMetricsRepo) RunsTotal(ctx context.Context, orgID uuid.UUID, tw *biz.TimeWindow, projectIDs []uuid.UUID) (int32, error) { |
| 49 | ctx, span := otelx.Start(ctx, orgMetricsRepoTracer, "OrgMetricsRepo.RunsTotal") |
| 50 | defer span.End() |
| 51 | |
| 52 | wfQuery := orgScopedQuery(repo.data.DB, orgID). |
| 53 | QueryWorkflows() |
| 54 | |
| 55 | if projectIDs != nil { |
| 56 | wfQuery = wfQuery.Where(workflow.ProjectIDIn(projectIDs...)) |
| 57 | } |
| 58 | |
| 59 | total, err := wfQuery.WithProject(). |
| 60 | QueryWorkflowruns(). |
| 61 | Where( |
| 62 | workflowrun.CreatedAtGTE(tw.From), |
| 63 | workflowrun.CreatedAtLTE(tw.To), |
| 64 | ). |
| 65 | Count(ctx) |
| 66 | |
| 67 | if err != nil { |
| 68 | return 0, err |
| 69 | } |
| 70 | |
| 71 | return int32(total), nil |
| 72 | } |
| 73 | |
| 74 | func (repo *OrgMetricsRepo) RunsByStatusTotal(ctx context.Context, orgID uuid.UUID, tw *biz.TimeWindow, projectIDs []uuid.UUID) (map[string]int32, error) { |
| 75 | ctx, span := otelx.Start(ctx, orgMetricsRepoTracer, "OrgMetricsRepo.RunsByStatusTotal") |
nothing calls this directly
no test coverage detected