Skip to content

Commit 1778835

Browse files
[release-1.10] RHIDP-12601: Scorecard supports custom key values and colors (#2321)
* RHIDP-12601: Scorecard supports custom key values and colors * RHIDP-12601: revised file name and updated assembly * RHIDP-12601: updated YAML example based on dev comments * RHIDP-12601: pushing revised YAML example * RHIDP-12601: updated PR based on review. added reference topic for scorecard color configuration * RHIDP-12601: tshooting build * RHIDP-12601: minor edit * RHIDP-12601: submitting partial edits from dev review * RHIDP-12601: remaining edits from dev review * RHIDP-12601: edits from dev review * RHIDP-12601: edits from peer review --------- Co-authored-by: Tim O'Keefe <tokeefe@redhat.com>
1 parent 942fb83 commit 1778835

3 files changed

Lines changed: 134 additions & 0 deletions

File tree

assemblies/observability_evaluate-project-health-using-scorecards/assembly-scorecard-metric-thresholds.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@ include::../modules/observability_evaluate-project-health-using-scorecards/ref-o
2020

2121
include::../modules/observability_evaluate-project-health-using-scorecards/con-verify-logical-flow-in-scorecard-threshold-rules.adoc[leveloffset=+1]
2222

23+
include::../modules/observability_evaluate-project-health-using-scorecards/proc-configure-custom-severity-levels-and-colors-for-scorecard.adoc[leveloffset=+1]
24+
25+
include::../modules/observability_evaluate-project-health-using-scorecards/ref-scorecard-color-and-icon-configuration-formats.adoc[leveloffset=+1]
26+
2327
ifdef::parent-context[:context: {parent-context}]
2428
ifndef::parent-context[:!context:]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
:_mod-docs-content-type: PROCEDURE
2+
3+
[id="configure-custom-severity-levels-and-colors-for-scorecard_{context}"]
4+
= Configure custom severity levels and colors for Scorecard
5+
6+
[role="_abstract"]
7+
Customizing severity thresholds and color mappings in your Scorecard configuration allows you to visualize platform metrics using your organization's custom operational terminology.
8+
9+
[NOTE]
10+
====
11+
Each custom severity threshold key requires both a corresponding icon configuration value and a color parameter configuration value. The scorecard plugin validates the YAML configuration files during application startup. Omitting either property or providing an invalid value causes an initialization failure, and the Scorecard plugin fails to function.
12+
====
13+
14+
.Prerequisites
15+
* You have administrative access to the {product} configuration files.
16+
* You have added a custom application configuration file to your {product} deployment workspace.
17+
* You have installed Scorecard backend and frontend plugins, and at least one Scorecard plugin module.
18+
19+
.Procedure
20+
21+
. Open the {product-very-short} `app-config.yaml` file.
22+
23+
. Navigate to the `scorecard.plugins` backend threshold definition block.
24+
25+
. Define your custom severity threshold keys by adding a structured rule entry containing your custom key string, your boundary expression, your preferred color parameter format, and a supported icon string variable.
26+
+
27+
[source,yaml]
28+
----
29+
scorecard:
30+
plugins:
31+
myDatasource:
32+
myMetric:
33+
thresholds:
34+
rules:
35+
- key: ideal
36+
expression: '<10'
37+
color: '#5CE65C'
38+
icon: star
39+
- key: warning
40+
expression: '10-50'
41+
color: 'rgb(233, 213, 2)'
42+
icon: monitor
43+
- key: critical
44+
expression: '>50'
45+
color: error.main
46+
icon: scorecardErrorStatusIcon
47+
----
48+
+
49+
where:
50+
51+
`myDatasource`:: represents your specific scorecard data source, such as `jira`
52+
`myMetric`:: represents the metric identifier, such as `open_issues`
53+
+
54+
[NOTE]
55+
====
56+
Custom severity thresholds and color configurations are only functional for scorecard plugin modules that support custom rules. At this time, the `filecheck`, `openssf`, and `dependabot` modules do not support custom thresholds.
57+
====
58+
59+
. Save the changes to the configuration file.
60+
61+
. Restart your {product} instance to apply the new threshold rules.
62+
63+
.Verification
64+
65+
* Open the {product} UI, navigate to the Scorecard component, and verify that the custom severity levels display with the colors and icons you specified.
66+
67+
[role="_additional-resources"]
68+
.Additional resources
69+
70+
* link:https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/html/administration_guide_for_red_hat_developer_hub/assembly-add-custom-app-file-openshift_admin-rhdh[Adding a custom application configuration file to Red Hat OpenShift Container Platform]
71+
* link:https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/html-single/evaluate_project_health_using_scorecards/index#enable-scorecards_set-up-scorecards-to-monitor-your-project-health[Enabling Scorecards]
72+
* link:https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/html-single/evaluate_project_health_using_scorecards/index#install-and-configure-scorecards-to-view-metrics_evaluate-project-health-using-scorecards[Installing and configuring Scorecards to view metrics]
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
:_mod-docs-content-type: REFERENCE
2+
3+
[id="scorecard-color-and-icon-configuration-formats_{context}"]
4+
= Scorecard color and icon configuration formats
5+
6+
[role="_abstract"]
7+
Learn the supported color string formats and syntax rules required to map custom severity threshold keys in the configuration parser.
8+
9+
== Threshold color mapping values
10+
[cols="1,2",options="header"]
11+
|===
12+
|Color format type |Configuration examples
13+
|Theme palette references
14+
|`success.main`, `warning.main`, `error.main`
15+
|HEX hexadecimal codes
16+
|`'#5CE65C'`, `'#FFA500'`
17+
|RGB or RGBA functional strings
18+
|`'rgb(233, 213, 2)'`, `'rgba(255, 0, 0, 0.8)'`
19+
|===
20+
21+
[NOTE]
22+
====
23+
The default threshold rules use the built-in theme palette references: `success.main` for success states, `warning.main` for warning states, and `error.main` for error states. You can use these standard theme indicators for custom severity levels if desired.
24+
====
25+
26+
[id="scorecard-icon-configuration-formats_{context}"]
27+
== Supported threshold icon configuration formats
28+
29+
To determine what graphic displays in the metrics matrix block, the Scorecard plugin uses standard frontend mapping components, allowing you to specify icons using any of the following parameters.
30+
31+
[NOTE]
32+
====
33+
When using Material Design strings, use only icons from the internal icon catalog, such as `star` or `monitor`. Standard upstream values that are not added, such as `check`, will not appear in the user interface. You can use default icons or extend the icon set with dynamic plugins.
34+
====
35+
36+
== Threshold icon component options
37+
[cols="1,2",options="header"]
38+
|===
39+
|Icon syntax layout |Value definition format examples
40+
|Backstage system icons
41+
|`'kind:component'`, `'kind:api'`
42+
|Material Design icon strings
43+
|`'home'`, `'star'`, `'monitor'`
44+
|Inline SVG strings
45+
|Raw XML element blocks (for example, `'<svg>...</svg>'`)
46+
|External URLs
47+
|`'https://example.com/icon.png'`, `'/assets/icon.svg'`
48+
|Data encoded URIs
49+
|`'data:image/svg+xml;base64,...'`
50+
|===
51+
52+
[NOTE]
53+
====
54+
The default threshold rules use pre-configured icons:
55+
`scorecardSuccessStatusIcon` for success rule matches,
56+
`scorecardWarningStatusIcon` for warning rule matches, and
57+
`scorecardErrorStatusIcon` for error rule matches. You can use these pre-configured icons for custom severity levels if desired.
58+
====

0 commit comments

Comments
 (0)