Skip to content

Commit

Permalink
add service monitoring for clickhouse (#375)
Browse files Browse the repository at this point in the history
* add service monitoring for clickhouse

* Update Helm documentation

* add readonly user in clickhouse for monitoring

* Update Helm documentation

---------

Co-authored-by: CometActions <[email protected]>
  • Loading branch information
liyaka and CometActions authored Oct 13, 2024
1 parent 6a4665d commit a9b5acc
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
4 changes: 4 additions & 0 deletions deployment/helm_chart/opik/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ Call opik api on http://localhost:5173/api
| clickhouse.backup.enabled | bool | `false` | |
| clickhouse.image | string | `"altinity/clickhouse-server:24.3.5.47.altinitystable"` | |
| clickhouse.logsLevel | string | `"information"` | |
| clickhouse.monitoring.enabled | bool | `false` | |
| clickhouse.monitoring.monitoringReleaseName | string | `nil` | |
| clickhouse.monitoring.password | string | `"opikmon"` | |
| clickhouse.monitoring.username | string | `"opikmon"` | |
| clickhouse.namePrefix | string | `"opik"` | |
| clickhouse.operator.enabled | bool | `true` | |
| clickhouse.replicasCount | int | `1` | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ spec:
# In order to get access outside of k8s it should be exposed as:
# kubectl --namespace prometheus port-forward service/prometheus 9090
# and point browser to localhost:9090
{{- if .Values.clickhouse.monitoring.enables }}
kind: Service
apiVersion: v1
metadata:
Expand All @@ -1171,4 +1172,30 @@ spec:
- port: 9999
name: operator-metrics
selector:
app: clickhouse-operator
app: clickhouse-operator
{{- end }}
---
## ServiceMonitor
{{- if .Values.clickhouse.monitoring.enables }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: clickhouse
namespace: {{ .Release.namespace }}
labels:
release: {{ .Values.clickhouse.monitoring.monitoringReleaseName }}
spec:
endpoints:
- interval: 30s
port: clickhouse-metrics
- interval: 30s
port: operator-metrics
namespaceSelector:
matchNames:
- {{ .Release.namespace }}
selector:
matchLabels:
app: clickhouse-operator
argocd.argoproj.io/instance: {{ .Release.namespace }}
clickhouse.altinity.com/chop: 0.23.6
{{- end }}
12 changes: 12 additions & 0 deletions deployment/helm_chart/opik/templates/clickhouseinstallation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ spec:
{{ .Values.clickhouse.adminUser.username }}/networks/ip:
- '127.0.0.1/32'
- '0.0.0.0/0'
{{- if .Values.clickhouse.monitoring.enables }}
{{- if .Values.clickhouse.monitoring.useSecret.enables }}
{{ .Values.clickhouse.monitoring.username }}/k8s_secret_password: {{ include "opik.name" .}}-{{ .Values.clickhouse.monitoring.secretname }}/{{ .Values.clickhouse.monitoring.password_key }}
{{- else }}
{{ .Values.clickhouse.monitoring.username }}/password: {{ .Values.clickhouse.monitoring.password }}
{{- end }}
{{- end }}
{{- if .Values.clickhouse.monitoring.enables }}
profiles:
{{ .Values.clickhouse.monitoring.username }}/readonly: 1
{{- end }}

{{- if .Values.zookeeper.enabled }}
zookeeper:
nodes:
Expand Down
5 changes: 5 additions & 0 deletions deployment/helm_chart/opik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ clickhouse:
# baseBackup: ""
operator:
enabled: true
monitoring:
enabled: false
monitoringReleaseName: # if monitoring is enables, this must be set
username: opikmon # readonly user
password: opikmon

# resources:
# requests:
Expand Down

0 comments on commit a9b5acc

Please sign in to comment.