foomo/pagespeed_exporter

/metrics endpoint takes very long to load

Closed this issue ยท 1 comments

Hey,

This is a great little project ๐Ÿ‘
The /metrics and /probe endpoint take more than 10 seconds to load, sometimes over a minute.

A better option is that the metrics are cached in memory and have the http endpoint serve the request straighaway from the cache. Then have a seperate loop that calls itself with a queryparam ?scrapeapi that then updates the cache.

otherwise this is not feasible for prometheus to scrape.

Get "http://10.152.1.126:9271/metrics": context deadline exceeded

@Romiko thanks!

That's what we started with. But Brian Brazil suggested to work more like the black-box exporter to request per scrape. However i do understand the problem, if the scrape duration needs a bit more time.

So, one way of doing that is to extend the

https://prometheus.io/docs/prometheus/latest/configuration/configuration/

global:
  # How long until a scrape request times out.
  [ scrape_timeout: <duration> | default = 10s ]

Another would be to assign that directly to the job

# The job name assigned to scraped metrics by default.
job_name: <job_name>

# How frequently to scrape targets from this job.
[ scrape_interval: <duration> | default = <global_config.scrape_interval> ]

# Per-scrape timeout when scraping this job.
[ scrape_timeout: <duration> | default = <global_config.scrape_timeout> ]

Also to increase the scrape_interval to something more in the lines of 15 minutes (Ain't going to change much in that time) as well as increasing the scrape timeout so that the pagespeed_exporter could do it's job in time!

I should add that to the readme tbh.