Recording Rule
You can find documentation on Prometheus Query Language on the web:
Recording Rule creation with PromQLβ
To create a Recording Rule with PromQL, go to recording rule page and create a new recording rule.


You can write your promql in the first part, if the promql is error-free, it will display the result in the graph with the number of metric it generates at that moment.
You can add threshold warning and/or critical and a name, this name will be used as metric name in status dashboard and notifications.
If you don't set thresholds, you can use the metrics generated by the recording rule in dashboards, but there will be no alerts.
Example: Cassandraβ
We have several Cassandra servers running on our Kubernetes, we want to generate one metric to add it to a dashboard and notify us when the sum of the containers' cpu usage exceeds 50% (warning) and 60% (critical).
If you have a notification rule that triggers all the problems, then there's nothing more to do, otherwise you need to create a notification rule with the recording rule.
PromQL:
sum(container_cpu_used{item=~"k8s_cassandra_cassandra.*"})
~"k8s_cassandra_cassandra.*" This allows you to find all the containers whose item name begins with k8s_cassandra_cassandra
