jmcgrath207 / k8s-ephemeral-storage-metrics

Prometheus ephemeral storage metrics exporter
https://jmcgrath207.github.io/k8s-ephemeral-storage-metrics/
MIT License
85 stars 35 forks source link

Relabelings #74

Closed mateuszdrab closed 5 months ago

mateuszdrab commented 5 months ago

Hey

Just raising an idea that relabelings and metric relabelings should be configurable on the service monitor resource from the helm chart.

I need to relabel container and pod labels to match what kube state metrics provides.

jmcgrath207 commented 5 months ago

Agree. I created a prerelease 1.6.3-rc01 for you to test my changes.

https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics/releases/tag/1.6.3-rc01

The changes are in https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics/pull/76, which works with empty values when observed in Grafana.

Admittedly, I am not super familiar with this. If your change works, could you send me a test case of the values you supplied? I want to add it to our tests.

Thanks!

mateuszdrab commented 5 months ago

Thanks for implementing the change so quickly.

I'm trying to deploy the chart with the below values but there's an error, think it might be an indentation issue. Error: UPGRADE FAILED: YAML parse error on k8s-ephemeral-storage-metrics/templates/metrics.yaml: error converting YAML to JSON: yaml: line 16: did not find expected key

serviceMonitor:
  relabelings:
    - sourceLabels: [pod_name]
      targetLabel: pod
    - sourceLabels: [pod_namespace]
      targetLabel: namespace
    # drop labels pod_.*
    - regex: "pod_(.*)"
      action: labeldrop

Chart deploys fine without relabelings in the values

Copilot suggesting moving from indent 4 to indent 8

jmcgrath207 commented 5 months ago

No worries. I see, you beat me to it :1st_place_medal: I merged. Thanks for your contribution. I will release it soon here.

jmcgrath207 commented 5 months ago

1.6.3 was just released with our change.

In hindsight, I should have used those labels in your test case :sweat_smile:. I might do so for 2.0 after refactoring for unit testing.

If you see any other issues or improvements, feel free to raise an issue.

Thanks!