-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable client-side rate limiting on source-stripe #31512 #32284
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Before Merging a Connector Pull RequestWow! What a great pull request you have here! 🎉 To merge this PR, ensure the following has been done/considered for each connector added or updated:
If the checklist is complete, but the CI check is failing,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some test to ensure that we get the behavior we want?
airbyte-integrations/connectors/source-stripe/source_stripe/source.py
Outdated
Show resolved
Hide resolved
blocked by this https://github.com/airbytehq/airbyte/pull/31696/files?diff=unified&w=0 |
7d50264
to
6f0608e
Compare
it showed better performance and almost never hit the API limit in local testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the tests! We just need to do the items from the connector checklist and we should be good to go. There is this blocked situation with the other PR that I don't fully get though so if you can expand on that just to be sure we're aligned
@@ -76,3 +76,9 @@ connectionSpecification: | |||
The number of API calls per second that you allow connector to make. This value can not be bigger than real | |||
API call rate limit (https://stripe.com/docs/rate-limits). If not specified the default maximum is 25 and 100 | |||
calls per second for test and production tokens respectively. | |||
call_rate_policy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this field only for testing purposes? This looks like an implementation detail to me. a simpler option for the user would be to configure the rate limit in terms of requests per seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added this just for your convenience to test with different policies :)
Got it, I want to run a few more tests to make sure which policy to enable by default. Also @girarda will help me to run tests with live account to make sure we don't miss anything. And I'm done. |
…all_rate_concurrent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -5,7 +5,7 @@ | |||
|
|||
from setuptools import find_packages, setup | |||
|
|||
MAIN_REQUIREMENTS = ["airbyte-cdk==0.52.8", "stripe==2.56.0", "pendulum==2.1.2"] | |||
MAIN_REQUIREMENTS = ["airbyte-cdk==0.53.2", "stripe==2.56.0", "pendulum==2.1.2"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: we'll need to bump this to the latest version with the higher retry count
), | ||
] | ||
else: | ||
policies = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default should use a policy
_MAX_CONCURRENCY = 3 | ||
logger = logging.getLogger("airbyte") | ||
|
||
_MAX_CONCURRENCY = 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the limit in the spec should be aligned with this limit
@@ -62,9 +62,17 @@ connectionSpecification: | |||
title: Number of concurrent workers | |||
minimum: 1 | |||
maximum: 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maximum should be 20
@@ -62,9 +62,17 @@ connectionSpecification: | |||
title: Number of concurrent workers | |||
minimum: 1 | |||
maximum: 3 | |||
default: 2 | |||
default: 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's set the default to 10 and go from there
@@ -62,9 +62,17 @@ connectionSpecification: | |||
title: Number of concurrent workers | |||
minimum: 1 | |||
maximum: 3 | |||
default: 2 | |||
default: 20 | |||
examples: [1, 2, 3] | |||
description: >- | |||
The number of worker thread to use for the sync. The bigger the value is, the faster the sync will be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The number of worker thread to use for the sync. The bigger the value is, the faster the sync will be. | |
The number of worker thread to use for the sync. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this statement isn't true
else: | ||
call_limit = max_call_rate | ||
|
||
if config.get("call_rate_policy") == "fixed_window": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call_rate_policy isn't in the pec so this will never be true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something went wrong with merge, so this was an old code, updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!
docs/integrations/sources/stripe.md
Outdated
@@ -216,6 +216,7 @@ Each record is marked with `is_deleted` flag when the appropriate event happens | |||
|
|||
| Version | Date | Pull Request | Subject | | |||
|:--------|:-----------|:----------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------| | |||
| 4.5.4 | 2023-11-15 | [32284](https://github.com/airbytehq/airbyte/pull/32284/) | Enable client-side rate limiting | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's update the date before merging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@maxi297 😇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check list has been updated. I'm good with the implementation
What
This adds client-side rate limiting that helps increase the number of workers and not hit the call rate limit when it is too big.
How
Describe the solution
Recommended reading order
spec.yaml
source.py
🚨 User Impact 🚨
Are there any breaking changes? What is the end result perceived by the user?
For connector PRs, use this section to explain which type of semantic versioning bump occurs as a result of the changes. Refer to our Semantic Versioning for Connectors guidelines for more information. Breaking changes to connectors must be documented by an Airbyte engineer (PR author, or reviewer for community PRs) by using the Breaking Change Release Playbook.
If there are breaking changes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
Pre-merge Actions
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.0.0.1
Dockerfile
has version0.0.1
README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog with an entry for the initial version. See changelog exampledocs/integrations/README.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
Updating a connector
Community member or Airbyter
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
Connector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:generateScaffolds
then checking in your changesUpdating the Python CDK
Airbyter
Before merging:
--use-local-cdk --name=source-<connector>
as optionsairbyte-ci connectors --use-local-cdk --name=source-<connector> test
After merging: