This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 8b7f3c9c7 [KYUUBI #5132] [K8S][HELM] Kyuubi add server metrics monitor
8b7f3c9c7 is described below

commit 8b7f3c9c70b964d79896fca3039746723e05bd48
Author: pengqli <[email protected]>
AuthorDate: Wed Aug 16 14:16:36 2023 +0800

    [KYUUBI #5132] [K8S][HELM] Kyuubi add server metrics monitor
    
    ### _Why are the changes needed?_
    
    Integrating Prometheus as the metrics collection method in the Kyuubi Helm 
Chart simplifies the configuration and deployment process, provides a 
standardized monitoring solution, and makes monitoring in the Kubernetes 
cluster more convenient and reliable.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    Closes #5132 from dev-lpq/monitor.
    
    Closes #5132
    
    75da2d491 [pengqli] upgrade the kyuubi monitoring
    76c2db130 [pengqli] add monitoring api check
    5a4c8ee88 [pengqli] add monitoring api check
    1ce8c3b7d [pengqli] add monitoring api check
    7362aaf0d [pengqli] Merge branch 'master' into monitor
    76e5b95b6 [pengqli] update helm chart monitor
    50439b603 [pengqli] update helm chart monitor
    5fafe6516 [pengqli] add helm chart monitor
    
    Authored-by: pengqli <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 charts/kyuubi/templates/kyuubi-alert.yaml          | 28 ++++++++++++++++
 charts/kyuubi/templates/kyuubi-configmap.yaml      |  4 +++
 charts/kyuubi/templates/kyuubi-podmonitor.yaml     | 31 ++++++++++++++++++
 charts/kyuubi/templates/kyuubi-servicemonitor.yaml | 31 ++++++++++++++++++
 charts/kyuubi/values.yaml                          | 37 ++++++++++++++++++++++
 5 files changed, 131 insertions(+)

diff --git a/charts/kyuubi/templates/kyuubi-alert.yaml 
b/charts/kyuubi/templates/kyuubi-alert.yaml
new file mode 100644
index 000000000..8637e9e03
--- /dev/null
+++ b/charts/kyuubi/templates/kyuubi-alert.yaml
@@ -0,0 +1,28 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/}}
+
+{{- if and .Values.server.prometheus.enabled (eq .Values.metricsReporters 
"PROMETHEUS") .Values.prometheusRule.enabled }}
+apiVersion: monitoring.coreos.com/v1
+kind: PrometheusRule
+metadata:
+  name: {{ .Release.Name }}
+  labels:
+    {{- include "kyuubi.labels" . | nindent 4 }}
+spec:
+  groups:
+    {{- toYaml .Values.prometheusRule.groups | nindent 4 }}
+{{- end }}
diff --git a/charts/kyuubi/templates/kyuubi-configmap.yaml 
b/charts/kyuubi/templates/kyuubi-configmap.yaml
index 3e7281083..1e5e195d3 100644
--- a/charts/kyuubi/templates/kyuubi-configmap.yaml
+++ b/charts/kyuubi/templates/kyuubi-configmap.yaml
@@ -37,6 +37,10 @@ data:
     kyuubi.frontend.mysql.bind.port={{ .Values.server.mysql.port }}
     kyuubi.frontend.protocols={{ include "kyuubi.frontend.protocols" . }}
 
+    # Kyuubi Metrics
+    kyuubi.metrics.enabled={{ .Values.server.prometheus.enabled }}
+    kyuubi.metrics.reporters={{ .Values.metricsReporters }}
+
     ## User provided Kyuubi configurations
     {{- with .Values.kyuubiConf.kyuubiDefaults }}
       {{- tpl . $ | nindent 4 }}
diff --git a/charts/kyuubi/templates/kyuubi-podmonitor.yaml 
b/charts/kyuubi/templates/kyuubi-podmonitor.yaml
new file mode 100644
index 000000000..ea0f76214
--- /dev/null
+++ b/charts/kyuubi/templates/kyuubi-podmonitor.yaml
@@ -0,0 +1,31 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/}}
+
+{{- if and .Values.server.prometheus.enabled (eq .Values.metricsReporters 
"PROMETHEUS") .Values.podMonitor.enabled }}
+apiVersion: monitoring.coreos.com/v1
+kind: PodMonitor
+metadata:
+  name: {{ .Release.Name }}
+  labels:
+    {{- include "kyuubi.labels" . | nindent 4 }}
+spec:
+  selector:
+    matchLabels:
+      app: {{ .Release.Name }}
+  podMetricsEndpoints:
+    {{- toYaml .Values.podMonitor.podMetricsEndpoint | nindent 4 }}
+{{- end }}
diff --git a/charts/kyuubi/templates/kyuubi-servicemonitor.yaml 
b/charts/kyuubi/templates/kyuubi-servicemonitor.yaml
new file mode 100644
index 000000000..7d997fc11
--- /dev/null
+++ b/charts/kyuubi/templates/kyuubi-servicemonitor.yaml
@@ -0,0 +1,31 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/}}
+
+{{- if and .Values.server.prometheus.enabled (eq .Values.metricsReporters 
"PROMETHEUS") .Values.serviceMonitor.enabled }}
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+  name: {{ .Release.Name }}
+  labels:
+    {{- include "kyuubi.labels" . | nindent 4 }}
+spec:
+  selector:
+    matchLabels:
+      app: {{ .Release.Name }}
+  endpoints:
+    {{- toYaml .Values.serviceMonitor.endpoints | nindent 4 }}
+{{- end }}
diff --git a/charts/kyuubi/values.yaml b/charts/kyuubi/values.yaml
index da4add0ed..cfc79fae5 100644
--- a/charts/kyuubi/values.yaml
+++ b/charts/kyuubi/values.yaml
@@ -116,6 +116,16 @@ server:
       nodePort: ~
       annotations: {}
 
+  # Exposes metrics in Prometheus format
+  prometheus:
+    enabled: true
+    port: 10019
+    service:
+      type: ClusterIP
+      port: "{{ .Values.server.prometheus.port }}"
+      nodePort: ~
+      annotations: {}
+
 # $KYUUBI_CONF_DIR directory
 kyuubiConfDir: /opt/kyuubi/conf
 # Kyuubi configurations files
@@ -202,3 +212,30 @@ affinity: {}
 
 # Kyuubi pods security context
 securityContext: {}
+
+# Monitoring Kyuubi - Server Metrics
+# PROMETHEUS - PrometheusReporter which exposes metrics in Prometheus format
+metricsReporters: ~
+
+# Prometheus pod monitor
+podMonitor:
+  # If enabled, podMonitor for operator's pod will be created
+  enabled: false
+  # The podMetricsEndpoint contains metrics information such as port, 
interval, scheme, and possibly other relevant details.
+  # This information is used to configure the endpoint from which Prometheus 
can scrape and collect metrics for a specific Pod in Kubernetes.
+  podMetricsEndpoint: []
+
+# Prometheus service monitor
+serviceMonitor:
+  # If enabled, ServiceMonitor resources for Prometheus Operator are created
+  enabled: false
+  # The endpoints section in a ServiceMonitor specifies the metrics 
information for each target endpoint.
+  # This allows you to collect metrics from multiple Services across your 
Kubernetes cluster in a standardized and automated way.
+  endpoints: []
+
+# Rules for the Prometheus Operator
+prometheusRule:
+  # If enabled, a PrometheusRule resource for Prometheus Operator is created
+  enabled: false
+  # Contents of Prometheus rules file
+  groups: []

Reply via email to