stackdriver_exporter icon indicating copy to clipboard operation
stackdriver_exporter copied to clipboard

High number of requests to Stackdriver API – optimization possible?

Open elsbrock opened this issue 5 years ago • 3 comments

Hi,

we're using the stackdriver exporter for our project and currently use a configuration where we just specify the prefix of the metrics we would like to request (so that the exporter requests all of them).

We suspect that this resulted in a significant increase of our bill because it apparently involves a large number of requests.

We currently export pubsub.googleapis.com, cloudsql.googleapis.com and compute.googleapis.com. The number of requests per month with two exporters deployed is about 50 million (with default settings otherwise, so I assume a refresh every 5 minutes).

Could that be related? If yes, do you see a possibility to optimize this? Is it possible to request multiple metrics at once? Could the list of metrics available per prefix be cached?

Thanks.

elsbrock avatar Feb 22 '20 13:02 elsbrock

I'm not sure how much optimization is possible, but I'm interested in doing some work on this exporter.

SuperQ avatar Feb 25 '20 20:02 SuperQ

I would recommend to check which jobs are scraping SD exporter by using topk(10, count by ( job)({__name__=~".*stackdriver.*"})) query - in our case it was misconfiguration causing 3 independent Prometheus instances (HA) with 3 independent jobs (misconfiguration) scraping SD exporter (every scrape meant ~350 requests to GCP API in our configuration).

jakubbujny avatar Dec 23 '20 08:12 jakubbujny

check https://github.com/prometheus-community/stackdriver_exporter/pull/125

WojciechKuk avatar Dec 27 '22 17:12 WojciechKuk