Skip to content

Commit 91fe609

Browse files
ido177potiuk
authored andcommitted
add statsd service monitor into helm chart
1 parent c07eb28 commit 91fe609

3 files changed

Lines changed: 123 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{{/*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
*/}}
19+
20+
######################################
21+
## Airflow Statsd ServiceMonitor
22+
######################################
23+
{{- if and .Values.statsd.enabled .Values.statsd.serviceMonitor.enabled }}
24+
apiVersion: monitoring.coreos.com/v1
25+
kind: ServiceMonitor
26+
metadata:
27+
name: {{ include "airflow.fullname" . }}-statsd
28+
namespace: {{ default .Release.Namespace .Values.statsd.serviceMonitor.namespace | quote }}
29+
labels:
30+
tier: airflow
31+
component: statsd-service-monitor
32+
release: {{ .Release.Name }}
33+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
34+
heritage: {{ .Release.Service }}
35+
app.kubernetes.io/component: metrics
36+
{{- with .Values.statsd.serviceMonitor.labels }}
37+
{{- toYaml . | nindent 4 }}
38+
{{- end }}
39+
spec:
40+
endpoints:
41+
- path: /metrics
42+
honorLabels: {{ .Values.statsd.serviceMonitor.honorLabels }}
43+
port: statsd-scrape
44+
{{- if .Values.statsd.serviceMonitor.interval }}
45+
interval: {{ .Values.statsd.serviceMonitor.interval }}
46+
{{- end }}
47+
{{- if .Values.statsd.serviceMonitor.scrapeTimeout }}
48+
scrapeTimeout: {{ .Values.statsd.serviceMonitor.scrapeTimeout }}
49+
{{- end }}
50+
selector:
51+
matchLabels:
52+
tier: airflow
53+
component: statsd
54+
namespaceSelector:
55+
matchNames:
56+
- {{ .Release.Namespace }}
57+
{{- end }}

chart/values.schema.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7337,6 +7337,50 @@
73377337
],
73387338
"additionalProperties": false
73397339
}
7340+
},
7341+
"serviceMonitor": {
7342+
"description": "ServiceMonitor configuration for Prometheus scraping of StatsD metrics.",
7343+
"type": "object",
7344+
"x-docsSection": "Kubernetes",
7345+
"properties": {
7346+
"enabled": {
7347+
"description": "Enables creation of a ServiceMonitor for StatsD metrics scraping.",
7348+
"type": "boolean",
7349+
"default": false
7350+
},
7351+
"honorLabels": {
7352+
"description": "If true, keeps original metric labels as exported by the app. If false, Prometheus may override them.",
7353+
"type": "boolean",
7354+
"default": true
7355+
},
7356+
"interval": {
7357+
"description": "Scrape interval for Prometheus (e.g., 30s, 1m, etc.).",
7358+
"type": "string",
7359+
"default": "10s"
7360+
},
7361+
"scrapeTimeout": {
7362+
"description": "Timeout for the metrics scrape request.",
7363+
"type": "string",
7364+
"default": ""
7365+
},
7366+
"labels": {
7367+
"description": "Additional labels to attach to the ServiceMonitor object.",
7368+
"type": "object",
7369+
"default": {},
7370+
"additionalProperties": {
7371+
"type": "string"
7372+
}
7373+
},
7374+
"namespace": {
7375+
"description": "Namespace where the ServiceMonitor will be created. If not set, defaults to .Release.Namespace.",
7376+
"type": [
7377+
"string",
7378+
"null"
7379+
],
7380+
"default": null
7381+
}
7382+
},
7383+
"additionalProperties": false
73407384
}
73417385
}
73427386
},

chart/values.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,6 +2406,28 @@ statsd:
24062406
podAnnotations: {}
24072407
env: []
24082408

2409+
# StatsD Service Monitor
2410+
serviceMonitor:
2411+
# Enables creation of a ServiceMonitor for StatsD metrics scraping.
2412+
enabled: false
2413+
2414+
# If true, keeps original metric labels as exported by the app.
2415+
# If false, Prometheus may override them.
2416+
honorLabels: true
2417+
2418+
# Scrape interval for Prometheus (e.g., 30s, 1m, etc.).
2419+
interval: 10s
2420+
2421+
# Timeout for the metrics scrape request.
2422+
scrapeTimeout: ""
2423+
2424+
# Additional labels to attach to the ServiceMonitor object.
2425+
labels: {}
2426+
2427+
# (Optional) Namespace where the ServiceMonitor will be created.
2428+
# If not set, defaults to .Release.Namespace.
2429+
# namespace: "monitoring"
2430+
24092431
# PgBouncer settings
24102432
pgbouncer:
24112433
# Enable PgBouncer

0 commit comments

Comments
 (0)