DPF Recording Rule Examples
Recording rules pre-compute the aggregations that the DPF dashboards and alerts depend on. Prometheus evaluates them on a schedule and stores the results as new time series, so panels and alert expressions can read a single cheap series instead of recomputing a multi-way join on every refresh. The manifests live in deploy/helmfiles/prometheus-rules/ together with the alert rules.
The rule groups use a 30s interval:, which matches the default scrape interval for the kube-prometheus-stack and keeps recorded series aligned with their underlying samples. Every recorded series carries labels.service: doca-platform-framework, so it's filterable downstream.
The manifests already carry the release: kube-prometheus-stack label that the default kube-prometheus-stack ruleSelector matches; adjust or drop it in metadata.labels if your Prometheus instance selects rules differently.
DPF Aggregates
Per-CRD ready/total counts and ratios, plus the pre-joined DPUService desired/healthy replica math that the fleet-health dashboard otherwise has to recompute on every refresh. The ready-ratio series feed the "Recording Rule Snapshots" row of the Alerts dashboard, and dpf:dpuservice:not_ready_replicas is what the DPFDPUServiceReplicasNotHealthy alert evaluates against — deploy this manifest before (or together with) dpf-replica-health.yaml, otherwise that alert never fires. Once these are emitted, the fleet-health dashboard's "Desired / Healthy / Not Ready" columns can also be migrated to read dpf:dpuservice:desired_replicas, dpf:dpuservice:healthy_replicas, and dpf:dpuservice:not_ready_replicas directly.
The :ready rules fall back to 0 via or on() vector(0) so the ratio keeps reporting (as 0) during a full outage instead of going stale, and the :total rules count the objects' _created series so objects that have not published conditions yet still count towards the denominator. The replica rules join and group on cluster as well, so the same DPUService running on several DPU clusters aggregates per cluster instead of failing the join with a many-to-many matching error.
Manifest: dpf-aggregates.yaml
|
Record |
Records |
|---|---|
|
|
Number of DPUs with |
|
|
Total number of DPU objects |
|
|
Ready DPUs divided by total DPUs |
|
|
Number of DPUServices with |
|
|
Total number of DPUService objects |
|
|
Ready DPUServices divided by total DPUServices |
|
|
Number of DPUDeployments with |
|
|
Total number of DPUDeployment objects |
|
|
Ready DPUDeployments divided by total DPUDeployments |
|
|
Number of DPUClusters with |
|
|
Total number of DPUCluster objects |
|
|
Ready DPUClusters divided by total DPUClusters |
|
|
Desired workload replicas per DPUService and cluster (DaemonSets and Deployments) |
|
|
Ready workload replicas per DPUService and cluster (DaemonSets and Deployments) |
|
|
Desired minus ready replicas per DPUService and cluster |
DPUCluster Control-Plane Aggregates
Histogram quantiles for API server request duration and etcd request duration, scoped to DPU cluster control planes via cluster!="management". These quantiles are what the DPFDPUClusterAPIServerLatencyHigh and DPFDPUClusterEtcdLatencyHigh alerts evaluate against — deploy this manifest before (or together with) dpucluster-control-plane.yaml.
Manifest: dpucluster-control-plane-aggregates.yaml
|
Record |
Records |
|---|---|
|
|
apiserver p99 request duration per DPUCluster and verb |
|
|
etcd p99 request duration per DPUCluster and operation |
Deploying
The manifests live in deploy/helmfiles/prometheus-rules/ together with the alert rules, and the deploy/helmfiles/monitoring.yaml helmfile applies them automatically via a postsync hook on the kube-prometheus-stack release. To deploy them into an existing Prometheus Operator setup manually:
kubectl apply --server-side -f deploy/helmfiles/prometheus-rules/
Confirm the new series exist:
kubectl -n dpf-operator-system port-forward svc/kube-prometheus-stack-prometheus 9090:9090
curl -sG http://localhost:9090/api/v1/query --data-urlencode 'query=dpf:dpu:ready_ratio'
A non-empty result array confirms the rule group has been picked up and evaluated at least once.
Last updated: