foomo/pagespeed_exporter

return cached result for a page scrape

Opened this issue · 1 comments

I know returning a cached copy of prom metrics from an app isn't best practice, but for things like this exporter, I am happy to get a report of the page performance once and hour (or even less), but prometheus will drop the metrics after 5 mins, so the graph will just be a broken line for 5 mins at a time.

It would be a nice feature if the PagespeedExporter could just return a cached copy of the results, until such time those results are considered out of date (1h, 1d etc), prometheus can then scrape the exporter regularly (30s) without creating addition requests to the pagespeed apis

The "lifetime" of the data could be passed as a query param.

@cuotos I agree with that statement, I'm wondering why Brian Brazil had a different intake and, I refactored it to be generated on demand.

Perhaps I could add a parameter, as you've noted so that the graph looks way nicer.