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 b708b35
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 14 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
4 changes: 2 additions & 2 deletions charts/evm-stack/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ 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
Expand Down
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 b708b35

Please sign in to comment.