Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ include::../modules/observability_evaluate-project-health-using-scorecards/ref-o

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

include::../modules/observability_evaluate-project-health-using-scorecards/proc-configure-custom-severity-levels-and-colors-for-scorecard.adoc[leveloffset=+1]

include::../modules/observability_evaluate-project-health-using-scorecards/ref-scorecard-color-configuration-formats.adoc[leveloffset=+1]

ifdef::parent-context[:context: {parent-context}]
ifndef::parent-context[:!context:]
Comment thread
rh-tokeefe marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
:_mod-docs-content-type: PROCEDURE

[id="configure-custom-severity-levels-and-colors-for-scorecard_{context}"]
= Configure custom severity levels and colors for Scorecard

[role="_abstract"]
Customizing severity thresholds and color mappings in your Scorecard configuration allows you to visualize platform metrics using your organization's custom operational terminology.

[NOTE]
====
Each custom severity threshold key requires both a corresponding icon configuration value and a color parameter configuration value. Because the portal 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.
====

.Prerequisites
* You have administrative access to the {product} configuration files.
* You have added a custom application configuration file to your {product} deployment workspace.
* An existing configuration for the Scorecard backend plugin is deployed with at least one active Scorecard plugin module workspace.

.Procedure

. Open the {product-very-short} `app-config.yaml` file.

. Navigate to the `scorecard.plugins` backend threshold definition block.

. 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.
+
[source,yaml]
----
scorecard:
plugins:
myDatasource:
myMetric:
thresholds:
rules:
- key: ideal
expression: '<10'
color: '#5CE65C'
icon: star
- key: warning
expression: '10-50'
color: 'rgb(233, 213, 2)'
icon: monitor
- key: critical
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to use as examples icons that work in rhdh by default (check and error are not ingested in rhdh, so they won't appear):

scorecard:
  plugins:
    myDatasource:
      myMetric:
        thresholds:
          rules:
            - key: ideal
              expression: "<10"
              color: "#5CE65C"
              icon: star
            - key: warning
              expression: 10-50
              color: "rgb(233, 213, 2)"
              icon: monitor
            - key: critical
              expression: ">50"
              color: error.main
              icon: scorecardErrorStatusIcon

I have updated icons to the ones that will work. I have updated colors to be clearly different from the default ones (default dark green is now light green, default orange is now yellow). I have updated keys to be the custom ones instead of default success, warning, error. The critical key shows default color and icon example.

It would be also great if you could mention information about what icons are accepted:
Icon configuration - supports multiple formats:

  • Backstage system icons: 'kind:component', 'kind:api', etc.
  • Material Design icons: 'settings', 'home', 'build', etc. = NOTE that from these, only the ones that are ingested in RHDH actually work - e.g check doesn't work
  • SVG strings: '...'
  • URLs: 'https://example.com/icon.png', '/assets/icon.svg'
  • Data URIs: 'data:image/svg+xml;base64,...'

Threshold rules 'success', 'warning' and 'error' have default icons: scorecardSuccess, scorecardWarningStatusIcon, scorecardErrorStatusIcon

I don't know if there is already page about icons in RHDH, since the same logic for providing icons is also for header I think.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the YAML example and added some information in the reference topic.

expression: '>50'
color: error.main
icon: scorecardErrorStatusIcon
----
Comment thread
rh-tokeefe marked this conversation as resolved.

. Save the changes to the configuration file.

. Restart your {product} instance to apply the new threshold rules.

.Verification

* Open the {product} UI, navigate to the Scorecard component, and verify that the custom severity levels display with the colors and icons you specified.

[role="_additional-resources"]
.Additional resources

* 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]
* 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]
* 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]
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
:_mod-docs-content-type: REFERENCE

[id="scorecard-color-configuration-formats_{context}"]
= Scorecard color configuration formats

[role="_abstract"]
Learn the supported color string formats and syntax rules required to map custom severity threshold keys in the configuration parser.

== Threshold color mapping values
[cols="1,2",options="header"]
|===
|Color format type |Configuration examples
|Theme palette references
|`success.main`, `warning.main`, `error.main`
|HEX hexadecimal codes
|`'#5CE65C'`, `'#FFA500'`
|RGB or RGBA functional strings
|`'rgb(233, 213, 2)'`, `'rgba(255, 0, 0, 0.8)'`
|===

[NOTE]
====
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.
====

[id="scorecard-icon-configuration-formats_{context}"]
== Supported threshold icon configuration formats

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.

[NOTE]
====
When using Material Design strings, you must specify icons that are explicitly ingested and bundled inside your Red Hat Developer Hub layout package (such as `star` or `monitor`). Standard upstream values that are not ingested (such as `check`) will not appear in the user interface.
====

== Threshold icon component options
[cols="1,2",options="header"]
|===
|Icon syntax layout |Value definition format examples
|Backstage system icons
|`'kind:component'`, `'kind:api'`
|Material Design icon strings
|`'settings'`, `'home'`, `'build'`, `'star'`, `'monitor'`
|Inline SVG strings
|Raw xml element blocks (for example, `'<svg>...</svg>'`)
|External URLs
|`'https://example.com/icon.png'`, `'/assets/icon.svg'`
|Data encoded URIs
|`'data:image/svg+xml;base64,...'`
|===

[NOTE]
====
The standard threshold keys use pre-configured system definitions by default: `scorecardSuccess` for success rule matches, `scorecardWarningStatusIcon` for warning rule matches, and `scorecardErrorStatusIcon` for error rule matches.
====
Loading