Skip to content
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

🐛 Source Google Analytics 4 (GA4): improve rate limits messages and retry logic #23822

Merged
merged 14 commits into from
Mar 11, 2023

Conversation

bazarnov
Copy link
Collaborator

@bazarnov bazarnov commented Mar 7, 2023

What

Resolving:

How

  • added new class GoogleAnalyticsApiQuota to handle quota-specific scenarios, based on error message (not all cases covered. The other cases could be added easily having the error message later on)

Recommended reading order

Starting with source.py > should_retry
- values for should_retry, raise_on_http_errors are referenced from the GoogleAnalyticsApiQuota to cover the scenarios for should_retry
- value for backoff_time is referenced from the GoogleAnalyticsApiQuota to cover the scenarios for backoff_time

Handled scenarios:

  • exceeded tokens / project / hour
  • exceeded concurrent tokens / project / hour

🚨 User Impact 🚨

No impact is expected.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped by running the /publish command described here

@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Mar 7, 2023
@bazarnov bazarnov self-assigned this Mar 7, 2023
@bazarnov bazarnov linked an issue Mar 7, 2023 that may be closed by this pull request
@bazarnov
Copy link
Collaborator Author

bazarnov commented Mar 10, 2023

/test connector=connectors/source-google-analytics-data-api

🕑 connectors/source-google-analytics-data-api https://github.com/airbytehq/airbyte/actions/runs/4385588115
✅ connectors/source-google-analytics-data-api https://github.com/airbytehq/airbyte/actions/runs/4385588115
Python tests coverage:

Name                                                Stmts   Miss  Cover
-----------------------------------------------------------------------
source_google_analytics_data_api/__init__.py            2      0   100%
source_google_analytics_data_api/authenticator.py      44      3    93%
source_google_analytics_data_api/utils.py              26      2    92%
source_google_analytics_data_api/source.py            193     15    92%
source_google_analytics_data_api/api_quota.py          94     12    87%
-----------------------------------------------------------------------
TOTAL                                                 359     32    91%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/connector_acceptance_test/tests/test_core.py:100: The previous and actual specifications are identical.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/connector_acceptance_test/tests/test_core.py:509: The previous and actual discovered catalogs are identical.
================== 35 passed, 2 skipped in 429.22s (0:07:09) ===================

@bazarnov bazarnov requested review from a team March 10, 2023 16:09
@bazarnov bazarnov requested a review from girarda March 10, 2023 17:41
@bazarnov
Copy link
Collaborator Author

bazarnov commented Mar 11, 2023

/publish connector=connectors/source-google-analytics-data-api

🕑 Publishing the following connectors:
connectors/source-google-analytics-data-api
https://github.com/airbytehq/airbyte/actions/runs/4391499134


Connector Did it publish? Were definitions generated?
connectors/source-google-analytics-data-api

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@bazarnov
Copy link
Collaborator Author

bazarnov commented Mar 11, 2023

@evantahler please advise on this failing test: POC - please ignore connector tests:
https://github.com/airbytehq/airbyte/actions/runs/4391568285

When you open the actual failed test, you will see it's succeeded:
Screenshot 2023-03-11 at 20 29 54

Can I merge in safely with this one failing?

@evantahler
Copy link
Contributor

You can ignore the POC - please ignore connector tests for now! We are moving to a new connector testing system which will eventually replace /test and use github actions in the normal way to gate PRs. More information coming soon!

cc @alafanechere

@bazarnov bazarnov merged commit 00752aa into master Mar 11, 2023
@bazarnov bazarnov deleted the baz/source-google-analytics-4-fix-rate-limits branch March 11, 2023 19:15
danielduckworth pushed a commit to danielduckworth/airbyte that referenced this pull request Mar 13, 2023
adriennevermorel pushed a commit to adriennevermorel/airbyte that referenced this pull request Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation connectors/source/google-analytics-data-api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google Analytics - Handle Quota Limits Gracefully
6 participants