Skip to content

Commit

Permalink
Add support for Prometheus metrics in the Spark Driver (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
FraBle authored Jul 19, 2021
1 parent 6d33b48 commit ff7cbd0
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/bullet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: bullet
description: A real-time query engine for very large data streams
type: application
version: 0.2.0
version: 0.3.0
appVersion: "1.0.4"
home: https://github.com/SketchBench/bullet-k8s
# icon:
Expand Down
2 changes: 2 additions & 0 deletions charts/bullet/templates/spark-backend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ spec:
- {{ printf "spark.executor.cores=%g" .Values.sparkBackend.executorCores }}
- --conf
- {{ printf "spark.executor.memory=%s" .Values.sparkBackend.executorMemory }}
- --conf
- {{ printf "spark.ui.prometheus.enabled=%t" .Values.sparkBackend.metrics.enabled }}
- --class
- com.yahoo.bullet.spark.BulletSparkStreamingMain
- --jars
Expand Down
48 changes: 48 additions & 0 deletions charts/bullet/templates/spark-backend-podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{- if and .Values.sparkBackend.metrics.enabled .Values.sparkBackend.metrics.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "common.names.fullname" . }}-spark-backend
{{- if .Values.sparkBackend.metrics.podMonitor.namespace }}
namespace: {{ .Values.sparkBackend.metrics.podMonitor.namespace }}
{{- else }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: metrics
{{- if .Values.sparkBackend.metrics.podMonitor.additionalLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.sparkBackend.metrics.podMonitor.additionalLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
podMetricsEndpoints:
- port: "4040"
path: /metrics/executors/prometheus/
{{- if .Values.sparkBackend.metrics.podMonitor.interval }}
interval: {{ .Values.sparkBackend.metrics.podMonitor.interval }}
{{- end }}
{{- if .Values.sparkBackend.metrics.podMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.sparkBackend.metrics.podMonitor.scrapeTimeout }}
{{- end }}
{{- range .Values.sparkBackend.metrics.podMonitor.extraMetricsEndpoints }}
- port: {{ .port }}
path: {{ .path }}
{{- if $.Values.sparkBackend.metrics.podMonitor.interval }}
interval: {{ $.Values.sparkBackend.metrics.podMonitor.interval }}
{{- end }}
{{- if $.Values.sparkBackend.metrics.podMonitor.scrapeTimeout }}
scrapeTimeout: {{ $.Values.sparkBackend.metrics.podMonitor.scrapeTimeout }}
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/bullet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ sparkBackend:
schemaDir: /bullet/schemas
executorCores: 2
executorMemory: 3G
metrics:
enabled: false
podMonitor:
enabled: false
extraMetricsEndpoints: []
namespace: ""
interval: 30s
scrapeTimeout:
additionalLabels: {}
config:
# See https://github.com/bullet-db/bullet-spark/blob/master/src/main/resources/bullet_spark_defaults.yaml
### Bullet ###
Expand Down

0 comments on commit ff7cbd0

Please sign in to comment.