Skip to content

Commit 75c517f

Browse files
kempsponineinchnick
authored andcommitted
Support configuring JMX and JMX exporter
1 parent d5104a7 commit 75c517f

File tree

9 files changed

+165
-0
lines changed

9 files changed

+165
-0
lines changed

charts/trino/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,41 @@ Fast distributed SQL query engine for big data analytics that helps you explore
605605
}
606606
}
607607
```
608+
* `jmx.enabled` - bool, default: `false`
609+
610+
Set to true to enable the RMI server to expose Trino's [JMX metrics](https://trino.io/docs/current/admin/jmx.html).
611+
* `jmx.registryPort` - int, default: `9080`
612+
* `jmx.serverPort` - int, default: `9081`
613+
* `jmx.exporter.enabled` - bool, default: `false`
614+
615+
Set to true to export JMX Metrics via HTTP for [Prometheus](https://github.com/prometheus/jmx_exporter) consumption
616+
* `jmx.exporter.image` - string, default: `"bitnami/jmx-exporter:latest"`
617+
* `jmx.exporter.pullPolicy` - string, default: `"Always"`
618+
* `jmx.exporter.port` - int, default: `5556`
619+
* `jmx.exporter.configProperties` - list, default: `[]`
620+
621+
JMX Config Properties is mounted to /etc/jmx-exporter/jmx-exporter-config.yaml
622+
Example:
623+
```yaml
624+
configProperties: |-
625+
startDelaySeconds: 0
626+
ssl: false
627+
lowercaseOutputName: false
628+
lowercaseOutputLabelNames: false
629+
includeObjectNames: ["java.lang:type=Threading"]
630+
autoExcludeObjectNameAttributes: true
631+
excludeObjectNameAttributes:
632+
"java.lang:type=OperatingSystem":
633+
- "ObjectName"
634+
"java.lang:type=Runtime":
635+
- "ClassPath"
636+
- "SystemProperties"
637+
rules:
638+
- pattern: 'java\.lang<type=Threading><(.*)>ThreadCount: (.*)'
639+
name: java_lang_Threading_ThreadCount
640+
value: '$2'
641+
help: 'ThreadCount (java.lang<type=Threading><>ThreadCount)'
642+
type: UNTYPED
608643
* `commonLabels` - object, default: `{}`
609644

610645
Labels that get applied to every resource's metadata

charts/trino/templates/configmap-coordinator.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ data:
4343
{{- range $configValue := .Values.coordinator.additionalJVMConfig }}
4444
{{ $configValue }}
4545
{{- end }}
46+
{{- if .Values.jmx.enabled }}
47+
-Dcom.sun.management.jmxremote.rmi.port={{ .Values.jmx.serverPort }}
48+
{{- end }}
4649

4750
config.properties: |
4851
coordinator=true
@@ -69,6 +72,10 @@ data:
6972
http-server.https.port={{ .Values.server.config.https.port }}
7073
http-server.https.keystore.path={{ .Values.server.config.https.keystore.path }}
7174
{{- end }}
75+
{{- if .Values.jmx.enabled }}
76+
jmx.rmiregistry.port={{ .Values.jmx.registryPort }}
77+
jmx.rmiserver.port={{ .Values.jmx.serverPort }}
78+
{{- end }}
7279
{{- if .Values.server.coordinatorExtraConfig }}
7380
{{- .Values.server.coordinatorExtraConfig | nindent 4 }}
7481
{{- end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.jmx.exporter.enabled -}}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ template "trino.fullname" . }}-jmx-exporter-config
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "trino.labels" . | nindent 4 }}
9+
app.kubernetes.io/component: jmx
10+
data:
11+
jmx-exporter-config.yaml: |-
12+
{{- .Values.jmx.exporter.configProperties | nindent 4 }}
13+
{{- end }}

charts/trino/templates/deployment-coordinator.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ spec:
7373
path: group.db
7474
{{- end }}
7575
{{- end }}
76+
{{- if .Values.jmx.exporter.enabled }}
77+
- name: jmx-exporter-config-volume
78+
configMap:
79+
name: {{ template "trino.fullname" . }}-jmx-exporter-config
80+
{{- end }}
7681
{{- range .Values.configMounts }}
7782
- name: {{ .name }}
7883
configMap:
@@ -155,6 +160,19 @@ spec:
155160
- name: http
156161
containerPort: {{ .Values.service.port }}
157162
protocol: TCP
163+
{{- if .Values.jmx.enabled }}
164+
- name: jmx-registry
165+
containerPort: {{ .Values.jmx.registryPort }}
166+
protocol: TCP
167+
- name: jmx-server
168+
containerPort: {{ .Values.jmx.serverPort }}
169+
protocol: TCP
170+
{{- end }}
171+
{{- if .Values.jmx.exporter.enabled }}
172+
- name: jmx-exporter
173+
containerPort: {{ .Values.jmx.exporter.port }}
174+
protocol: TCP
175+
{{- end }}
158176
{{- range $key, $value := .Values.coordinator.additionalExposedPorts }}
159177
- name: {{ $value.name }}
160178
containerPort: {{ $value.port }}
@@ -181,6 +199,17 @@ spec:
181199
{{- toYaml .Values.coordinator.lifecycle | nindent 12 }}
182200
resources:
183201
{{- toYaml .Values.coordinator.resources | nindent 12 }}
202+
{{- if .Values.jmx.exporter.enabled }}
203+
- name: jmx-exporter
204+
image: {{ .Values.jmx.exporter.image }}
205+
imagePullPolicy: {{ .Values.jmx.exporter.pullPolicy }}
206+
args:
207+
- "{{ .Values.jmx.exporter.port }}"
208+
- /etc/jmx-exporter/jmx-exporter-config.yaml
209+
volumeMounts:
210+
- mountPath: /etc/jmx-exporter/
211+
name: jmx-exporter-config-volume
212+
{{- end }}
184213
{{- if .Values.sidecarContainers.coordinator }}
185214
{{- toYaml .Values.sidecarContainers.coordinator | nindent 8 }}
186215
{{- end }}

