Promscale has been discontinued. We strongly recommend that you do not use Promscale in a production environment. Learn more.
Promscale supports Prometheus recording rules. These rules are used to calculate frequently used or computationally expensive queries before they are required. A recording rule is a PromQL expression that Prometheus evaluates at a predefined frequency to generate a new metric series. The new metric series is stored in Promscale, and you can query it in the same way as any other Prometheus metric. In Promscale, you can set the recording rules similar to Prometheus rules configuration.
Promscale recording rules are built on top of
Prometheus recording rules capabilities. The
recording rules are written in a
file and specified in the Promscale configuration
The recording rules are used for computationally
expensive expressions and save
their result as a new set of time series data.
These help in visualization of
data over a long period of time.
YAMLfile that contains the configuration for each record, similar to:groups:- name: daily_statsinterval: 1hrules:- record: customer:api_requests:rate1dayexpr: sum by (customer) (rate(api_requests_total[1d]))
Load the rules
YAMLfile to Promscale by specifying this file in Prometheus configuration format along with
global evaluation interval, and
rules filesconfiguration:global:evaluation_interval: 10srule_files:- "<rules-file>"
Pass this configuration file to Promscale when you start the service, using the
To query the recorded metric with PromQL use metric name as:
To query the metric with SQL:
SELECT time, jsonb(labels) as metric, valueFROM "customer:api_requests:rate1day"ORDER BY time ASC
For more information about recording, see Prometheus recording.
For specific information about recording rules, see Prometheus recording rules.