How to decrease ServiceMonitor reload interval? #4556
Replies: 1 comment 4 replies
-
ServiceMonitors are registered by the operator as soon as they are available (operator is using list watchers for the objects). After the operator picks up ServiceMonitor it regenerates config and puts it as a Secret. Next, config-reloader is registering change to the Secret and sends a request to reload prometheus. After this prometheus does its own service discovery and starts scraping targets (bear in mind that Pod needs first to be in a ready state for prometheus to start scraping it). It is highly unlikely you can get this whole process to happen in times shorter than 1 minute, especially when the k8s API server is under load. However, if you want to investigate more, the potential areas of performance improvements would be as follows:
IMHO if you need to have targets present as soon as possible, you might be better of with pre-defining them by using |
Beta Was this translation helpful? Give feedback.
-
We observed that after adding a ServiceMonitor to Kubernetes, it takes some time before Prometheus lists a new target in its configuration (up to 1-2 minutes in my observation).
While this seems to be reasonable for production deployments, we deploy short-living ServiceMonitors as part of our benchmarking tool Theodolite, where we would like to get metrics as soon as possible to decrease the overall benchmarking time.
Is it possible to decrease the reload interval in the
Prometheus
kind resource?Beta Was this translation helpful? Give feedback.
All reactions