Skip to content

Commit 0a38c9f

Browse files
authored
Add ServiceMonitor object for Prometheus Operator compatibility (#401)
Also add Prometheus scrape labels.
1 parent cd37c0f commit 0a38c9f

File tree

2 files changed

+68
-13
lines changed

2 files changed

+68
-13
lines changed

helm/templates/service-monitor.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{{- if .Values.parseable.metrics.serviceMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "parseable.fullname" . }}
6+
namespace: {{ default .Release.Namespace .Values.parseable.metrics.serviceMonitor.namespace | quote }}
7+
labels: {{- include "parseable.selectorLabels" . | nindent 4 }}
8+
{{- if .Values.parseable.metrics.serviceMonitor.additionalLabels }}
9+
{{- include (dict "value" .Values.parseable.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
endpoints:
13+
- port: parseable-metrics
14+
{{- if .Values.parseable.metrics.serviceMonitor.interval }}
15+
interval: {{ .Values.parseable.metrics.serviceMonitor.interval }}
16+
{{- end }}
17+
{{- if .Values.parseable.metrics.serviceMonitor.scrapeTimeout }}
18+
scrapeTimeout: {{ .Values.parseable.metrics.serviceMonitor.scrapeTimeout }}
19+
{{- end }}
20+
{{- if .Values.parseable.metrics.serviceMonitor.honorLabels }}
21+
honorLabels: {{ .Values.parseable.metrics.serviceMonitor.honorLabels }}
22+
{{- end }}
23+
{{- if .Values.parseable.metrics.serviceMonitor.relabellings }}
24+
relabelings: {{- toYaml .Values.parseable.metrics.serviceMonitor.relabellings | nindent 6 }}
25+
{{- end }}
26+
{{- if .Values.parseable.metrics.serviceMonitor.metricRelabelings }}
27+
metricRelabelings: {{- toYaml .Values.parseable.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
28+
{{- end }}
29+
{{- if .Values.parseable.metrics.serviceMonitor.podTargetLabels }}
30+
podTargetLabels: {{- toYaml .Values.parseable.metrics.serviceMonitor.podTargetLabels | nindent 4 }}
31+
{{- end }}
32+
namespaceSelector:
33+
matchNames:
34+
- {{ .Release.Namespace }}
35+
selector:
36+
matchLabels: {{- include "parseable.selectorLabels" . | nindent 6 }}
37+
{{- end }}

helm/values.yaml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,33 @@ parseable:
66
## Set to true if you want to deploy Parseable in local mode (store logs
77
## on local mount point instead of S3 bucket)
88
local: false
9-
# env:
10-
# RUST_LOG: error
11-
# ## Enable to create and configure logstreams
12-
# logstream:
13-
# - name: "vectordemo"
14-
# retention:
15-
# action: "delete"
16-
# duration: "30d"
17-
# - name: "fluentbitdemo"
18-
# retention:
19-
# action: "delete"
20-
# duration: "30d"
9+
## Use this section to create ServiceMonitor object for
10+
## this Parseable deployment. Read more on ServiceMonitor
11+
## here: https://prometheus-operator.dev/docs/operator/design/#servicemonitor
12+
metrics:
13+
serviceMonitor:
14+
enabled: true
15+
namespace: ""
16+
interval: 30s
17+
scrapeTimeout: ""
18+
relabellings: []
19+
metricRelabelings: []
20+
honorLabels: false
21+
additionalLabels: {}
22+
podTargetLabels: []
23+
## Add environment variables to the Parseable Deployment Pod
24+
env:
25+
# RUST_LOG: error
26+
## Enable to create and configure log retention for logstreams
27+
logstream:
28+
# - name: "vectordemo"
29+
# retention:
30+
# action: "delete"
31+
# duration: "30d"
32+
# - name: "fluentbitdemo"
33+
# retention:
34+
# action: "delete"
35+
# duration: "30d"
2136
## enable/disable persistence using PVC for the Data and Staging directories
2237
## Note that Data directory is needed only for local mode
2338
persistence:
@@ -79,7 +94,10 @@ parseable:
7994
memory: 1Gi
8095
securityContext:
8196
allowPrivilegeEscalation: false
82-
podAnnotations: {}
97+
podAnnotations:
98+
prometheus.io/scrape: "true"
99+
prometheus.io/port: "80"
100+
prometheus.io/path: "/api/v1/metrics"
83101
podSecurityContext:
84102
runAsUser: 1000
85103
runAsGroup: 1000

0 commit comments

Comments
 (0)