Scorecards as code
Last updated
Last updated
Once Scorecards are incorporated into your regular engineering workflows, they become production-grade tools. Scorecards set the benchmarks for how your organization defines “good,” which impacts everything from security standards to on-call rotations. Because Scorecards are crucial to achieving and maintaining standards, you likely want to employ some kind of controlled access and version controlling.
With Scorecards as code, you can treat your Scorecard like any other production asset. This feature lets you manage Scorecards through GitOps, just like you’d manage the entities in your catalogs. Every Scorecard has its own YAML file (you can learn more about Scorecard YAML formatting below under GitOps Scorecard best practices). When GitOps is enabled, changes made to Scorecards will appear in GitOps logs, just like when changes are made to other entities.
To migrate to Scorecards as code:
Navigate to Settings > GitOps then click the Scorecards tab.
Toggle off the Enable Scorecard UI editor option.
To convert an existing Scorecard into code:
Navigate to the Scorecard's details page.
Click the vertical ellipsis (⋮
), then click Export CSV.
This will download a YAML version of your Scorecard.
Managing Scorecards via GitOps is designed to reduce as much friction as possible, so you can continue to make the most of this flexible tool.
In general, the best place to put Scorecards is in their own repository, separate from catalog entities, at the repository's root directory within .cortex/scorecards
. Note that it is not recommended to put Scorecard definitions in a service repository as Scorecards are not meant to be 1:1 with catalog entitites. For example, a simple repository might have the structure:
Any file found within the .cortex/scorecards
directory will be automatically picked up and parsed as a Scorecard.
The dora-metrics-scorecard.yaml
descriptor file might look something like this:
name
description
name
The human-readable name of the Scorecard
tag
A unique slug for the Scorecard consisting of only alphanumeric characters and dashes
description
A human-readable description of the Scorecard
draft
Whether or not the Scorecard is a draft
notifications
Notifications settings for the Scorecard
ladder
The ladder to apply to the rules
rules
A list of rules that are evaluated each time the Scorecard is evaluated
filter
Enables the ability to exclude entities from being evaluated by this Scorecard
evaluation
Enables the ability to change the evaluation window for this Scorecard
name
description
enabled
Whether or not to include the Scorecard in notifications
scoreDropNotificationsEnabled
Whether to notify about entities' scores that dropped after each evaluation of this Scorecard
name
description
enabled
Whether or not rule exemptions are enabled for Scorecard
autoApprove
Whether or not rule exemptions are auto approved for Scorecard
name
description
levels
The levels of the ladder
name
description
name
The human-readable name of the level
rank
The rank of the Level within the ladder. Higher rank is better.
description
A human-readable description of the level
color
The hex color of the badge that is displayed with the level
name
description
title
The human-readable name of the Rule
expression
The CQL expression to evaluate; must evaluate to a boolean
identifier
Identifier of the rule, unique within Scorecard scope.
description
A human-readable description of the Rule
weight
The number of points this Rule provides when successful
failureMessage
A human-readable message that will be presented when the Rule is failing
level
The name of the level this rule is associated with; can be null even when a ladder is present
filter
Enables the ability to exclude entities from being evaluated for this rule
effectiveFrom
Date when the rule starts being evaluated (e.g. 2024-01-01T00:00:00Z)
name
description
kind
The kind of filter to create. Currently only supports "GENERIC"
types
Types filter (to include / exclude specific types)
groups
Groups filter (to include / exclude specific groups)
query
A CQL query; only entities matching this query will be evaluated by the Scorecard
name
description
include
List of types to include in set of entities
exclude
List of types to exclude in the set of entities
name
description
include
List of groups to include in set of entities
exclude
List of groups to exclude in the set of entities
name
description
window
By default, Scorecards are evaluated every 4 hours. That default can be changed under Settings > Scorecards > Default evaluation window. If you would like to evaluate Scorecards less frequently, you can override the evaluation window. This can help if you're encountering problems with rate limits. Note that Scorecards cannot be evaluated more than once per minimum set in Settings > Scorecards > Minimum evaluation window.