Skip to content

Commit

Permalink
rollup apps monitoring and alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
quasystaty1 committed Oct 3, 2024
1 parent b54ccb9 commit 2d2e93e
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 16 deletions.
2 changes: 1 addition & 1 deletion charts/composer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.4
version: 0.1.5

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
21 changes: 21 additions & 0 deletions charts/composer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ Namepsace to deploy elements into.
{{- default .Release.Namespace .Values.global.namespaceOverride | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/*
application name to deploy elements into.
*/}}
{{- define "composer.appName" -}}
composer
{{- end }}

{{/*
Common labels
*/}}
{{- define "composer.labels" -}}
{{ include "rollup.selectorLabels" . }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "composer.selectorLabels" -}}
app: {{ include "rollup.appName" . }}
{{- end }}

{{/*
Single entry of rollup names
*/}}
Expand Down
2 changes: 1 addition & 1 deletion charts/composer/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
ports:
{{- if .Values.metrics.enabled }}
- containerPort: {{ .Values.ports.metrics }}
name: metrics
name: composer-metrics
{{- end }}
- containerPort: {{ .Values.ports.healthApi }}
name: health-api
Expand Down
6 changes: 3 additions & 3 deletions charts/composer/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ spec:
kind: Service
apiVersion: v1
metadata:
name: metrics
name: composer-metrics
namespace: {{ include "composer.namespace" . }}
labels:
app: composer
spec:
selector:
app: composer
ports:
- name: metrics
- name: composer-metrics
port: {{ .Values.ports.metrics }}
targetPort: geth-metr
targetPort: composer-metrics
{{- end }}
2 changes: 1 addition & 1 deletion charts/composer/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
matchLabels:
app: composer
endpoints:
- port: metrics
- port: composer-metrics
path: /
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
Expand Down
23 changes: 23 additions & 0 deletions charts/composer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,29 @@ serviceMonitor:
additionalLabels:
release: kube-prometheus-stack

alerting:
enabled: false
interval: ""
additionalLabels:
release: kube-prometheus-stack
annotations: {}
# scrapeTimeout: 10s
# path: /metrics
prometheusRule:
enabled: true
additionalLabels:
release: kube-prometheus-stack
namespace: monitoring
rules:
- alert: Composer_Node_Down
expr: up{container="composer"} == 0 # Insert your query Expression
for: 1m # Rough number but should be enough to init warn
labels:
severity: warning
annotations:
summary: Composer is Down (instance {{ $labels.instance }})
description: "composer node '{{ $labels.namespace }}' has disappeared from Prometheus target discovery.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"

# When deploying in a production environment should use a secret provider
# This is configured for use with GCP, need to set own resource names
# and keys
Expand Down
2 changes: 1 addition & 1 deletion charts/evm-bridge-withdrawer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.3.0
version: 0.3.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
21 changes: 21 additions & 0 deletions charts/evm-bridge-withdrawer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,24 @@ Namepsace to deploy elements into.
{{- define "evm-bridge-withdrawer.image" -}}
{{ .Values.images.evmBridgeWithdrawer.repo }}:{{ if .Values.global.dev }}{{ .Values.images.evmBridgeWithdrawer.devTag }}{{ else }}{{ .Values.images.evmBridgeWithdrawer.tag }}{{ end }}
{{- end }}

{{/*
application name to deploy elements into.
*/}}
{{- define "evm-bridge-withdrawer.appName" -}}
evm-bridge-withdrawer
{{- end }}

