Prometheus trait auto discovery cross-namespace
Similar to #4178 but for the Prometheus trait.
Right now I work around this issue by using Prometheus' podMonitorNamespaceSelector and podMonitorSelector configs.
Looks something like this:
...
podMonitorNamespaceSelector:
matchLabels:
kubernetes.io/metadata.name: default (1)
podMonitorSelector:
matchExpressions:
- key: camel.apache.org/integration (2)
operator: Exists
...
(1) tells Prometheus to listen to the "default" namespace
(2) checks for pods that have the label key .../integration
Chances are, most people have their Prometheus instance running in their monitoring namespace if they installed it using the official Prometheus Operator installation guide (or using kube-prometheus for that matter - same thing).
The thing is people probably won't be running their integrations in the monitoring namespace. For whatever namespace they plan on running their integrations, they need to tell the Prometheus instance that information so it knows what to pull. We are not sending any data/metrics to Prometheus (assuming that Pushgateway is not used) we are explicitly telling/configuring it to listen to label X or namespace Y since its all pull-based.
Having the necessary options in the Prometheus trait to handle these podMonitorNamespaceSelector and podMonitorSelector configs (and anything else for that matter - open to discussions) would be helpful for so many people IMHO.
This issue has been automatically marked as stale due to 90 days of inactivity. It will be closed if no further activity occurs within 15 days. If you think that’s incorrect or the issue should never stale, please simply write any comment. Thanks for your contributions!