swh: only make ServiceMonitors match services in the current namespace
Generating ServiceMonitors in each namespace for services in all namespaces creates n**2 targets in prometheus. Each of these targets ends up being a duplicate of n-1 others, which generates prometheus warnings about out of order samples.
helm diff output:
------------- diff for swh/values/default.yaml -------------
--- /tmp/swh-chart.swh.q3avXeRk/default.yaml.before 2023-11-14 18:11:04.528019839 +0100
+++ /tmp/swh-chart.swh.q3avXeRk/default.yaml.after 2023-11-14 18:11:04.624021242 +0100
@@ -275,11 +275,12 @@
namespace: swh
spec:
endpoints:
- path: /metrics
port: http
interval: 10s
selector:
matchLabels:
app: prometheus-statsd-exporter
namespaceSelector:
- any: true
+ matchNames:
+ - swh
Edited by Nicolas Dandrimont