{{/*
Common labels
*/}}
{{- define "evm-bridge-withdrawer.labels" -}}
{{ include "evm-bridge-withdrawer.selectorLabels" . }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "evm-bridge-withdrawer.selectorLabels" -}}
app: {{ include "evm-bridge-withdrawer.appName" . }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/evm-bridge-withdrawer/templates/prometheusrule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.alerting.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: evm-bridge-withdrawer-alerting
{{- if .Values.alerting.prometheusRule.namespace }}
namespace: {{ .Values.alerting.prometheusRule.namespace | quote }}
{{- end }}
labels:
{{- include "evm-bridge-withdrawer.labels" . | nindent 4 }}
{{- if .Values.alerting.prometheusRule.additionalLabels }}
{{- toYaml .Values.alerting.prometheusRule.additionalLabels | nindent 4 }}
{{- end }}
spec:
{{- if .Values.alerting.prometheusRule.rules }}
groups:
- name: {{ template "evm-bridge-withdrawer.appName" . }}
rules: {{- toYaml .Values.alerting.prometheusRule.rules | nindent 4 }}
{{- end }}
{{- end }}
4 changes: 3 additions & 1 deletion charts/evm-bridge-withdrawer/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ apiVersion: v1
metadata:
name: evm-bridge-withdrawer-metrics
namespace: {{ include "evm-bridge-withdrawer.namespace" . }}
labels:
{{- include "evm-bridge-withdrawer.labels" . | nindent 4 }}
spec:
selector:
app: evm-bridge-withdrawer
{{- include "evm-bridge-withdrawer.labels" . | nindent 4 }}
ports:
{{- if .Values.metrics.enabled }}
- name: metrics
Expand Down
2 changes: 1 addition & 1 deletion charts/evm-bridge-withdrawer/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
matchLabels:
app: evm-bridge-withdrawer
endpoints:
- port: metric
- port: metrics
path: /
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
Expand Down
23 changes: 23 additions & 0 deletions charts/evm-bridge-withdrawer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@ serviceMonitor:
additionalLabels:
release: kube-prometheus-stack

alerting:
enabled: false
interval: ""
additionalLabels:
release: kube-prometheus-stack
annotations: {}
# scrapeTimeout: 10s
# path: /metrics
prometheusRule:
enabled: true
additionalLabels:
release: kube-prometheus-stack
namespace: monitoring
rules:
- alert: Bridge_Withdrawer_Down
expr: up{container="evm-bridge-withdrawer"} == 0 # Insert your query Expression
for: 1m # Rough number but should be enough to init warn
labels:
severity: warning
annotations:
summary: Bridge Withdrawer is Down (instance {{ $labels.instance }})
description: "bridge withdrawer node '{{ $labels.namespace }}' has disappeared from Prometheus target discovery.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"

# When deploying in a production environment should use a secret provider
# This is configured for use with GCP, need to set own resource names
# and keys
Expand Down
2 changes: 1 addition & 1 deletion charts/evm-rollup/templates/prometheusrule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
{{- toYaml .Values.alerting.prometheusRule.additionalLabels | nindent 4 }}
{{- end }}
spec:
{{- if .Values.config.rollup.alerting.prometheusRule.rules }}
{{- if .Values.alerting.prometheusRule.rules }}
groups:
- name: {{ template "rollup.name" . }}
rules: {{- toYaml .Values.alerting.prometheusRule.rules | nindent 4 }}
Expand Down
8 changes: 4 additions & 4 deletions charts/evm-stack/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ dependencies:
version: 0.27.5
- name: composer
repository: file://../composer
version: 0.1.4
version: 0.1.5
- name: evm-faucet
repository: file://../evm-faucet
version: 0.1.2
- name: evm-bridge-withdrawer
repository: file://../evm-bridge-withdrawer
version: 0.3.0
version: 0.3.1
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 15.2.4
- name: blockscout-stack
repository: https://blockscout.github.io/helm-charts
version: 1.6.2
digest: sha256:2d7e2f23cd9bbdb43b7cf42112db9ede0a7d5eee9e426b0b2344e43fcf52e1b1
generated: "2024-10-02T09:43:51.238571-04:00"
digest: sha256:4f00554b05258b2457715803fb1828a60942abb85262967ef8519d733ddee560
generated: "2024-10-03T17:18:58.503828-04:00"
4 changes: 2 additions & 2 deletions charts/evm-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ dependencies:
version: 0.27.5
repository: "file://../evm-rollup"
- name: composer
version: 0.1.4
version: 0.1.5
repository: "file://../composer"
condition: composer.enabled
- name: evm-faucet
version: 0.1.2
repository: "file://../evm-faucet"
condition: evm-faucet.enabled
- name: evm-bridge-withdrawer
version: 0.3.0
version: 0.3.1
repository: "file://../evm-bridge-withdrawer"
condition: evm-bridge-withdrawer.enabled
- name: postgresql
Expand Down

0 comments on commit 2d2e93e

Please sign in to comment.