feat(low-code): add RateLimitedMultipleTokenAuthenticator component#1066
Conversation
… component Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1783347505-rate-limited-multiple-token-authenticator#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1783347505-rate-limited-multiple-token-authenticatorPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
…on wait Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
… already converted Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
|
Warning Review limit reached
Next review available in: 55 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Adds a new declarative authenticator,
RateLimitedMultipleTokenAuthenticator, that generalizes source-github'sMultipleTokenAuthenticatorWithRateLimiterso it can be reused by any connector during declarative migrations (context: https://github.com/airbytehq/airbyte-internal-issues/issues/16512).Behavior (per outgoing request, via
AuthBase.__call__):quotas) viaHttpRequestRegexMatchers; a pool with no matchers is the default (generalizes GitHub's hardcoded"graphql" in pathREST-vs-GraphQL split).quota_status_source(e.g. GitHubGET /rate_limit) usingremaining_path/reset_path/limit_pathdpath extraction. Seeding is lazy (first request) and repeated after an exhaustion wait.MIN_EXHAUSTION_WAIT= 5s so stale reset timestamps can't busy-loop the quota endpoint, bounded bymax_wait_time, else raisestransient_error).max(budget_min_reserve, budget_reserve_fraction * limit), delays ofseconds_to_reset / total_remaining(capped at 10s) are injected for graceful degradation instead of a hard wall.Thread safety (new vs. the source-github implementation, required for the concurrent CDK):
RLock;_acquire_callreturns the token chosen under the lock and the request header is built from that value, so a request is always signed with the token whose counter was decremented (no TOCTOU with concurrent rotation). All sleeps occur outside the lock._refresh_lockso only one thread refreshes counters after an exhaustion wait.ModelToComponentFactory.create_rate_limited_multiple_token_authenticatorcaches instances keyed on the model definition, so all streams share one counter set (same idea as the sharedapi_budget).Example manifest usage (source-github):
Changes:
declarative_component_schema.yaml: newRateLimitedMultipleTokenAuthenticator,QuotaStatusSource,TokenQuotadefinitions; added toHttpRequester.authenticatorandSelectiveAuthenticator.authenticatorsunions (models regenerated; new classes applied on top of the checked-in file to avoid unrelated codegen churn).airbyte_cdk/sources/declarative/auth/rate_limited_multiple_token.py: runtime implementation.model_to_component_factory.py:create_rate_limited_multiple_token_authenticatorwith token-string splitting, interpolation, and shared-instance caching.Requested by Daryna Ishchenko (darynaishchenko).
Link to Devin session: https://app.devin.ai/sessions/3ced8f6a11d44ed4abc517221294f767
Requested by: Daryna Ishchenko (@darynaishchenko)