affo commented on code in PR #2711:
URL: https://github.com/apache/fluss/pull/2711#discussion_r2872909327


##########
helm/templates/_metrics.tpl:
##########
@@ -0,0 +1,53 @@
+#
+# 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.
+#
+
+{{/*
+Render metrics reporter configuration entries.
+Expects the root context as argument.
+
+From values:
+  metrics:
+    reporters:
+      prometheus:
+        port: 9249
+
+Renders:
+  metrics.reporters: prometheus
+  metrics.reporter.prometheus.port: 9249
+
+Keys already present in configurationOverrides are not rendered.
+*/}}
+{{- define "fluss.metrics.config" -}}
+{{- $config := .Values.configurationOverrides | default dict -}}
+{{- $reporters := .Values.metrics.reporters | default dict -}}
+{{- $reporterNames := keys $reporters | sortAlpha -}}
+{{- if eq (len $reporterNames) 0 -}}
+{{- fail "metrics.reporters must contain at least one reporter when 
metrics.enabled is true" -}}

Review Comment:
   I think there is no `metrics.enabled`, so maybe this check is not relevant



##########
helm/templates/configmap.yaml:
##########
@@ -26,4 +26,7 @@ data:
   server.yaml: |
     {{- range $key, $val := .Values.configurationOverrides }}
     {{ $key }}: {{ tpl (printf "%v" $val) $ }}
-    {{- end }}
\ No newline at end of file
+    {{- end }}
+    {{- if .Values.metrics.enabled }}

Review Comment:
   ah ok, now I got it!
   Better to move this in the helper and render an empty thing in case it is 
disabled 🤝 



##########
helm/README.md:
##########
@@ -93,6 +93,48 @@ Important Fluss options surfaced by the chart:
 - internal.listener.name: Which listener is used for internal communication 
(defaults to INTERNAL).
 - tablet-server.id: Required to be unique per TabletServer. The chart 
auto‑derives this from the StatefulSet pod ordinal at runtime.
 
+### Metrics and Prometheus scraping
+
+The chart can enable Fluss metrics reporters and add scrape annotations to 
Services.
+
+Example:
+
+```bash
+helm install fluss ./fluss-helm \
+  --set metrics.enabled=true
+```
+
+When enabled, the chart will:
+- configure `metrics.reporters` from reporter names in values
+- configure `metrics.reporter.<name>.<option>` entries from values
+- optionally add metrics scrape annotations to Fluss Services from values
+
+Values:
+
+| Key | Description |
+| --- | --- |
+| `metrics.enabled` | Enables metrics reporting and endpoint exposure. |
+| `metrics.reporters` | Map of Fluss metric reporters and their options. |
+| `metrics.annotations` | Optional map of annotations rendered on Fluss 
Services when metrics are enabled. |
+
+Example `values.yaml` snippet:
+
+```yaml
+metrics:
+  enabled: true
+  reporters:
+    grph:
+      port: 9020
+      host: example-localhost
+      protocol: TCP
+      interval: "60 SECONDS"
+    prometheus:
+      port: 9249
+  annotations:

Review Comment:
   I think this should not stay in the metrics.
   
   We should add annotations externally, e.g.:
   
   ```
   annotations:
     pod:
       common:
       coordinator:
       tablet
   ```
   
   to allow adding arbitrary annotations, and not only for the context of 
metrics 🤝 
   See Bitnami example: https://artifacthub.io/packages/helm/bitnami/zookeeper



##########
helm/templates/svc-coordinator.yaml:
##########
@@ -23,6 +23,10 @@ metadata:
   labels:
     {{- include "fluss.labels" . | nindent 4 }}
     app.kubernetes.io/component: coordinator
+  {{- if and .Values.metrics.enabled .Values.metrics.annotations }}

Review Comment:
   I would probably always add `annotations`, but only render the metrics one 
when enabled 🤝 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to