opsgenie / opsgenie-python-sdk

Other
48 stars 40 forks source link

Rate limiting information #52

Open chills42 opened 3 years ago

chills42 commented 3 years ago

I'm not seeing any clear way to make use of the rate limiting header information while using the SDK. Ideally, it would be nice to have the header values accessible for clearer understanding of throttling.

https://docs.opsgenie.com/docs/api-rate-limiting

asqui commented 3 years ago

I think you can get insight into throttling by subscribing to metrics: https://docs.opsgenie.com/docs/opsgenie-python-api-v2-1#metrics-publishing-support

API Metrics include throttling information in the resultMetadata and HTTP Metrics include statusCode which will be 429 for throttled requests.

If you don't need it programmatically, I think information about throttled requests is also available in the logging output.

asqui commented 3 years ago

Hmmm, on second thought, I think logging about throttled requests (and any other retries) is only available to me because of this patch I applied: BATS/opsgenie-python-sdk@13a731cb1d039a79b935e2eea0cb9082abb998d3

If this is more generally useful maybe the maintainers can consider including this in the official release?