---
title: "Create rules and exemptions | Grafana Labs"
description: "Learn how to create aggregation rules and exemptions to control which metrics are aggregated and which are preserved."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Create rules and exemptions

When automated suggestions aren’t a perfect fit or you want to be more proactive, you can move from accepting recommendations to defining your own logic.

To create rules, complete the following steps:

1. Navigate to **Adaptive Telemetry** &gt; **Adaptive Metrics** &gt; **Rules**.
2. Add a new rule or edit a recommendation.
3. Choose the rule type:
   
   - **Aggregation** to combine similar series and reduce cardinality.
   - **Drop** to stop collecting redundant metrics.
4. Define what the rule targets:
   
   - Enter the metric name or pattern.
   - Select which labels to keep when aggregating (for example, `job`, `instance`).
5. Click **Save**.

## Create exemptions

Create exemptions to prevent certain metrics or labels from being included in recommendations.

1. Navigate to **Adaptive Metrics**.
2. Navigate to the **Configuration** page.
3. Click **Add new exemption**.
4. Choose a **Metric match type** to protect valuable metrics and labels.
   
   - **Exact**: The exemption applies only to the metric name that perfectly matches your entry. This is the default.
   - **Prefix**: The exemption applies to all metrics that begin with your entry (for example, `http_server_`).
   - **Suffix**: The exemption applies to all metrics that end with your entry (for example, `_total`).
5. From the **Metric** dropdown menu, select a metric from the list, or enter a prefix or suffix to match. Toggle the **All** switch to apply this exemption to all metrics.
6. \[Advanced]: Select the **Disable recommendations for this metric and preserve existing rule state** checkbox to stop generating any new recommendations for this metric and if there is an existing rule in place, to keep it.
   
   This is useful if you have manually configured a rule for a critical metric and want to ensure it remains unchanged by automated recommendations.
7. From the **Keep labels** dropdown, select one or more specific labels associated with the chosen metric that you do not want to be aggregated or toggle the **All** switch to keep all labels for the selected metric.
8. \[Optional]: Enter a reason for why the exemption is being created.
   
   This is optional, but can be a crucial step for team collaboration, as it explains the business or technical need for preserving the data.

In the next milestone, you’ll learn how segmentation helps teams manage Adaptive Metrics for their own services.