charts/trino/templates/service.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ spec:
1414
targetPort: http
1515
protocol: TCP
1616
name: http
17+
{{- if .Values.jmx.exporter.enabled }}
18+
- port: {{ .Values.jmx.exporter.port }}
19+
targetPort: jmx-exporter
20+
protocol: TCP
21+
name: jmx-exporter
22+
{{- end }}
1723
{{- range $key, $value := .Values.coordinator.additionalExposedPorts }}
1824
- port: {{ $value.servicePort }}
1925
name: {{ $value.name }}

charts/trino/templates/tests/test-connection.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
labels:
66
{{- include "trino.labels" . | nindent 4 }}
77
app.kubernetes.io/component: test
8+
test: connection
89
annotations:
910
"helm.sh/hook": test-success
1011
spec:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if .Values.jmx.exporter.enabled }}
2+
apiVersion: v1
3+
kind: Pod
4+
metadata:
5+
name: {{ include "trino.fullname" . }}-test-jmx
6+
labels:
7+
{{- include "trino.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: test
9+
test: jmx
10+
annotations:
11+
"helm.sh/hook": test-success
12+
spec:
13+
containers:
14+
{{- if .Values.jmx.exporter.enabled }}
15+
- name: trino-jmx
16+
image: {{ include "trino.image" . }}
17+
command: ["/bin/bash", "-c"]
18+
args:
19+
- curl -s {{ include "trino.fullname" . }}.{{ .Release.Namespace }}:5556 | grep -q trino
20+
{{- end }}
21+
restartPolicy: Never
22+
{{- end }}

charts/trino/values.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,42 @@ kafka:
727727
# }
728728
# ```
729729

730+
jmx:
731+
# -- Set to true to enable the RMI server to expose Trino's [JMX metrics](https://trino.io/docs/current/admin/jmx.html).
732+
enabled: false
733+
registryPort: 9080
734+
serverPort: 9081
735+
exporter:
736+
# jmx.exporter.enabled -- Set to true to export JMX Metrics via HTTP for [Prometheus](https://github.com/prometheus/jmx_exporter) consumption
737+
enabled: false
738+
image: bitnami/jmx-exporter:latest
739+
pullPolicy: Always
740+
port: 5556
741+
configProperties: []
742+
# jmx.exporter.configProperties -- JMX Config Properties is mounted to /etc/jmx-exporter/jmx-exporter-config.yaml
743+
# @raw
744+
# Example:
745+
# ```yaml
746+
# configProperties: |-
747+
# startDelaySeconds: 0
748+
# ssl: false
749+
# lowercaseOutputName: false
750+
# lowercaseOutputLabelNames: false
751+
# includeObjectNames: ["java.lang:type=Threading"]
752+
# autoExcludeObjectNameAttributes: true
753+
# excludeObjectNameAttributes:
754+
# "java.lang:type=OperatingSystem":
755+
# - "ObjectName"
756+
# "java.lang:type=Runtime":
757+
# - "ClassPath"
758+
# - "SystemProperties"
759+
# rules:
760+
# - pattern: 'java\.lang<type=Threading><(.*)>ThreadCount: (.*)'
761+
# name: java_lang_Threading_ThreadCount
762+
# value: '$2'
763+
# help: 'ThreadCount (java.lang<type=Threading><>ThreadCount)'
764+
# type: UNTYPED
765+
730766
# -- Labels that get applied to every resource's metadata
731767
commonLabels: {}
732768

test-values.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,22 @@ accessControl:
140140
]
141141
}
142142
143+
jmx:
144+
enabled: true
145+
registryPort: 9080
146+
serverPort: 9081
147+
exporter:
148+
enabled: true
149+
image: bitnami/jmx-exporter:latest
150+
pullPolicy: Always
151+
port: 5556
152+
configProperties: |
153+
startDelaySeconds: 0
154+
hostPort: 127.0.0.1:9080
155+
rules:
156+
- pattern: 'trino.memory*'
157+
- pattern: 'trino.execution<name=QueryManager>*'
158+
143159
ingress:
144160
enabled: true
145161
hosts:

0 commit comments

Comments
 (0)