Skip to content

Commit 53fdb59

Browse files
committed
feat(scorecard): support scalar aggregation KPI types
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
1 parent 132f773 commit 53fdb59

48 files changed

Lines changed: 2439 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
@@ -275,6 +275,40 @@ scorecard:
275275
type: statusGrouped
276276
description: This KPI is provide information about whether the license file exists in the repository.
277277
metricId: filecheck.license
278+
totalOpenBugs:
279+
title: Total Open Bugs
280+
description: Sum of open issues across owned entities
281+
type: sum
282+
metricId: jira.open_issues
283+
options:
284+
thresholds:
285+
rules:
286+
- key: success
287+
expression: '>=80'
288+
color: '#6bb300' # green
289+
- key: warning
290+
expression: '<80'
291+
color: 'rgb(224, 189, 108)' # light orange
292+
avgOpenPrs:
293+
title: Average Open PRs
294+
description: Mean open PR count per entity
295+
type: average
296+
metricId: github.open_prs
297+
entitiesWithOpenIssues:
298+
title: Entities with Open Issues
299+
description: Count of entities with a stored open-issues value
300+
type: count
301+
metricId: jira.open_issues
302+
maxOpenPrs:
303+
title: Maximum Open PRs
304+
description: Maximum open PR count per entity
305+
type: max
306+
metricId: github.open_prs
307+
minOpenPrs:
308+
title: Minimum Open PRs
309+
description: Minimum open PR count per entity
310+
type: min
311+
metricId: github.open_prs
278312
plugins:
279313
jira:
280314
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)