From f31420ebe79b692601b1f7215a3ae1a0f09fc4e8 Mon Sep 17 00:00:00 2001 From: Andrej Petras Date: Fri, 2 Aug 2024 10:26:25 +0200 Subject: [PATCH] feat: add metrics --- templates/deployment.yaml | 12 ++++++++++++ tests/metrics.yaml | 2 ++ values.yaml | 25 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/metrics.yaml diff --git a/templates/deployment.yaml b/templates/deployment.yaml index f1979ca..1b1111f 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -33,6 +33,18 @@ spec: {{- end }} {{- if .Values.env_secrets }} checksum/{{ template "app.fullname" $ }}-env: {{ include (print $.Template.BasePath "/secret-env.yaml") . | sha256sum }} +{{- end }} +{{- if .Values.metrics.enabled }} +{{- if .Values.metrics.prometheus.enabled }} + prometheus.io/scrape: '{{ .Values.metrics.prometheus.scrape }}' + prometheus.io/path: '{{ .Values.metrics.prometheus.path | default .Values.metrics.path }}' + prometheus.io/port: '{{ .Values.metrics.prometheus.pod | default .Values.pod.port }}' + {{- if .Values.metrics.prometheus.health.enabled }} + prometheus.io/health: '{{ .Values.metrics.prometheus.health.enabled }}' + prometheus.io/health_path: '{{ .Values.metrics.prometheus.health.path | default .Values.livenessProbe.url }}' + prometheus.io/health_port: '{{ .Values.metrics.prometheus.health.port | default .Values.pod.port }}' + {{- end }} +{{- end }} {{- end }} spec: {{- if .Values.serviceAccount.enabled }} diff --git a/tests/metrics.yaml b/tests/metrics.yaml new file mode 100644 index 0000000..ab1b395 --- /dev/null +++ b/tests/metrics.yaml @@ -0,0 +1,2 @@ +metrics: + enabled: true \ No newline at end of file diff --git a/values.yaml b/values.yaml index c19e820..0551a9c 100644 --- a/values.yaml +++ b/values.yaml @@ -185,6 +185,31 @@ serviceAccountSuffix: # Inject config maps inject_maps: [] +# service metrics configuration +metrics: + # enable or disable metrics + enabled: false + # service metrics path + path: /q/metrics + # metrics prometheus configuration + prometheus: + # enable or disable prometheus configuration + enabled: true + # prometheus metrics default metrics.path + path: + # scrape prometheus metrics + scrape: true + # prometheus metrics pod port, default pod.port + pod: + # promehtues health metrics + health: + # enable or disable prometheus helth metrics + enabled: true + # service health path for prometheus default livenessProbe.url + path: + # service health port for prometheus default pod.port + port: + # Database configuration db: # Enable or disable database connection