Open Tom-Fawcett opened 5 years ago
Ouch, that would appear to be my fault.
Initially SQL Exporter used a configuration-provided query timeout and when I found out about Prometheus' X-Prometheus-Scrape-Timeout-Seconds
header (which informs targets about its scrape_timeout
) I decided to use that instead (in order to allow Prometheus to control the timeout).
But while I did remove the field from the sample config, I still kept the old scrape_timeout
configuration field around (in order to allow further limiting of the timeout) and (the cause of your issues) its default value of 10 seconds. So unless one specifies a global.scrape_timeout
value in the configuration, the actual timeout SQL Exporter uses is:
min(prometheus_scrape_timeout - scrape_timeout_offset, 10s)
Hence the ~10s timeouts you're seeing.
The workaround is to explicitly provide a global.scrape_timeout
in your sql_exporter.yml
and set it to some very large value. Or at least larger than 120s
, in your case.
Thank-you for the fast reply.
I can confirm setting global.scrape_timeout
higher than Prometheus' scrape_timeout
solves it.
I guess global.scrape_timeout
is potentially still a useful setting to have if you want to set a master timeout exporter side. Perhaps having it default to unlimited, so Prometheus' scrape_timeout
is the master would be more intuitive?
Perhaps having it default to unlimited, so Prometheus' scrape_timeout is the master would be more intuitive?
That's what I thought too, but it may not be the best idea ever. If something else than Prometheus queries SQL Exporter's /metrics
page, it may hang forever, together with the DB connection. So I'm thinking to maybe just set it to some large value (5 minutes, as Prometheus doesn't deal well with scrape intervals over 5 minutes) and make sure to document it again (at least in the sample config).
Good point, that sounds reasonable
@free same issue and take the WA to resolve it. So could you add below config and comments into default sql_exporter.yml in tarball? Otherwise it's easy to ignore it. Thx.
scrape_timeout: 10s
I'm seeing an issue where scrapes of this exporter are failing with error
context deadline exceeded
.I can't see how this is happening when:
SQL Exporter logs
Postgres logs:
SQL Exporter config:
Prometheus config:
SQL exporter logs show that the database queries fail after 9 seconds. How can this happen when SQL exporter has 112 seconds to return in?