Aggregation rules

Aggregation rules

Aggregation rules combine downsampling (lower sampling rate of metrics) and aggregation (focusing on the metrics important to a use case) to reduce the quantity of stored metrics data, and improve the performance of queries.

Chronosphere offers these types of aggregation rules:

  • Rollup rules aggregate metric data by grouping based on a label or downsample metric data in memory on the streaming ingest path before storing the results in the database. Rollup rules perform better, are more scalable, and require fewer steps to create aggregations.
  • Recording rules ingest the raw metric data first before reading it and then storing the aggregated and downsampled metric data back into the database. Recording rules are backward-compatible with Prometheus setups and support all PromQL functions.
  • Mapping rules downsample in-memory metric data on the streaming ingest path before storing any results in the database. The interval is the time between aggregated data points.

Compare data reduction methods

The following chart compares different methods of reducing incoming or persisted data. Your system needs may dictate a particular use, or indicate changing from one method to another.

Derived metrics and drop rules aren't aggregation rules, but their purpose is to reduce incoming data or cardinality.

Rule TypePurposeBenefits
Drop rulesDrop unused metrics.Fast, persisted data reduction with quick implementation.
Rollup rulesReduce cardinality, downsample data, and perform simple aggregations.Scalable, can drop raw data, and handle late arriving data.
Mapping rulesDownsample or drop metrics.Scalable downsampling of unaggregated metrics.
Recording rulesImprove query performance by pre-executing queries.Execute any PromQL query and add labels.
Derived metricsExecute complex queries in real-time.Replaces most recording rule use cases and doesn't add new time series.

View your aggregation rules

View, sort, and filter existing rollup and mapping rules from the Aggregation Rules page in the Chronosphere app.

Retention policies

Retention policies define the length of time Chronosphere retains metrics data. To view your retention policies, in the navigation menu select Shaping > Ingest Configuration.

Contact your account manager or ask in your support Slack channel to configure the intervals used for your system. These policies might be based on your contract or license.

For example, your system's retention policies might look like:

  • Five days for raw data, and resolutions of 15, 30, and 60 seconds.
  • 120 days for one-minute data.
  • 180 days for one-hour data.
  • 1825 days for 24-hour data.

Rules use the existing, configured set of intervals in rule definitions.

Boilerplate rules

Chronoctl provides boilerplate code for you to base aggregation rules upon. Use the following command to generate the boilerplate:

chronoctl mapping-rules scaffold
chronoctl recording-rules scaffold