ujamii / prometheus-sentry-exporter

Exports sentry project metrics for prometheus.
MIT License
38 stars 12 forks source link

Issue with Sentry Rate Limit #19

Closed RezaImany closed 1 year ago

RezaImany commented 2 years ago

there is a problem when i tried to add the exporter to prometheus! this is what i got after 1 minute Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: GET http://192.168.30.160:9000/api/0/projects/sentry/api/issues/ resulted in a 429 Too Many Requests response: {"detail":"You are attempting to use this endpoint too quickly. Limit is 3/1s"} in /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace: #0 /var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response), NULL, Array, NULL) #1 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL) #3 /var/www/html/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}() #4 /var/www/html/vendor/guzzlehttp/promises/src/Promise. in /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

how can i fix this? it seems a sentry rate limit restriction , but there is no configuration for it!

mgrundkoetter commented 2 years ago

I have not experienced any rate limit on a on-premise instance so far, but have you checked the headers for your config like said in the docs? Maybe in your case the prometheus scrape config is the reason. Maybe your scrape_interval is too low (< 15m?) or you have configured multiple scrape jobs which all target the same exporter instance. Maybe you just have too many projects inside your sentry instance, because the exporter iterates over ALL (visible) projects and makes another call for the issues for each project. So if you have a lot of projects, this may also be a reason. So to investigate this further, please post relevant parts of your scrape config and some info on the amount of projects and issues in your sentry instance.

sergeylanzman commented 2 years ago

https://github.com/ujamii/prometheus-sentry-exporter/pull/20/files

mgrundkoetter commented 1 year ago

solved by #21