|
| 1 | +--- |
| 2 | +title: Aggregation Rules |
| 3 | +sidebar_label: Aggregation Rules |
| 4 | +sidebar_position: 8 |
| 5 | +description: Learn how to create aggregation rules to roll up metrics from entities to hierarchy levels. |
| 6 | +keywords: |
| 7 | + - aggregation rules |
| 8 | + - metrics rollup |
| 9 | + - hierarchy aggregation |
| 10 | + - DORA metrics |
| 11 | +tags: |
| 12 | + - catalog |
| 13 | + - aggregation |
| 14 | + - metrics |
| 15 | +--- |
| 16 | + |
| 17 | +Aggregation rules allow you to roll up metrics from lower-level entities to higher levels in the organizational hierarchy. This enables you to view aggregated metrics at account, organization, and project levels, providing insights into performance across your entire platform. |
| 18 | + |
| 19 | +:::info |
| 20 | +Aggregation Rules are behind a feature flag. Contact your Harness representative to enable this feature. |
| 21 | +::: |
| 22 | + |
| 23 | +## Overview |
| 24 | + |
| 25 | +Aggregation rules compute aggregate values (sum, average, maximum, minimum, median) from entity properties and display them on hierarchy entities. |
| 26 | + |
| 27 | +:::note |
| 28 | +Aggregations are always computed from the source entities (typically components) to hierarchy entities. When you select multiple roll-up scopes (project, organization, account), the aggregation is calculated from all matching source entities at each level, not by aggregating the already-aggregated values. |
| 29 | +::: |
| 30 | + |
| 31 | +**Example use cases:** |
| 32 | + |
| 33 | +- Aggregate DORA metrics (deployment frequency, change failure rate) from service components to project, organization, and account entities |
| 34 | +- Roll up test coverage metrics from service components to organization and account levels |
| 35 | +- Compute account-wide metrics by aggregating from all service components across the account |
| 36 | + |
| 37 | +:::note |
| 38 | +These are just examples. Aggregation rules work with any custom metric or property you've added to your entities, not just DORA or test coverage metrics. |
| 39 | +::: |
| 40 | + |
| 41 | +The aggregated values are stored as metadata properties on hierarchy entities and can be displayed using [hierarchy entity layouts](/docs/internal-developer-portal/layout-and-appearance/catalog#hierarchy-entity-layouts). |
| 42 | + |
| 43 | +## Accessing Aggregation Rules |
| 44 | + |
| 45 | +Navigate to **Configure** → **Integrations** → **Aggregation Rules** to view and manage your aggregation rules. |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +## Creating an Aggregation Rule |
| 52 | + |
| 53 | + |
| 54 | +Click **New Aggregation Rule** to open the aggregation rule form. The form is organized into two main sections: |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +### Section 1: Basic Details |
| 60 | + |
| 61 | +Configure the metric and how it should be aggregated: |
| 62 | + |
| 63 | +#### Metric / Field to Aggregate |
| 64 | + |
| 65 | +Enter the property path in the entity YAML (e.g., `metadata.changeFailureRatePercent`). |
| 66 | + |
| 67 | +**Finding the field path:** |
| 68 | + |
| 69 | +To find the correct field path, view the YAML of an entity that has the property you want to aggregate. The field path is the dot-notation path to that property. |
| 70 | + |
| 71 | +Example: If your entity YAML has: |
| 72 | +```yaml |
| 73 | +metadata: |
| 74 | + changeFailureRatePercent: 10 |
| 75 | +``` |
| 76 | +
|
| 77 | +The field path is: `metadata.changeFailureRatePercent` |
| 78 | + |
| 79 | +#### Aggregation Formula |
| 80 | + |
| 81 | +Choose how multiple values should be combined: |
| 82 | + |
| 83 | +- **Average** - Calculate the mean of all values |
| 84 | +- **Sum** - Add all values together |
| 85 | +- **Median** - Take the middle value |
| 86 | +- **Min** - Take the lowest value |
| 87 | +- **Max** - Take the highest value |
| 88 | + |
| 89 | +#### Aggregation Property Name |
| 90 | + |
| 91 | +Enter a name for the aggregated property. This will become the property name on hierarchy entities (e.g., `Max Change Failure Rate`). |
| 92 | + |
| 93 | +#### Description (optional) |
| 94 | + |
| 95 | +Provide an optional description for the aggregation rule. |
| 96 | + |
| 97 | +### Section 2: At What Levels Should This Be Aggregated |
| 98 | + |
| 99 | +Configure where and from which entities the aggregation should be computed: |
| 100 | + |
| 101 | +#### Roll-up Scope |
| 102 | + |
| 103 | +Select at which hierarchy levels you want to see the aggregated value: |
| 104 | + |
| 105 | +- **Project** - Display aggregated value on project entities |
| 106 | +- **Organization** - Display aggregated value on organization entities |
| 107 | +- **Account** - Display aggregated value on account entities |
| 108 | +- **System** - Display aggregated value on system entities |
| 109 | + |
| 110 | + |
| 111 | +:::info |
| 112 | +You can select multiple levels. At each level, the aggregation is computed from all matching source entities (defined by your entity filters), not by aggregating the values from the level below. |
| 113 | +For example, if you select Project, Organization, and Account: |
| 114 | +- Project entities will show the aggregate of all matching components in that project |
| 115 | +- Organization entities will show the aggregate of all matching components across all projects in that organization |
| 116 | +- Account entities will show the aggregate of all matching components across the entire account |
| 117 | +::: |
| 118 | + |
| 119 | +#### Configure Entities to Aggregate Metric From |
| 120 | + |
| 121 | +Define which entities to include in the aggregation. All filters are combined with AND logic: |
| 122 | + |
| 123 | +- **Aggregation Scope** - Filter by scope (e.g., select specific account/org/project or leave as default for all) |
| 124 | +- **Entity Kind** - Select the kind of entities to aggregate (e.g., `Component` or `hierarchy`) |
| 125 | +- **Entity Type** - Filter by entity type (e.g., `service`, or select `all`) |
| 126 | +- **Owners** (optional) - Filter by entity owners |
| 127 | +- **Tags** (optional) - Filter by entity tags |
| 128 | +- **Lifecycle** (optional) - Filter by lifecycle stage |
| 129 | + |
| 130 | + |
| 131 | +## Aggregation Use Cases |
| 132 | + |
| 133 | +### Use Case 1: DORA Metrics from CD Integration |
| 134 | + |
| 135 | +Aggregate DORA metrics that are ingested from CD integration to hierarchy entities. |
| 136 | + |
| 137 | +**Example:** Roll up deployment frequency and change failure rate from service components to projects, organizations, and account. |
| 138 | + |
| 139 | +```yaml |
| 140 | +Field to Aggregate: metadata.changeFailureRatePercent |
| 141 | +Rule Name: Max Change Failure Rate |
| 142 | +Formula: Maximum |
| 143 | +Roll-up Scope: Project, Organization, Account |
| 144 | +Entity Kind: Component |
| 145 | +Type: service |
| 146 | +``` |
| 147 | + |
| 148 | +**Result:** The maximum change failure rate across all services will be displayed on project, organization, and account entities as `metadata.Max Change Failure Rate`. |
| 149 | + |
| 150 | +### Use Case 2: Custom Ingested Properties |
| 151 | + |
| 152 | +Aggregate custom properties that you've ingested into entities using the [Catalog Ingestion API](/docs/internal-developer-portal/catalog/integrate-tools/catalog-ingestion-api). |
| 153 | + |
| 154 | +**Example:** Aggregate MTTR (Mean Time To Recovery) from service components. |
| 155 | + |
| 156 | +```yaml |
| 157 | +Field to Aggregate: metadata.mttr |
| 158 | +Rule Name: Max MTTR |
| 159 | +Formula: Maximum |
| 160 | +Roll-up Scope: Project, Organization |
| 161 | +Entity Kind: Component |
| 162 | +Type: service |
| 163 | +``` |
| 164 | + |
| 165 | +**Result:** The maximum MTTR value will be available as `metadata.Max MTTR` on project and organization entities. |
| 166 | + |
| 167 | +### Use Case 3: Hierarchical Aggregation |
| 168 | + |
| 169 | +Aggregate properties from hierarchy entities (projects) to higher levels (organizations, account). |
| 170 | + |
| 171 | +**Example:** Roll up test coverage from projects to organizations. |
| 172 | + |
| 173 | +```yaml |
| 174 | +Field to Aggregate: metadata.qa.integrationTestCoverage |
| 175 | +Rule Name: Avg Unit Test Coverage |
| 176 | +Formula: Average |
| 177 | +Roll-up Scope: Organization, Account |
| 178 | +Entity Kind: hierarchy |
| 179 | +Type: project |
| 180 | +``` |
| 181 | + |
| 182 | +**Result:** The average test coverage across all projects will be displayed on organization and account entities as `metadata.Avg Unit Test Coverage`. |
| 183 | + |
| 184 | +## Managing Aggregation Rules |
| 185 | + |
| 186 | +### Compute on Demand |
| 187 | + |
| 188 | +Click the **⋮** (three dots) menu next to an aggregation rule and select **Compute** to manually trigger computation. This is useful when you want to see updated values immediately. |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | +### Edit an Aggregation Rule |
| 193 | + |
| 194 | +1. Click the **⋮** menu next to the rule |
| 195 | +2. Select **Edit** |
| 196 | +3. Make your changes |
| 197 | +4. Click **Save** |
| 198 | + |
| 199 | +The rule will be recomputed automatically after saving. |
| 200 | + |
| 201 | +### Delete an Aggregation Rule |
| 202 | + |
| 203 | +1. Click the **⋮** menu next to the rule |
| 204 | +2. Select **Delete** |
| 205 | +3. Confirm the deletion |
| 206 | + |
| 207 | +:::warning |
| 208 | +When you delete an aggregation rule, all aggregated values created by that rule will be removed from hierarchy entities. If you have layout components referencing the deleted property, they will show a dash (-) or empty value. |
| 209 | +::: |
0 commit comments