Skip to content

Commit

Permalink
Add jmx-exporter monitoring functionality with servicemonitor (#147)
Browse files Browse the repository at this point in the history
* Add jmx-exporter monitoring functionality with servicemonitor

* Update Chart version and README

* fix: helm-docs version to 1.11.0

* Bump Chart version to 2.7.0
  • Loading branch information
azisi authored Jan 31, 2023
1 parent 549224c commit cea6ad7
Show file tree
Hide file tree
Showing 13 changed files with 290 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/helm-docs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- 'valeriano-manassero' | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')"
HELM_DOCS_VERSION="1.12.0"
HELM_DOCS_VERSION="1.11.0"

curl --silent --show-error --fail --location --output /tmp/helm-docs.tar.gz https://github.com/norwoodj/helm-docs/releases/download/v"${HELM_DOCS_VERSION}"/helm-docs_"${HELM_DOCS_VERSION}"_Linux_x86_64.tar.gz
tar -xf /tmp/helm-docs.tar.gz helm-docs
Expand Down
2 changes: 1 addition & 1 deletion valeriano-manassero/trino/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "380"
description: High performance, distributed SQL query engine for big data
name: trino
version: 2.6.2
version: 2.7.0
home: https://trino.io
icon: https://trino.io/assets/images/trino-logo/trino-ko_tiny-alt.svg
sources:
Expand Down
17 changes: 16 additions & 1 deletion valeriano-manassero/trino/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# trino

![Version: 2.6.2](https://img.shields.io/badge/Version-2.6.2-informational?style=flat-square) ![AppVersion: 380](https://img.shields.io/badge/AppVersion-380-informational?style=flat-square)
![Version: 2.7.0](https://img.shields.io/badge/Version-2.7.0-informational?style=flat-square) ![AppVersion: 380](https://img.shields.io/badge/AppVersion-380-informational?style=flat-square)

High performance, distributed SQL query engine for big data

Expand Down Expand Up @@ -92,6 +92,21 @@ High performance, distributed SQL query engine for big data
| initKeystore.image.pullPolicy | string | `"IfNotPresent"` | |
| initKeystore.image.repository | string | `"bitnami/java"` | |
| initKeystore.image.tag | int | `17` | |
| jmxExporter.coordinator.enabled | bool | `false` | |
| jmxExporter.downloadLink | string | `"https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.17.2/jmx_prometheus_javaagent-0.17.2.jar"` | |
| jmxExporter.image.pullPolicy | string | `"IfNotPresent"` | |
| jmxExporter.image.repository | string | `"curlimages/curl"` | |
| jmxExporter.image.tag | string | `"7.87.0"` | |
| jmxExporter.jarfile | string | `"jmx_prometheus_javaagent-0.17.2.jar"` | |
| jmxExporter.path | string | `"/prometheus"` | |
| jmxExporter.port | int | `9000` | |
| jmxExporter.serviceMonitor.additionalLabels | object | `{}` | |
| jmxExporter.serviceMonitor.enabled | bool | `true` | |
| jmxExporter.serviceMonitor.interval | string | `"1m"` | |
| jmxExporter.serviceMonitor.path | string | `"/metrics"` | |
| jmxExporter.serviceMonitor.port | string | `"jmx-exporter"` | |
| jmxExporter.serviceMonitor.scrapeTimeout | string | `"10s"` | |
| jmxExporter.worker.enabled | bool | `false` | |
| resourceGroups | object | `{}` | |
| schemas | object | `{}` | |
| secretMounts | list | `[]` | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ data:
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-Djdk.attach.allowAttachSelf=true
{{- if .Values.jmxExporter.coordinator.enabled }}
-javaagent:{{ .Values.jmxExporter.path }}/lib/{{ .Values.jmxExporter.jarfile }}={{ .Values.jmxExporter.port }}:{{ .Values.jmxExporter.path }}/etc/trino.yaml
{{- end }}
{{ .Values.config.coordinator.jvmExtraConfig | indent 4 }}

config.properties: |
Expand Down
63 changes: 63 additions & 0 deletions valeriano-manassero/trino/templates/configmap-jmx-exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{- if or .Values.jmxExporter.coordinator.enabled .Values.jmxExporter.worker.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "trino.fullname" . }}-jmx-exporter
labels:
{{- include "trino.labels" . | nindent 4 }}
data:
trino.yaml: |
startDelaySeconds: 5
rules:
- pattern : trino.execution<name=SqlTaskManager><>InputDataSize.OneMinute.Count
name: trino_coord_Input_bytes_sci
- pattern : trino.execution<name=SqlTaskManager><>InputPositions.OneMinute.Count
name: trino_coord_Input_rows
- pattern : trino.execution<name=SqlTaskManager><>OutputDataSize.OneMinute.Count
name: trino_coord_Output_bytes_sci
- pattern : trino.execution<name=SqlTaskManager><>OutputPositions.OneMinute.Count
name: trino_coord_Output_rows
- pattern : trino.memory<type=ClusterMemoryPool, name=general><>TotalDistributedBytes
name: trino_TotalDistributedBytes
- pattern : trino.memory<type=ClusterMemoryPool, name=general><>ReservedDistributedBytes
name: trino_ReservedDistributedBytes
- pattern : trino.execution<name=QueryManager><>FailedQueries.OneMinute.Count
name: trino_Failed_Queries
- pattern : trino.execution<name=QueryManager><>RunningQueries
name: trino_running_queries
- pattern : trino.failuredetector<name=HeartbeatFailureDetector><>ActiveCount
name: trino_active_nodes
- pattern : trino.memory<type=ClusterMemoryPool, name=general><>FreeDistributedBytes
name: trino_cluster_free_memory
- pattern : trino.execution<name=QueryExecution><>Executor.QueuedTaskCount
name: trino_queued_task_count
- pattern : trino.execution<name=QueryManager><>StartedQueries.FiveMinute.Count
name: trino_started_queries
- pattern : java.lang<type=Memory><HeapMemoryUsage>committed
name: trino_jvm_heap_memory_usage
- pattern : java.lang<type=Threading><>ThreadCount
name: trino_jvm_thread_count
- pattern : trino.execution<name=QueryManager><>InternalFailures.OneMinute.Count
name: trino_failed_queries_internal
- pattern : trino.execution<name=QueryManager><>ExternalFailures.OneMinute.Count
name: trino_failed_queries_external
- pattern : trino.execution<name=QueryManager><>UserErrorFailures.OneMinute.Count
name: trino_failed_queries_user
{{- end }}
3 changes: 3 additions & 0 deletions valeriano-manassero/trino/templates/configmap-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ data:
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-Djdk.attach.allowAttachSelf=true
{{- if .Values.jmxExporter.worker.enabled }}
-javaagent:{{ .Values.jmxExporter.path }}/lib/{{ .Values.jmxExporter.jarfile }}={{ .Values.jmxExporter.port }}:{{ .Values.jmxExporter.path }}/etc/trino.yaml
{{- end }}
{{ .Values.config.worker.jvmExtraConfig | indent 4 }}

config.properties: |
Expand Down
37 changes: 36 additions & 1 deletion valeriano-manassero/trino/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ spec:
persistentVolumeClaim:
claimName: {{ .Values.groupProvider.pvcName }}
{{- end }}{{- end }}
{{- if .Values.jmxExporter.coordinator.enabled }}
- name: jmx-exporter-config
configMap:
name: {{ template "trino.fullname" . }}-jmx-exporter
- name: jmx-exporter-lib
emptyDir: {}
{{- end }}
{{- range .Values.secretMounts }}
- name: {{ .name }}
secret:
Expand All @@ -97,8 +104,25 @@ spec:
configMap:
name: {{ .configMapName }}
{{- end }}
{{- if or .Values.config.coordinator.initContainers (include "trino.tlsEncryption" . ) }}
{{- if or .Values.jmxExporter.coordinator.enabled .Values.config.coordinator.initContainers (include "trino.tlsEncryption" . ) }}
initContainers:
{{- if .Values.jmxExporter.coordinator.enabled }}
- name: download-jmx-exporter
image: {{ .Values.jmxExporter.image.repository }}:{{ .Values.jmxExporter.image.tag }}
imagePullPolicy: {{ .Values.jmxExporter.image.pullPolicy }}
{{- with .Values.image.securityContext }}
securityContext:
runAsUser: {{ .runAsUser }}
runAsGroup: {{ .runAsGroup }}
{{- end }}
args:
- "--output"
- "{{ .Values.jmxExporter.path }}/lib/{{ .Values.jmxExporter.jarfile }}"
- "{{ .Values.jmxExporter.downloadLink }}"
volumeMounts:
- name: jmx-exporter-lib
mountPath: {{ .Values.jmxExporter.path }}/lib/
{{- end }}
{{- if (include "trino.tlsEncryption" . ) }}
- name: init-certs
image: {{ .Values.initKeystore.image.repository }}:{{ .Values.initKeystore.image.tag }}
Expand Down Expand Up @@ -211,6 +235,12 @@ spec:
- mountPath: {{ .Values.config.general.path }}/group-provider
name: {{ .Values.groupProvider.pvcVolumeName | default "group-provider-pvc-volume" }}
{{- end }}{{- end }}
{{- if .Values.jmxExporter.coordinator.enabled }}
- mountPath: {{ .Values.jmxExporter.path }}/etc/
name: jmx-exporter-config
- mountPath: {{ .Values.jmxExporter.path }}/lib/
name: jmx-exporter-lib
{{- end }}
{{- range .Values.secretMounts }}
- name: {{ .name }}
mountPath: {{ .path }}
Expand All @@ -234,6 +264,11 @@ spec:
containerPort: {{ .Values.config.general.httpsServer.port }}
protocol: TCP
{{- end }}
{{- if .Values.jmxExporter.coordinator.enabled }}
- name: jmx-exporter
containerPort: {{ .Values.jmxExporter.port | default 9000 }}
protocol: TCP
{{- end }}
livenessProbe:
httpGet:
path: /v1/status
Expand Down
40 changes: 39 additions & 1 deletion valeriano-manassero/trino/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ spec:
name: schemas-volume-worker
- name: certs-shared
emptyDir: {}
{{- if .Values.jmxExporter.worker.enabled }}
- name: jmx-exporter-config
configMap:
name: {{ template "trino.fullname" . }}-jmx-exporter
- name: jmx-exporter-lib
emptyDir: {}
{{- end }}
{{- range .Values.secretMounts }}
- name: {{ .name }}
secret:
Expand All @@ -61,10 +68,29 @@ spec:
configMap:
name: {{ .configMapName }}
{{- end }}
{{- if .Values.config.worker.initContainers }}
{{- if or .Values.jmxExporter.worker.enabled .Values.config.coordinator.initContainers }}
initContainers:
{{- if .Values.jmxExporter.worker.enabled }}
- name: download-jmx-exporter
image: {{ .Values.jmxExporter.image.repository }}:{{ .Values.jmxExporter.image.tag }}
imagePullPolicy: {{ .Values.jmxExporter.image.pullPolicy }}
{{- with .Values.image.securityContext }}
securityContext:
runAsUser: {{ .runAsUser }}
runAsGroup: {{ .runAsGroup }}
{{- end }}
args:
- "--output"
- "{{ .Values.jmxExporter.path }}/lib/{{ .Values.jmxExporter.jarfile }}"
- "{{ .Values.jmxExporter.downloadLink }}"
volumeMounts:
- name: jmx-exporter-lib
mountPath: {{ .Values.jmxExporter.path }}/lib/
{{- end }}
{{- if .Values.config.worker.initContainers }}
{{- tpl (toYaml .Values.config.worker.initContainers) . | nindent 6 }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "trino.serviceAccountName" . }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
Expand All @@ -87,6 +113,12 @@ spec:
name: catalog-volume
- mountPath: {{ .Values.config.general.path }}/certs
name: certs-shared
{{- if .Values.jmxExporter.worker.enabled }}
- mountPath: {{ .Values.jmxExporter.path }}/etc/
name: jmx-exporter-config
- mountPath: {{ .Values.jmxExporter.path }}/lib/
name: jmx-exporter-lib
{{- end }}
{{- range .Values.secretMounts }}
- name: {{ .name }}
mountPath: {{ .path }}
Expand All @@ -101,6 +133,12 @@ spec:
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- if .Values.jmxExporter.worker.enabled }}
ports:
- name: jmx-exporter
containerPort: {{ .Values.jmxExporter.port | default 9000 }}
protocol: TCP
{{- end }}
livenessProbe:
exec:
command:
Expand Down
19 changes: 19 additions & 0 deletions valeriano-manassero/trino/templates/service-coordinator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.jmxExporter.coordinator.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "trino.coordinator" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
app.kubernetes.io/component: coordinator
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.jmxExporter.port | default 9000 }}
targetPort: jmx-exporter
protocol: TCP
name: {{ .Values.jmxExporter.serviceMonitor.port | default "jmx-exporter" }}
selector:
{{- include "trino.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: coordinator
{{- end }}
19 changes: 19 additions & 0 deletions valeriano-manassero/trino/templates/service-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.jmxExporter.worker.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "trino.worker" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
app.kubernetes.io/component: worker
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.jmxExporter.port | default 9000 }}
targetPort: jmx-exporter
protocol: TCP
name: {{ .Values.jmxExporter.serviceMonitor.port | default "jmx-exporter" }}
selector:
{{- include "trino.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: worker
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if and .Values.jmxExporter.coordinator.enabled .Values.jmxExporter.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "trino.coordinator" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
spec:
jobLabel: {{ .Release.Name }}-coordinator
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "trino.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: coordinator
endpoints:
- port: {{ .Values.jmxExporter.serviceMonitor.port }}
{{- with .Values.jmxExporter.serviceMonitor.path }}
path: {{ . }}
{{- end }}
{{- with .Values.jmxExporter.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.jmxExporter.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.jmxExporter.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
32 changes: 32 additions & 0 deletions valeriano-manassero/trino/templates/servicemonitor-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if and .Values.jmxExporter.worker.enabled .Values.jmxExporter.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "trino.worker" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
spec:
jobLabel: {{ .Release.Name }}-worker
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "trino.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: worker
endpoints:
- port: {{ .Values.jmxExporter.serviceMonitor.port }}
{{- with .Values.jmxExporter.serviceMonitor.path }}
path: {{ . }}
{{- end }}
{{- with .Values.jmxExporter.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.jmxExporter.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.jmxExporter.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
Loading

0 comments on commit cea6ad7

Please sign in to comment.