Skip to content

STL-2767: Retry on HTTP 429 with Retry-After support#1631

Merged
roman-kiselevich merged 1 commit into
masterfrom
rkis/STL-2767-retry-on-429
May 27, 2026
Merged

STL-2767: Retry on HTTP 429 with Retry-After support#1631
roman-kiselevich merged 1 commit into
masterfrom
rkis/STL-2767-retry-on-429

Conversation

@roman-kiselevich
Copy link
Copy Markdown
Contributor

@roman-kiselevich roman-kiselevich commented May 26, 2026

Problem

The public rate limits for the metadata-api provisioning APIs (STL-2767) are now rolled out in gitops-panther. The gateway responds with HTTP 429 and a Retry-After header when a limit is exceeded, but the Python SDK has no retry handling — every 429 surfaces as an ApiException to the caller.

Summary

Adds GoodDataApiClientRetryConfig and applies the same urllib3.Retry policy to both transport paths:

  • The generated gooddata-api-client — via Configuration.retries.
  • The direct requests.post in GoodDataApiClient._do_post_request — via a Session with HTTPAdapter mounted using the same Retry object.

Defaults: 10 retries on 429 across GET/HEAD/OPTIONS/TRACE/POST/PUT/PATCH/DELETE, backoff_factor=0.5, backoff_max=60s. Retry-After is honoured automatically by urllib3 when present; backoff only applies when the server omits the header.

The config is exposed at the top level (from gooddata_sdk import GoodDataApiClientRetryConfig) and accepted by both GoodDataApiClient.__init__ and GoodDataSdk.create.

Reasoning

The retry policy lives in the hand-written SDK wrapper (packages/gooddata-sdk/src/gooddata_sdk/client.py) rather than in the auto-generated gooddata-api-client/, because the latter is regenerated from OpenAPI templates and any direct edits would be overwritten. Configuration.retries is the documented hook the generator exposes for exactly this purpose.

POST/PUT/PATCH/DELETE are included in allowed_methods because the rate-limited endpoints are provisioning calls — retrying them is safe since the gateway returns 429 before the request is processed.

@roman-kiselevich roman-kiselevich marked this pull request as draft May 26, 2026 14:26
@roman-kiselevich roman-kiselevich force-pushed the rkis/STL-2767-retry-on-429 branch 3 times, most recently from 778ba64 to a191652 Compare May 26, 2026 14:57
@roman-kiselevich roman-kiselevich marked this pull request as ready for review May 26, 2026 15:03
Adds GoodDataApiClientRetryConfig, applied to both the generated
api-client (via Configuration.retries) and the direct requests.post
in _do_post_request (via a Session with HTTPAdapter). Defaults: 10
retries on 429, backoff_factor=0.5, backoff_max=60s; Retry-After
honoured automatically.

jira: STL-2767
risk: low
@roman-kiselevich roman-kiselevich force-pushed the rkis/STL-2767-retry-on-429 branch from a191652 to 9012fae Compare May 27, 2026 11:30
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 91.42857% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.06%. Comparing base (e1d6ad4) to head (9012fae).

Files with missing lines Patch % Lines
packages/gooddata-sdk/src/gooddata_sdk/client.py 91.17% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1631      +/-   ##
==========================================
+ Coverage   79.03%   79.06%   +0.02%     
==========================================
  Files         231      231              
  Lines       15634    15667      +33     
==========================================
+ Hits        12357    12387      +30     
- Misses       3277     3280       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roman-kiselevich roman-kiselevich merged commit b967cf4 into master May 27, 2026
13 checks passed
@roman-kiselevich roman-kiselevich deleted the rkis/STL-2767-retry-on-429 branch May 27, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants