Skip to content

Commit 560bead

Browse files
🐛 Source Monday: handle complexityBudgetExhausted error (#36717)
1 parent 4ac078b commit 560bead

File tree

8 files changed

+71
-50
lines changed

8 files changed

+71
-50
lines changed

airbyte-integrations/connectors/source-monday/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ data:
1010
connectorSubtype: api
1111
connectorType: source
1212
definitionId: 80a54ea2-9959-4040-aac1-eee42423ec9b
13-
dockerImageTag: 2.1.0
13+
dockerImageTag: 2.1.1
1414
releases:
1515
breakingChanges:
1616
2.0.0:

airbyte-integrations/connectors/source-monday/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
version = "2.1.0"
6+
version = "2.1.1"
77
name = "source-monday"
88
description = "Source implementation for Monday."
99
authors = [ "Airbyte <[email protected]>",]

airbyte-integrations/connectors/source-monday/source_monday/manifest.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ definitions:
2828
response_filters:
2929
- predicate: "{{ 'error_code' in response and response['error_code'] == 'ComplexityException' }}"
3030
action: RETRY
31+
- predicate: "{{ 'error_code' in response and response['error_code'] == 'complexityBudgetExhausted' }}"
32+
action: RETRY
3133
backoff_strategies:
3234
- type: ConstantBackoffStrategy
3335
backoff_time_in_seconds: 60

airbyte-integrations/connectors/source-monday/unit_tests/integrations/monday_responses/error_response_builder.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
22

33
import json
4+
from typing import Optional
45

56
from airbyte_cdk.test.mock_http import HttpResponse
67
from airbyte_cdk.test.mock_http.response_builder import find_template
@@ -14,5 +15,8 @@ def __init__(self, status_code: int):
1415
def response_with_status(cls, status_code) -> "ErrorResponseBuilder":
1516
return cls(status_code)
1617

17-
def build(self) -> HttpResponse:
18-
return HttpResponse(json.dumps(find_template(str(self._status_code), __file__)), self._status_code)
18+
def build(self, file_path: Optional[str] = None) -> HttpResponse:
19+
if not file_path:
20+
return HttpResponse(json.dumps(find_template(str(self._status_code), __file__)), self._status_code)
21+
return HttpResponse(json.dumps(find_template(str(file_path), __file__)), self._status_code)
22+

airbyte-integrations/connectors/source-monday/unit_tests/integrations/test_teams_stream.py

+26-20
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,33 @@ def test_given_retryable_error_and_one_page_when_read_teams_then_return_records(
4444
"""
4545
A full refresh sync without pagination completes successfully after one retry
4646
"""
47-
api_token_authenticator = self.get_authenticator(self._config)
48-
49-
http_mocker.get(
50-
TeamsRequestBuilder.teams_endpoint(api_token_authenticator).build(),
51-
[
52-
ErrorResponseBuilder.response_with_status(200).build(),
53-
TeamsResponseBuilder.teams_response().with_record(TeamsRecordBuilder.teams_record()).build(),
54-
],
55-
)
56-
57-
with patch("time.sleep", return_value=None):
58-
output = read_stream("teams", SyncMode.full_refresh, self._config)
59-
60-
assert len(output.records) == 1
61-
62-
error_logs = [
63-
error
64-
for error in get_log_messages_by_log_level(output.logs, LogLevel.INFO)
65-
if f'Response Code: 200, Response Text: {json.dumps({"error_code": "ComplexityException", "status_code": 200})}' in error
47+
test_cases = [
48+
("200_ComplexityException", "ComplexityException"),
49+
("200_complexityBudgetExhausted", "complexityBudgetExhausted"),
6650
]
67-
assert len(error_logs) == 1
51+
for test_values in test_cases:
52+
response, error_code = test_values[0], test_values[1]
53+
api_token_authenticator = self.get_authenticator(self._config)
54+
55+
http_mocker.get(
56+
TeamsRequestBuilder.teams_endpoint(api_token_authenticator).build(),
57+
[
58+
ErrorResponseBuilder.response_with_status(200).build(response),
59+
TeamsResponseBuilder.teams_response().with_record(TeamsRecordBuilder.teams_record()).build(),
60+
],
61+
)
62+
63+
with patch("time.sleep", return_value=None):
64+
output = read_stream("teams", SyncMode.full_refresh, self._config)
65+
66+
assert len(output.records) == 1
67+
68+
error_logs = [
69+
error
70+
for error in get_log_messages_by_log_level(output.logs, LogLevel.INFO)
71+
if f'Response Code: 200, Response Text: {json.dumps({"error_code": error_code, "status_code": 200})}' in error
72+
]
73+
assert len(error_logs) == 1
6874

6975
@HttpMocker()
7076
def test_given_retryable_error_when_read_teams_then_stop_syncing(self, http_mocker):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"error_code": "ComplexityException",
3+
"status_code": 200
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"error_code": "complexityBudgetExhausted",
3+
"status_code": 200
4+
}

docs/integrations/sources/monday.md

+27-26
Original file line numberDiff line numberDiff line change
@@ -72,29 +72,30 @@ The Monday connector should not run into Monday API limitations under normal usa
7272

7373
## Changelog
7474

75-
| Version | Date | Pull Request | Subject |
76-
|:--------|:-----------|:-----------------------------------------------------------|:------------------------------------------------------------------------|
77-
| 2.1.0 | 2024-04-03 | [36746](https://github.com/airbytehq/airbyte/pull/36746) | Pin airbyte-cdk version to `^0` |
78-
| 2.0.4 | 2024-02-28 | [35696](https://github.com/airbytehq/airbyte/pull/35696) | Fix extraction for `null` value in stream `Activity logs` |
79-
| 2.0.3 | 2024-02-21 | [35506](https://github.com/airbytehq/airbyte/pull/35506) | Support for column values of the mirror type for the `Items` stream. |
80-
| 2.0.2 | 2024-02-12 | [35146](https://github.com/airbytehq/airbyte/pull/35146) | Manage dependencies with Poetry. |
81-
| 2.0.1 | 2024-02-08 | [35016](https://github.com/airbytehq/airbyte/pull/35016) | Migrated to the latest airbyte cdk |
82-
| 2.0.0 | 2024-01-12 | [34108](https://github.com/airbytehq/airbyte/pull/34108) | Migrated to the latest API version: 2024-01 |
83-
| 1.1.4 | 2023-12-13 | [33448](https://github.com/airbytehq/airbyte/pull/33448) | Increase test coverage and migrate to base image |
84-
| 1.1.3 | 2023-09-23 | [30248](https://github.com/airbytehq/airbyte/pull/30248) | Add new field "type" to board stream |
85-
| 1.1.2 | 2023-08-23 | [29777](https://github.com/airbytehq/airbyte/pull/29777) | Add retry for `502` error |
86-
| 1.1.1 | 2023-08-15 | [29429](https://github.com/airbytehq/airbyte/pull/29429) | Ignore `null` records in response |
87-
| 1.1.0 | 2023-07-05 | [27944](https://github.com/airbytehq/airbyte/pull/27944) | Add incremental sync for Items and Boards streams |
88-
| 1.0.0 | 2023-06-20 | [27410](https://github.com/airbytehq/airbyte/pull/27410) | Add new streams: Tags, Workspaces. Add new fields for existing streams. |
89-
| 0.2.6 | 2023-06-12 | [27244](https://github.com/airbytehq/airbyte/pull/27244) | Added http error handling for `403` and `500` HTTP errors |
90-
| 0.2.5 | 2023-05-22 | [225881](https://github.com/airbytehq/airbyte/pull/25881) | Fix pagination for the items stream |
91-
| 0.2.4 | 2023-04-26 | [25277](https://github.com/airbytehq/airbyte/pull/25277) | Increase row limit to 100 |
92-
| 0.2.3 | 2023-03-06 | [23231](https://github.com/airbytehq/airbyte/pull/23231) | Publish using low-code CDK Beta version |
93-
| 0.2.2 | 2023-01-04 | [20996](https://github.com/airbytehq/airbyte/pull/20996) | Fix json schema loader |
94-
| 0.2.1 | 2022-12-15 | [20533](https://github.com/airbytehq/airbyte/pull/20533) | Bump CDK version |
95-
| 0.2.0 | 2022-12-13 | [19586](https://github.com/airbytehq/airbyte/pull/19586) | Migrate to low-code |
96-
| 0.1.4 | 2022-06-06 | [14443](https://github.com/airbytehq/airbyte/pull/14443) | Increase retry_factor for Items stream |
97-
| 0.1.3 | 2021-12-23 | [8172](https://github.com/airbytehq/airbyte/pull/8172) | Add oauth2.0 support |
98-
| 0.1.2 | 2021-12-07 | [8429](https://github.com/airbytehq/airbyte/pull/8429) | Update titles and descriptions |
99-
| 0.1.1 | 2021-11-18 | [8016](https://github.com/airbytehq/airbyte/pull/8016) | 🐛 Source Monday: fix pagination and schema bug |
100-
| 0.1.0 | 2021-11-07 | [7168](https://github.com/airbytehq/airbyte/pull/7168) | 🎉 New Source: Monday |
75+
| Version | Date | Pull Request | Subject |
76+
|:--------|:-----------|:----------------------------------------------------------|:------------------------------------------------------------------------|
77+
| 2.1.1 | 2024-04-05 | [36717](https://github.com/airbytehq/airbyte/pull/36717) | Add handling of complexityBudgetExhausted error. |
78+
| 2.1.0 | 2024-04-03 | [36746](https://github.com/airbytehq/airbyte/pull/36746) | Pin airbyte-cdk version to `^0` |
79+
| 2.0.4 | 2024-02-28 | [35696](https://github.com/airbytehq/airbyte/pull/35696) | Fix extraction for `null` value in stream `Activity logs` |
80+
| 2.0.3 | 2024-02-21 | [35506](https://github.com/airbytehq/airbyte/pull/35506) | Support for column values of the mirror type for the `Items` stream. |
81+
| 2.0.2 | 2024-02-12 | [35146](https://github.com/airbytehq/airbyte/pull/35146) | Manage dependencies with Poetry. |
82+
| 2.0.1 | 2024-02-08 | [35016](https://github.com/airbytehq/airbyte/pull/35016) | Migrated to the latest airbyte cdk |
83+
| 2.0.0 | 2024-01-12 | [34108](https://github.com/airbytehq/airbyte/pull/34108) | Migrated to the latest API version: 2024-01 |
84+
| 1.1.4 | 2023-12-13 | [33448](https://github.com/airbytehq/airbyte/pull/33448) | Increase test coverage and migrate to base image |
85+
| 1.1.3 | 2023-09-23 | [30248](https://github.com/airbytehq/airbyte/pull/30248) | Add new field "type" to board stream |
86+
| 1.1.2 | 2023-08-23 | [29777](https://github.com/airbytehq/airbyte/pull/29777) | Add retry for `502` error |
87+
| 1.1.1 | 2023-08-15 | [29429](https://github.com/airbytehq/airbyte/pull/29429) | Ignore `null` records in response |
88+
| 1.1.0 | 2023-07-05 | [27944](https://github.com/airbytehq/airbyte/pull/27944) | Add incremental sync for Items and Boards streams |
89+
| 1.0.0 | 2023-06-20 | [27410](https://github.com/airbytehq/airbyte/pull/27410) | Add new streams: Tags, Workspaces. Add new fields for existing streams. |
90+
| 0.2.6 | 2023-06-12 | [27244](https://github.com/airbytehq/airbyte/pull/27244) | Added http error handling for `403` and `500` HTTP errors |
91+
| 0.2.5 | 2023-05-22 | [225881](https://github.com/airbytehq/airbyte/pull/25881) | Fix pagination for the items stream |
92+
| 0.2.4 | 2023-04-26 | [25277](https://github.com/airbytehq/airbyte/pull/25277) | Increase row limit to 100 |
93+
| 0.2.3 | 2023-03-06 | [23231](https://github.com/airbytehq/airbyte/pull/23231) | Publish using low-code CDK Beta version |
94+
| 0.2.2 | 2023-01-04 | [20996](https://github.com/airbytehq/airbyte/pull/20996) | Fix json schema loader |
95+
| 0.2.1 | 2022-12-15 | [20533](https://github.com/airbytehq/airbyte/pull/20533) | Bump CDK version |
96+
| 0.2.0 | 2022-12-13 | [19586](https://github.com/airbytehq/airbyte/pull/19586) | Migrate to low-code |
97+
| 0.1.4 | 2022-06-06 | [14443](https://github.com/airbytehq/airbyte/pull/14443) | Increase retry_factor for Items stream |
98+
| 0.1.3 | 2021-12-23 | [8172](https://github.com/airbytehq/airbyte/pull/8172) | Add oauth2.0 support |
99+
| 0.1.2 | 2021-12-07 | [8429](https://github.com/airbytehq/airbyte/pull/8429) | Update titles and descriptions |
100+
| 0.1.1 | 2021-11-18 | [8016](https://github.com/airbytehq/airbyte/pull/8016) | 🐛 Source Monday: fix pagination and schema bug |
101+
| 0.1.0 | 2021-11-07 | [7168](https://github.com/airbytehq/airbyte/pull/7168) | 🎉 New Source: Monday |

0 commit comments

Comments
 (0)