-
Notifications
You must be signed in to change notification settings - Fork 302
Recording Rule uwm stage #7553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recording Rule uwm stage #7553
Conversation
gcpsoares
commented
Aug 8, 2025
- Include uwm recording rules in stage.
Signed-off-by: Gabriel Soares <[email protected]>
Signed-off-by: Gabriel Soares <[email protected]>
Code Review by Gemini### `components/monitoring/prometheus/staging/base/prometheusrule-uwm/prometheusrule-uwm-namespace.yaml`
**Issue 1: PrometheusRule name is generic**
The `PrometheusRule` name `prometheus-recording-rules-namespace` is quite generic. Given that this rule is specifically for User Workload Monitoring (UWM), it would be clearer to include `uwm` in the name to indicate its purpose and avoid potential naming conflicts with other generic rules.
```diff
--- a/components/monitoring/prometheus/staging/base/prometheusrule-uwm/prometheusrule-uwm-namespace.yaml
+++ b/components/monitoring/prometheus/staging/base/prometheusrule-uwm/prometheusrule-uwm-namespace.yaml
@@ -2,7 +2,7 @@
kind: PrometheusRule
metadata:
- name: prometheus-recording-rules-namespace
+ name: uwm-recording-rules-namespace
namespace: openshift-user-workload-monitoring
spec:
groups:
Issue 2: Group name is very verbose --- a/components/monitoring/prometheus/staging/base/prometheusrule-uwm/prometheusrule-uwm-namespace.yaml
+++ b/components/monitoring/prometheus/staging/base/prometheusrule-uwm/prometheusrule-uwm-namespace.yaml
@@ -5,7 +5,7 @@
namespace: openshift-user-workload-monitoring
spec:
groups:
- - name: rules_container_memory_working_set_bytes_namespace_container
+ - name: uwm-container-memory-rules
rules:
- expr: |
avg by (namespace,container) (rate(container_memory_working_set_bytes{job="kubelet", metrics_path="/metrics/cadvisor", image!=""}[5m]))
Issue 3: Missing newline at end of file --- a/components/monitoring/prometheus/staging/base/prometheusrule-uwm/prometheusrule-uwm-namespace.yaml
+++ b/components/monitoring/prometheus/staging/base/prometheusrule-uwm/prometheusrule-uwm-namespace.yaml
@@ -9,4 +9,5 @@
- expr: |
avg by (namespace,container) (rate(container_memory_working_set_bytes{job="kubelet", metrics_path="/metrics/cadvisor", image!=""}[5m]))
record: namespace_container:container_memory_working_set_bytes
-\ No newline at end of file
+
|
Signed-off-by: Gabriel Soares <[email protected]>
Code Review by Gemini```diff
--- a/components/monitoring/prometheus/staging/stone-stg-rh01/prometheusrule-uwm.yaml
+++ b/components/monitoring/prometheus/staging/stone-stg-rh01/prometheusrule-uwm.yaml
@@ -4,7 +4,7 @@
namespace: openshift-user-workload-monitoring
spec:
groups:
- - name: rules_container_memory_working_set_bytes_namespace_container
+ - name: uwm_container_memory_rules
rules:
- expr: |
avg by (namespace,container) (rate(container_memory_working_set_bytes{job="kubelet", metrics_path="/metrics/cadvisor", image!=""}[5m])) |
Signed-off-by: Gabriel Soares <[email protected]>
Code Review by Gemini### components/monitoring/prometheus/staging/base/kustomization.yaml
**Improvement:**
The commit message "Include uwm recording rules in stage" suggests that the PrometheusRule should be applied to all staging environments, not just a specific one. To achieve this, the `prometheusrule-uwm.yaml` should be included in the `staging/base` kustomization, making it a common resource for all clusters inheriting from this base.
```diff
--- a/components/monitoring/prometheus/staging/base/kustomization.yaml
+++ b/components/monitoring/prometheus/staging/base/kustomization.yaml
@@ -1,15 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base/uwm-config
- ../../base/external-secrets
- ../../base/observability-operator
- ../../base/rbac
- monitoringstack/
+- prometheusrule-uwm.yaml # Add this line
patches:
- path: rhobs-secret-path.yaml
target:
name: rhobs
kind: ExternalSecret
group: external-secrets.io
components/monitoring/prometheus/staging/stone-stg-rh01/kustomization.yamlImprovement: --- a/components/monitoring/prometheus/staging/stone-stg-rh01/kustomization.yaml
+++ b/components/monitoring/prometheus/staging/stone-stg-rh01/kustomization.yaml
@@ -1,12 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
-- prometheusrule-uwm.yaml # Remove this line
patches:
- path: cluster-id-label.yaml
target:
name: appstudio-federate-ms
kind: MonitoringStack
group: monitoring.rhobs
components/monitoring/prometheus/staging/base/prometheusrule-uwm.yaml (New File)Improvement: # Create this new file: components/monitoring/prometheus/staging/base/prometheusrule-uwm.yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: prometheus-recording-rules-uwm-namespace
namespace: openshift-user-workload-monitoring
spec:
groups:
- name: rules_container_memory_working_set_bytes_namespace_container
rules:
- expr: |
avg by (namespace,container) (rate(container_memory_working_set_bytes{job="kubelet", metrics_path="/metrics/cadvisor", image!=""}[5m]))
record: namespace_container:container_memory_working_set_bytes
components/monitoring/prometheus/staging/stone-stg-rh01/prometheusrule-uwm.yamlImprovement: --- a/components/monitoring/prometheus/staging/stone-stg-rh01/prometheusrule-uwm.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: monitoring.coreos.com/v1
-kind: PrometheusRule
-metadata:
- name: prometheus-recording-rules-uwm-namespace
- namespace: openshift-user-workload-monitoring
-spec:
- groups:
- - name: rules_container_memory_working_set_bytes_namespace_container
- rules:
- - expr: |
- avg by (namespace,container) (rate(container_memory_working_set_bytes{job="kubelet", metrics_path="/metrics/cadvisor", image!=""}[5m]))
- record: namespace_container:container_memory_working_set_bytes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gcpsoares, mftb The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |