Recording Rules

Recording rules in Kloudfuse transform and aggregate metrics according to predefined expressions, reducing data storage and query costs. You can modify these rules by updating the configuration in your Kloudfuse file and redeploying the Helm release to apply the changes.

Periodically, you must update the recording rules for metrics. Follow these steps:

  1. Add the following configuration for recording rules to the Kloudfuse custom_values.yaml file.

  2. Change the rule name and expression as necessary.

      rulemanager:
        rules:
          groups:
          - name: recording_rules
            rules:
              - record: application_availability_slo (1)
                expr: sum by (kube_cluster_name, kube_service) (increase(promhttp_metric_handler_requests_total{code=~"2.*"}[28d])) / sum by (kube_cluster_name, kube_service) (increase(promhttp_metric_handler_requests_total{code=~"2.*|5.*"}[28d]))
    yaml
    1 Defines a new metric application_availability_slo using the rule specified in the expr field.
  3. If adding multiple rules, then add them to a group of its own, MyGroup:

      rulemanager:
        rules:
          ...
          MyGroup:
          - name: my_group_rules
            rules:
              - record: rule_name_1
                expr: sum by (kube_cluster_name, kube_service) (increase(promhttp_metric_handler_requests_total{code=~"2.*"}[28d])) / sum by (kube_cluster_name, kube_service) (increase(promhttp_metric_handler_requests_total{code=~"2.*|5.*"}[28d]))
    yaml
  4. Reinstall the Helm release.