Skip to content

Commit

Permalink
[mariadb] update mysqld-exporter to version 0.15.1
Browse files Browse the repository at this point in the history
Remove DATA_SOURCE_NAME secret, use MYSQLD_EXPORTER_PASSWORD and
constructed mysqld.address option

Update alerts:

The metric mysql_info_schema_threads_seconds has been renamed
to mysql_info_schema_processlist_seconds with exporter v0.14.0+
see prometheus/mysqld_exporter#603
  • Loading branch information
s10 committed Jul 29, 2024
1 parent 93ad009 commit 0aa0a8e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common/mariadb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
description: A Helm chart for Kubernetes
name: mariadb
version: 0.12.1
version: 0.13.0
5 changes: 5 additions & 0 deletions common/mariadb/ci/test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ global:
registry: my.docker.registry
dockerHubMirror: my.dockerhub.mirror
dockerHubMirrorAlternateRegion: other.dockerhub.mirror
tld: ""
region: local

test_db_host: testRelease-mariadb.svc
root_password: secret123
Expand All @@ -15,3 +17,6 @@ backup:

backup_v2:
enabled: false

alerts:
support_group: test
4 changes: 3 additions & 1 deletion common/mariadb/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
{{- required ".Values.root_password missing" .Values.root_password }}
{{- end -}}

{{ define "mariadb.metrics_data_source" }}root:{{ required ".Values.root_password missing" .Values.root_password }}@tcp({{.Values.name}}-mariadb.{{.Release.Namespace}}.svc.kubernetes.{{.Values.global.region}}.{{.Values.global.tld}}:3306)/{{ end }}
{{- define "mariadb.metrics_target_address" -}}
{{.Values.name}}-mariadb.{{.Release.Namespace}}.svc.kubernetes.{{.Values.global.region}}.{{.Values.global.tld}}:3306
{{- end -}}

{{- define "db_password" -}}
{{- .Values.global.dbPassword }}
Expand Down
2 changes: 1 addition & 1 deletion common/mariadb/templates/alerts/_mysql.alerts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
summary: {{ include "fullName" . }} reports slow queries.

- alert: {{ include "alerts.service" . | title }}MariaDBWaitingForLock
expr: (mysql_info_schema_threads_seconds{app=~"{{ include "fullName" . }}", state=~"waiting for lock"} / 1000 > 15)
expr: (mysql_info_schema_processlist_seconds{app=~"{{ include "fullName" . }}", state=~"waiting for lock"} / 1000 > 15)
for: 10m
labels:
context: database
Expand Down
6 changes: 4 additions & 2 deletions common/mariadb/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ spec:
image: "{{ required ".Values.global.dockerHubMirrorAlternateRegion is missing" .Values.global.dockerHubMirrorAlternateRegion }}/{{ .Values.metrics.image }}:{{ .Values.metrics.image_version }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.imagePullPolicy | quote }}
args:
- "--mysqld.username=root"
- "--mysqld.address={{ include "mariadb.metrics_target_address" . }}"
{{- range $flag := .Values.metrics.flags }}
- "--{{$flag}}"
{{- end }}
Expand All @@ -152,11 +154,11 @@ spec:
periodSeconds: 20
timeoutSeconds: 10
env:
- name: DATA_SOURCE_NAME
- name: MYSQLD_EXPORTER_PASSWORD
valueFrom:
secretKeyRef:
name: mariadb-{{.Values.name}}
key: metrics-data-source
key: root-password
- name: LOGLEVEL
value: {{ default "info" .Values.metrics.loglevel }}
ports:
Expand Down
1 change: 0 additions & 1 deletion common/mariadb/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ metadata:
type: Opaque
data:
root-password: {{ include "mariadb.root_password" . | b64enc | quote }}
metrics-data-source: {{ include "mariadb.metrics_data_source" . | b64enc | quote }}
{{- if .Values.backup_v2.enabled }}
{{- if .Values.backup_v2.oauth.enabled }}
OAUTH_CLIENT_ID: {{ default "" .Values.backup_v2.oauth.client_id | b64enc | quote }}
Expand Down
2 changes: 1 addition & 1 deletion common/mariadb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ backup_v2:
metrics:
enabled: true
image: prom/mysqld-exporter
image_version: v0.12.1
image_version: v0.15.1
port: "9104"
flags:
- collect.binlog_size
Expand Down

0 comments on commit 0aa0a8e

Please sign in to comment.