Skip to content

Commit

Permalink
Update component/component/common.libsonnet
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBigLee committed Nov 17, 2023
1 parent 26a4794 commit 71f25eb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions component/component/common.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ local generatePrometheusNonSLORules(serviceName, memoryContainerName, additional
},
forProvider+: {
manifest+: {
apiVersion: 'monitoring.coreos.com/v1',
kind: 'PrometheusRule',
metadata: {
apiVersion: 'monitoring.coreos.com/v1',
kind: 'PrometheusRule',
name: '%s-rules' % serviceNameLower,
},
spec: {
Expand Down Expand Up @@ -242,11 +242,11 @@ local generatePrometheusNonSLORules(serviceName, memoryContainerName, additional
alert: serviceName + 'MemoryCritical',
name: std.asciiLower(serviceName) + '-memory',
annotations: {
description: 'The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 90% for 2 hours.\n Please reducde the load of this instance, or increase the memory.',
description: 'The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 85% for 2 hours.\n Please reducde the load of this instance, or increase the memory.',
// runbook_url: 'TBD',
summary: 'Memory usage critical',
},
expr: std.strReplace(topPod('(container_memory_working_set_bytes{container="%s"} / on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"} * 100) > 90') % memoryContainerName, toReplace, 'vshn-' + serviceNameLower),
expr: std.strReplace(topPod('(container_memory_working_set_bytes{container="%s"} / on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"} * 100) > 85') % memoryContainerName, toReplace, 'vshn-' + serviceNameLower),
'for': '120m',
labels: {
severity: 'critical',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,9 @@ spec:
spec:
forProvider:
manifest:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
name: postgresql-rules
spec:
groups:
Expand Down Expand Up @@ -1006,12 +1006,12 @@ spec:
- alert: PostgreSQLMemoryCritical
annotations:
description: |-
The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 90% for 2 hours.
The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 85% for 2 hours.
Please reducde the load of this instance, or increase the memory.
summary: Memory usage critical
expr: label_replace( topk(1, (container_memory_working_set_bytes{container="patroni"} /
on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"}
* 100) > 90) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace)
* 100) > 85) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace)
kube_namespace_labels, "name", "$1", "namespace", "vshn-postgresql-(.+)-.+")
for: 120m
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,9 @@ spec:
spec:
forProvider:
manifest:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
name: postgresql-rules
spec:
groups:
Expand Down Expand Up @@ -1108,12 +1108,12 @@ spec:
- alert: PostgreSQLMemoryCritical
annotations:
description: |-
The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 90% for 2 hours.
The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 85% for 2 hours.
Please reducde the load of this instance, or increase the memory.
summary: Memory usage critical
expr: label_replace( topk(1, (container_memory_working_set_bytes{container="patroni"} /
on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"}
* 100) > 90) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace)
* 100) > 85) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace)
kube_namespace_labels, "name", "$1", "namespace", "vshn-postgresql-(.+)-.+")
for: 120m
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ spec:
spec:
forProvider:
manifest:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
name: redis-rules
spec:
groups:
Expand Down Expand Up @@ -143,12 +143,12 @@ spec:
- alert: redisMemoryCritical
annotations:
description: |-
The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 90% for 2 hours.
The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 85% for 2 hours.
Please reducde the load of this instance, or increase the memory.
summary: Memory usage critical
expr: label_replace( topk(1, (container_memory_working_set_bytes{container="redis"} /
on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"}
* 100) > 90) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace)
* 100) > 85) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace)
kube_namespace_labels, "name", "$1", "namespace", "vshn-redis-(.+)-.+")
for: 120m
labels:
Expand Down

0 comments on commit 71f25eb

Please sign in to comment.