Skip to content

Commit 22368af

Browse files
committed
feat(scorecard): support scalar aggregation KPI types
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
1 parent 8ce2bdf commit 22368af

48 files changed

Lines changed: 2440 additions & 339 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-scorecard-backend': minor
3+
'@red-hat-developer-hub/backstage-plugin-scorecard-common': minor
4+
'@red-hat-developer-hub/backstage-plugin-scorecard': minor
5+
---
6+
7+
This update introduces new scalar aggregation KPIs in the scorecard configuration, including:
8+
9+
- **`sum`**: Single numeric total of latest metric values across owned entities
10+
- **`average`**: Mean of latest metric values across owned entities
11+
- **`max`**: Maximum latest metric value across owned entities
12+
- **`min`**: Minimum latest metric value across owned entities
13+
- **`count`**: Number of entities with a non-null latest stored value

workspaces/scorecard/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ yarn install
1515
1616
## Documentation
1717

18-
| Topic | Location |
19-
| ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
20-
| Aggregation KPIs (`statusGrouped`, `weightedStatusScore`), API, ownership | [plugins/scorecard-backend/docs/aggregation.md](plugins/scorecard-backend/docs/aggregation.md) |
21-
| Backend installation and RBAC, **`scorecard.aggregationKPIs`** examples | [plugins/scorecard-backend/README.md](plugins/scorecard-backend/README.md) |
22-
| Drill-down (entity list for a metric) | [plugins/scorecard-backend/docs/drill-down.md](plugins/scorecard-backend/docs/drill-down.md) |
23-
| Metric thresholds, annotations, **weightedStatusScore KPI result colors** | [plugins/scorecard-backend/docs/thresholds.md](plugins/scorecard-backend/docs/thresholds.md) |
24-
| Frontend (homepage cards, NFS) | [plugins/scorecard/README.md](plugins/scorecard/README.md) |
18+
| Topic | Location |
19+
| --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
20+
| Aggregation KPIs (`statusGrouped`, `weightedStatusScore`, scalar `sum`/`average`/`max`/`min`/`count`), API, ownership | [plugins/scorecard-backend/docs/aggregation.md](plugins/scorecard-backend/docs/aggregation.md) |
21+
| Backend installation and RBAC, **`scorecard.aggregationKPIs`** examples | [plugins/scorecard-backend/README.md](plugins/scorecard-backend/README.md) |
22+
| Drill-down (entity list for a metric) | [plugins/scorecard-backend/docs/drill-down.md](plugins/scorecard-backend/docs/drill-down.md) |
23+
| Metric thresholds, annotations, **weightedStatusScore KPI result colors** | [plugins/scorecard-backend/docs/thresholds.md](plugins/scorecard-backend/docs/thresholds.md) |
24+
| Frontend (homepage cards, NFS) | [plugins/scorecard/README.md](plugins/scorecard/README.md) |

workspaces/scorecard/app-config.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,40 @@ scorecard:
264264
type: statusGrouped
265265
description: This KPI is provide information about whether the license file exists in the repository.
266266
metricId: filecheck.license
267+
totalOpenBugs:
268+
title: Total Open Bugs
269+
description: Sum of open issues across owned entities
270+
type: sum
271+
metricId: jira.open_issues
272+
options:
273+
thresholds:
274+
rules:
275+
- key: success
276+
expression: '>=80'
277+
color: '#6bb300' # green
278+
- key: warning
279+
expression: '<80'
280+
color: 'rgb(224, 189, 108)' # light orange
281+
avgOpenPrs:
282+
title: Average Open PRs
283+
description: Mean open PR count per entity
284+
type: average
285+
metricId: github.open_prs
286+
entitiesWithOpenIssues:
287+
title: Entities with Open Issues
288+
description: Count of entities with a stored open-issues value
289+
type: count
290+
metricId: jira.open_issues
291+
maxOpenPrs:
292+
title: Maximum Open PRs
293+
description: Maximum open PR count per entity
294+
type: max
295+
metricId: github.open_prs
296+
minOpenPrs:
297+
title: Minimum Open PRs
298+
description: Minimum open PR count per entity
299+
type: min
300+
metricId: github.open_prs
267301
plugins:
268302
jira:
269303
open_issues:

workspaces/scorecard/packages/app-legacy/e2e-tests/pages/HomePage.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ export class HomePage {
6363
cardPattern = /Scorecard:\s*GitHub open PRs|ScorecardGithubHomepage/i;
6464
} else if (cardName === 'Scorecard: Jira open blocking') {
6565
cardPattern = /Scorecard:\s*Jira open blocking|ScorecardJiraHomepage/i;
66-
} else if (cardName === AGGREGATED_CARDS_WIDGET_TITLES.openPrsWeightedKpi) {
66+
} else if (
67+
cardName === AGGREGATED_CARDS_WIDGET_TITLES.gitHubOpenPrsWeightedKpi
68+
) {
6769
cardPattern =
68-
/Scorecard:\s*GitHub open PRs \(weighted health\)|ScorecardOpenPrsWeightedKpi/i;
70+
/Scorecard:\s*GitHub open PRs \(weighted health\)|ScorecardGitHubOpenPrsWeightedKpi/i;
6971
} else {
7072
cardPattern = new RegExp(escapeRegex(cardName), 'i');
7173
}

0 commit comments

Comments
 (0)