Skip to content

Usage

Using Enrichment data in Fitness Functions

Fitness functions utilize enrichment records by referencing the enrichment domain and the lookup key. The enrichment domain represents the name of the domain created in the previous step, while the lookup key corresponds to the key in the enrichment domain used for matching the enrichment data with the fitness score data.

Configuration

To enrich tags, you need to configure the "enrichTags" objects within the Fitness Functions. Each key-value pair will create a new tag when the Fitness Function is processed. The value consists of the following components:

  • Separator: The first character serves as the delimiter for the remaining values. Posible values are: $, ., #, _
  • Domain: Specifies the name of the unique domain from which the required value is obtained.
  • Path: Represents the path to search in the EnrichmentCache data that was previously uploaded.
  enrichTags:
    newTagKey1: .<domainName>.<mapping-for-value>
    newTagKey1: .<domainName>.<mapping>.<for>.<value2> # Nested mapping

Sample Enrichment Tags Configuration

The following example shows how to use the enrichment data in a fitness function:

kind: FitnessFunction
apiVersion: fitness.orcasio.com/v1alpha3
metadata:
  name: github-project
  namespace: orcas
spec:
  sensor: sensor://fitness.orcasio.net/github
  source: github
  filters:
    .data.type: project
  aspect: Architecture
  weight: 6
  rule: github-project
  enabled: false
  dryrun: false
  tags:
    pillar: Maturity
    health: Compliance
    app: ".data.response.project.name"
    org: ".data.response.project.organization.login"
    name: ".data.response.project.name"
    id: "john d"
    director: "jane d"
  enrichTags:
    city: .hr.director.city
    director_name: .hr.director.fullname

Looking at the EnrichmentCache that we uploaded in the previous step the enriched tags for this Fitness Function will be:

tags:
  pillar: Maturity
  health: Compliance
  app: ".data.response.project.name"
  org: ".data.response.project.organization.login"
  name: ".data.response.project.name"
  id: "john d"
  director: "jane d"
  city: "anytown"
  director_fullname: "jane dean"