1Password / events-api-elastic

14 stars 6 forks source link

Handle 429 status codes #7

Closed ogero closed 3 years ago

ogero commented 3 years ago

This PR makes the API HTTPClient to be a retryablehttp.Client (go-retryablehttp) which will retry requests when the response status code is 429.

ogero commented 3 years ago

LGTM! Tested locally with a 1 request per minute throttle and the elastic apps seems to follow it fine. Looks like go-retryablehttp is not logging the client being throttled but it does log any error. Is this something that maybe we would like to log?

Thanks for testing @anthonythleung.
Good observation! The beat will log at INFO level by default, and the majority of the logs coming from retryablehttp are sent on DEBUG level. To display those logs, you can use the -d flag when running the beat:

./eventsapibeat -c eventsapibeat.yml --d="*" -e

anthonythleung commented 3 years ago

Ah I see, I totally missed that. This works great then. Thanks!