Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana-cloud/observe-and-act/adaptive-telemetry/adaptive-metrics/create-rules.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/observe-and-act/adaptive-telemetry/adaptive-metrics/create-rules/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
Create rules
Create and manage rules using the UI, API, or Terraform. This topic focuses on how to manage your rules using the Grafana UI.
To manage rules using the API or Terraform, refer to Adaptive Metrics HTTP API or Adaptive Metrics Terraform provider.
A rule determines how your metrics are aggregated or dropped. Rules are active configurations that are either created by applying a recommendation or created manually.
Rules define which metrics to aggregate, which labels to drop, and which aggregation functions to apply, for example, sum, count, or average.
Create rules using the UI
Create a rule to manage your metric data. These rules are applied in real-time as data is ingested and are used to reduce metric cardinality and control costs.
You can create two types of rules: aggregation rules to combine series, or drop rules to discard data entirely.
View a list of all rules on the Configuration page, on its Rules tab, where you can also edit and delete existing rules. Open a rule there to edit or remove it. The Metrics page shows your metrics and the recommendations made for them, and doesn’t create or edit rules.
Note
If auto-apply is on for the current segment, you can still create and edit rules. Auto-apply doesn’t modify affix (prefix or suffix) aggregation rules or drop rules. It can remove or replace exact-match aggregation rules. To keep an exact-match rule in place, create an exemption for that metric. For more information, refer to Enable auto-apply.
Create aggregation rules
Create aggregation rules to combine multiple time series into a smaller, more manageable set. This is the most common way to reduce cardinality while retaining important data.
For example, you might combine data from many different instance labels into a single series for a job.
Navigate to Adaptive Metrics.
Navigate to Configuration, select the Rules tab, and click New rule.
Choose a Match type.
- Exact: The rule applies only to the metric name that perfectly matches your entry.
- Prefix: The rule applies to all metrics that begin with your entry (for example,
http_server_). - Suffix: The rule applies to all metrics that end with your entry (for example,
_total).
Enter the Metric name, or part of the name to match (for example,
http_server_requests_seconds_sum).Set Rule type to Aggregate.
Choose the Functions to aggregate the data with.
- count: Count the number of series.
- sum: Add the values together.
- min: Keep the lowest value.
- max: Keep the highest value.
- sum:counter: Count a running sum of increases.
Set the Label policy to specify which labels to change.
This is the most critical step for reducing cardinality. You decide what to do with the labels of the selected metrics.
- Keep labels (Default): You select a list of labels to preserve, and all other labels are dropped. This is useful when you only care about a few specific dimensions.
- Drop labels: The inverse. You select a list of labels to remove, and the system aggregates all series that are identical after those labels are removed. For example, dropping the instance label combines all series for a job, regardless of which instance they came from.
Then select the specific labels, for example
instance,pod, orip, from the dropdown list that you want to either keep or drop.Optionally, set the aggregation interval and delay.
- Interval: How often an aggregated sample is written. One of 6s, 10s, 15s, 20s, 30s, or 60s.
- Delay: How long to wait for late samples before aggregating. One of 15s, 30s, 60s, 90s, 120s, 150s, or 180s.
Leave either field blank to use the system default. Each field lists the values it accepts, so check the form rather than this page if they differ.
These fields accept only the durations listed. Any Prometheus duration spelling that adds up to an accepted value works, so
1mis accepted for a 60s interval, and the form restates it in whole seconds after you save. A duration outside the accepted set is rejected in the form, before it reaches the server.Click Save.
Create drop rules
Create drop rules to completely discard metrics that match your criteria. This should be used with caution for metrics you know are not needed.
Navigate to Adaptive Metrics.
Navigate to Configuration, select the Rules tab, and click New rule.
Choose a Match type.
- Exact: The rule applies only to the metric name that perfectly matches your entry.
- Prefix: The rule applies to all metrics that begin with your entry (for example,
http_server_). - Suffix: The rule applies to all metrics that end with your entry (for example,
_total).
Enter the Metric name, or part of the name to match, for example,
http_server_requests_seconds_sum.Set Rule type to Drop.
Click Save.
Was this page helpful?
Related resources from Grafana Labs


