Throttling - CHERTS/pgscv GitHub Wiki
Starting with pgSCV version 0.10.0, it has become possible to throttling the interval at which Prometheus data is returned.
When scraping metrics from /metrics
and /metrics?target=XXX
endpoints is very frequent, it can create an extra load on the database.
This can happen when we use a cluster version of VictoriaMetrics where different vmagents (from different availability zones) access one pgSCV for data.
If you set the throttling_interval
parameter (environment variable PGSCV_THROTTLING_INTERVAL
), any attempt to get metrics from the /metrics
and /metrics?target=XXX
endpoints will return an empty result (http code 200), and the connection to the database will not be established.
This way we can guarantee that any metrics collection agent will not be able to get data more often than once every throttling_interval
seconds.
If you are using a clustered version of VictoriaMetrics and multiple vmagents are polling a single pgSCV instance, you may see gaps in the graphs when using throttling_interval
. To solve this problem, you need to disable vmagent staleness markers using the -promscrape.noStaleMarkers
or no_stale_markers: true
parameter, see VMagent docs for more informations. See demo-lab for an example of using the no_stale_markers parameter
Complete YAML configuration file example:
listen_address: 127.0.0.1:9890
throttling_interval: 25
services:
"postgres1":
service_type: "postgres"
conninfo: "postgres://pgscv:pa$$w0rd@postgres1:5432/db1"
"postgres2":
service_type: "postgres"
conninfo: "postgres://pgscv:pa$$w0rd@postgres2:5432/db2"