{{- if .Values.explore.config.metrics.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: explore-metrics
  labels:
    {{- toYaml .Values.explore.config.metrics.ServiceMonitorLabels | nindent 4 }}
spec:
  selector:
    matchLabels:
      {{- include "cmem.labels-explore" . | nindent 6 }}
      app: explore-metrics
  endpoints:
  - port: "http"
    interval: 30s  # How often Prometheus scrapes the target
    path: {{ .Values.explore.config.metrics.context | quote }}
  {{- with .Values.explore.config.metrics.additionalCustomConfig }}
  {{- toYaml . | nindent 2 }}
  {{- end }}
  namespaceSelector:
    matchNames:
      - {{ .Release.Namespace }}
{{- end}}
