From 809b79ee1fbb931f70aaab942645884d703dd579 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Sat, 9 Nov 2024 06:55:26 -0800 Subject: [PATCH] feat: Add ServiceMonitor for data-prepper Signed-off-by: Davi Arnaut --- charts/data-prepper/CHANGELOG.md | 24 ++++++++++++++++++- charts/data-prepper/Chart.yaml | 2 +- charts/data-prepper/README.md | 3 +++ .../templates/serviceMonitor.yaml | 19 +++++++++++++++ charts/data-prepper/values.yaml | 15 ++++++++++++ 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 charts/data-prepper/templates/serviceMonitor.yaml diff --git a/charts/data-prepper/CHANGELOG.md b/charts/data-prepper/CHANGELOG.md index d0b61260..795a6d6a 100644 --- a/charts/data-prepper/CHANGELOG.md +++ b/charts/data-prepper/CHANGELOG.md @@ -4,7 +4,29 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +--- ## [Unreleased] ### Added +### Changed +### Deprecated +### Removed +### Fixed +### Security +--- +## [0.1.1] +### Added +- ServiceMonitor resource for Prometheus monitoring +### Changed +### Deprecated +### Removed +### Fixed +### Security +--- +## [0.1.0] +### Added - Create initial version of data-prepper helm chart - +### Changed +### Deprecated +### Removed +### Fixed +### Security diff --git a/charts/data-prepper/Chart.yaml b/charts/data-prepper/Chart.yaml index dd53bd76..e701ea29 100644 --- a/charts/data-prepper/Chart.yaml +++ b/charts/data-prepper/Chart.yaml @@ -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.0 +version: 0.1.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 diff --git a/charts/data-prepper/README.md b/charts/data-prepper/README.md index d35c92f7..b93921c8 100644 --- a/charts/data-prepper/README.md +++ b/charts/data-prepper/README.md @@ -119,6 +119,9 @@ We welcome contributions! Please read our [CONTRIBUTING.md](../../CONTRIBUTING.m | tolerations | list | `[]` | | | volumeMounts | list | `[]` | | | volumes | list | `[]` | | +| serviceMonitor.enabled | Enables the creation of a [ServiceMonitor] resource for Prometheus monitoring. Requires the Prometheus Operator to be installed in your Kubernetes cluster. | `false` | +| serviceMonitor.path | Path where metrics are exposed | `/metrics/sys` | +| serviceMonitor.interval | Interval at which metrics should be scraped by Prometheus | `30s` | ## License diff --git a/charts/data-prepper/templates/serviceMonitor.yaml b/charts/data-prepper/templates/serviceMonitor.yaml new file mode 100644 index 00000000..8c306b8c --- /dev/null +++ b/charts/data-prepper/templates/serviceMonitor.yaml @@ -0,0 +1,19 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "data-prepper.fullname" . }}-service-monitor + labels: + {{- include "data-prepper.labels" . | nindent 4 }} + {{- with .Values.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + matchLabels: + {{- include "data-prepper.selectorLabels" . | nindent 6 }} + endpoints: + - port: {{ .Values.serviceMonitor.metricsPortName | default "server" }} + interval: {{ .Values.serviceMonitor.interval }} + path: {{ .Values.serviceMonitor.path }} +{{- end }} diff --git a/charts/data-prepper/values.yaml b/charts/data-prepper/values.yaml index b63cf837..c418f568 100644 --- a/charts/data-prepper/values.yaml +++ b/charts/data-prepper/values.yaml @@ -352,3 +352,18 @@ nodeSelector: {} tolerations: [] affinity: {} + +# ServiceMonitor Configuration +# Allows Prometheus to scrape metrics from the Data Prepper server. +serviceMonitor: + # Set to true to enable the ServiceMonitor resource + enabled: false + + # HTTP path where metrics are exposed. + path: /metrics/sys + + # Frequency at which Prometheus will scrape metrics. + interval: 30s + + # additional labels to be added to the ServiceMonitor + labels: {}