Skip to content

Commit

Permalink
Add ServiceMonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
kempspo committed Jun 11, 2024
1 parent b5b54b4 commit 09c7dbe
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 8 deletions.
12 changes: 12 additions & 0 deletions charts/trino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,18 @@ Fast distributed SQL query engine for big data analytics that helps you explore
}
}
```
* `jmx.enabled` - bool, default: `false`
* `jmx.registryPort` - int, default: `9080`
* `jmx.serverPort` - int, default: `9081`
* `jmxExporter.enabled` - bool, default: `false`
* `jmxExporter.image` - string, default: `"bitnami/jmx-exporter:latest"`
* `jmxExporter.pullPolicy` - string, default: `"Always"`
* `jmxExporter.port` - int, default: `5556`
* `jmxExporter.configProperties` - list, default: `[]`
* `podMonitor.enabled` - bool, default: `false`
* `podMonitor.selector.prometheus` - string, default: `"kube-prometheus"`
* `podMonitor.path` - string, default: `"/admin/metrics"`
* `podMonitor.interval` - string, default: `"30s"`
* `commonLabels` - object, default: `{}`

Labels that get applied to every resource's metadata
Expand Down
22 changes: 22 additions & 0 deletions charts/trino/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

{{- if .Values.podMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ template "trino.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
release: prometheus-operator
{{- include "trino.labels" . | nindent 4 }}
{{- if .Values.podMonitor.selector }}
{{- toYaml .Values.podMonitor.selector | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "trino.selectorLabels" . | nindent 6 }}
endpoints:
- port: jmx-exporter
path: {{ .Values.serviceMonitor.path }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/trino/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "trino.fullname" . }}
name: {{ include "trino.fullname" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.selector }}
Expand All @@ -15,7 +15,7 @@ spec:
{{- include "trino.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: coordinator
endpoints:
- port: jmx-exporter
- port: jmx
path: {{ .Values.serviceMonitor.path }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
11 changes: 5 additions & 6 deletions charts/trino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -763,16 +763,15 @@ jmx:
# help: 'ThreadCount (java.lang<type=Threading><>ThreadCount)'
# type: UNTYPED

podMonitor:
# - podMonitor is a resource from prometheus-operator:
# https://github.com/prometheus-operator/prometheus-operator
serviceMonitor:
# serviceMonitor.enabled -- Set to true to create resources for the [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator).
enabled: false
# labels for podMonitor, so that Prometheus can select it
# serviceMonitor.selector -- Labels for serviceMonitor, so that Prometheus can select it
selector:
prometheus: kube-prometheus
# the podMonitor web endpoint path
# serviceMonitor.path -- The serviceMonitor web endpoint path
path: /admin/metrics
# the podMonitor web endpoint interval
# serviceMonitor.interval -- The serviceMonitor web endpoint interval
interval: "30s"

# -- Labels that get applied to every resource's metadata
Expand Down
38 changes: 38 additions & 0 deletions test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,44 @@ accessControl:
]
}
jmx:
enabled: true
registryPort: 9080
serverPort: 9081

jmxExporter:
enabled: true
image: bitnami/jmx-exporter:latest
pullPolicy: Always
port: 5556
configProperties: |
startDelaySeconds: 0
hostPort: 127.0.0.1:9080
ssl: false
lowercaseOutputName: false
lowercaseOutputLabelNames: false
includeObjectNames: ["java.lang:type=Threading"]
autoExcludeObjectNameAttributes: true
excludeObjectNameAttributes:
"java.lang:type=OperatingSystem":
- "ObjectName"
"java.lang:type=Runtime":
- "ClassPath"
- "SystemProperties"
rules:
- pattern: 'java\.lang<type=Threading><(.*)>ThreadCount: (.*)'
name: java_lang_Threading_ThreadCount
value: '$2'
help: 'ThreadCount (java.lang<type=Threading><>ThreadCount)'
type: UNTYPED
podMonitor:
enabled: true
selector:
prometheus: kube-prometheus
path: /admin/metrics
interval: "30s"

ingress:
enabled: true
hosts:
Expand Down

0 comments on commit 09c7dbe

Please sign in to comment.