Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prometheus-blackbox-exporter] define metricRelabelings in selfservicemonitor.yaml to handle additionalMetricsRelabels #4303

Merged

Conversation

Sheikh-Abubaker
Copy link
Contributor

@Sheikh-Abubaker Sheikh-Abubaker commented Feb 27, 2024

What this PR does / why we need it

Which issue this PR fixes

(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)

Special notes for your reviewer

Generated ServiceMonitor resource after defining metricRelabelings in selfservicemonitor.yaml, and when additionalMetricsRelabels set to an empty list.

helm template . -f override-values.yaml

---
# Source: prometheus-blackbox-exporter/templates/selfservicemonitor.yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: release-name-prometheus-blackbox-exporter
  namespace: default
  labels:
    helm.sh/chart: prometheus-blackbox-exporter-8.13.0
    app.kubernetes.io/name: prometheus-blackbox-exporter
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "v0.24.0"
    app.kubernetes.io/managed-by: Helm
spec:
  endpoints:
  - path: /metrics
    interval: 30s
    scrapeTimeout: 30s
    scheme: http
    metricRelabelings:
      - action: keep
        regex: prometheus
        sourceLabels:
        - __meta_kubernetes_pod_label_team
      - action: drop
        regex: west_europe
        sourceLabels:
        - __meta_kubernetes_pod_label_datacenter
  jobLabel: "release-name"
  selector:
    matchLabels:
      app.kubernetes.io/name: prometheus-blackbox-exporter
      app.kubernetes.io/instance: release-name
  namespaceSelector:
    matchNames:
      - default

additionalMetricsRelabels changed to empty list due to this warning

helm template . -f override-values.yaml
 coalesce.go:286: warning: cannot overwrite table with non table for prometheus-blackbox-exporter.serviceMonitor.selfMonitor.additionalMetricsRelabels (map[])
# override-values.yaml 

serviceMonitor:
## If true, a ServiceMonitor CRD is created for a prometheus operator
## https://github.com/coreos/prometheus-operator for blackbox-exporter itself
##
selfMonitor:
  enabled: true
  additionalMetricsRelabels:
  - sourceLabels:
    - __meta_kubernetes_pod_label_team
    regex: "prometheus"
    action: keep
  - sourceLabels:
    - __meta_kubernetes_pod_label_datacenter
    regex: west_europe
    action: drop
  additionalRelabeling: []
  labels: {}
  path: /metrics
  interval: 30s
  scrapeTimeout: 30s

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

@Sheikh-Abubaker Sheikh-Abubaker changed the title [prometheus-blackbox-exporter] defined metricRelabelings in selfservicemonitor.yaml to handle additionalMetricsRelabels [prometheus-blackbox-exporter] define metricRelabelings in selfservicemonitor.yaml to handle additionalMetricsRelabels Mar 21, 2024
Signed-off-by: Sheikh-Abubaker <[email protected]>
Signed-off-by: Sheikh-Abubaker <[email protected]>
Signed-off-by: Sheikh-Abubaker <[email protected]>
@monotek monotek merged commit 24d4002 into prometheus-community:main May 13, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants