Skip to content

Commit

Permalink
Add recording rule to collect migrations data to telemetry. (#1172)
Browse files Browse the repository at this point in the history
Following the request of adding recording rule in
openshift/cluster-monitoring-operator#2461

Signed-off-by: Bella Khizgiyaev <[email protected]>
  • Loading branch information
bkhizgiy authored Nov 25, 2024
1 parent 371e0a0 commit fc1f358
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions operator/config/rbac/leader_election_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ rules:
- monitoring.coreos.com
resources:
- servicemonitors
- prometheusrules
verbs:
- get
- create
Expand Down
1 change: 1 addition & 0 deletions operator/roles/forkliftcontroller/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,5 @@ metric_service_name: "{{ app_name }}-metrics"
metric_servicemonitor_name: "{{ app_name }}-metrics"
metric_interval: "30s"
metric_port_name: "metrics"
metrics_rule_name: "{{app_name}}-migration-rules"

5 changes: 5 additions & 0 deletions operator/roles/forkliftcontroller/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
k8s:
state: present
definition: "{{ lookup('template', 'monitor/servicemonitor-metrics.yml.j2') }}"

- name: "Setup migration recording rules"
k8s:
state: present
definition: "{{ lookup('template', 'monitor/recordingrole-migrations.yml.j2') }}"

- name: "Add monitoring label to namespace"
k8s:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ metrics_rule_name }}
namespace: {{ app_namespace }}
spec:
groups:
- name: mtv-migrations
rules:
- record: cluster:mtv_migrations_status_total:max
expr: max by(status, provider, mode, target) (mtv_migrations_status_total)
labels:
app: {{ app_name }}

0 comments on commit fc1f358

Please sign in to comment.