-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 Bing Ads : fix rollback window for marketing performance reports #23663
🐛 Source Bing Ads : fix rollback window for marketing performance reports #23663
Conversation
6f06556
to
b91d68f
Compare
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.
Hey @tlatrace, thanks for the contribution.
On a first glance, this looks good. A small nit would be to rename _get_start_date
to simply get_start_date
(without a prefixing underscore) so that it matches the naming conventions of the other methods.
Additionally, could you explain what the test case you've added is testing?
@@ -38,6 +38,14 @@ def test_get_column_value(): | |||
assert test_report.get_column_value(record, "Spend") == 1.203 | |||
|
|||
|
|||
def test_get_updated_state_init_state(): |
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 unit test makes sure that the state is correctly initiated for a given stream.
Nothing related to the fix, but I took the opportunity to add it as it was missing.
8460c14
to
26abc58
Compare
/test connector=connectors/source-bing-ads
Build FailedTest summary info:
|
lookback_window has been added to the configs on GSM |
/test connector=connectors/source-bing-ads
Build FailedTest summary info:
|
Thank you @sajarin! I suspect Is a default value set for Failing tests:
Captured log call023-03-15T18:18:36.7227793Z ERROR root:connector_runner.py:172 Docker container failed, code 1, error: 2023-03-15T18:18:36.7232397Z ***"type": "TRACE", "trace": ***"type": "ERROR", "emitted_at": 1678904314295.8801, "error": ***"message": "Something went wrong in the connector. See the logs for more details.", "internal_message": "'NoneType' object has no attribute 'convert'", "stack_trace": "Traceback (most recent call last):\n File \"/airbyte/integration_code/main.py\", line 13, in \n launch(source, sys.argv[1:])\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/entrypoint.py\", line 131, in launch\n for message in source_entrypoint.run(parsed_args):\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/entrypoint.py\", line 122, in run\n for message in generator:\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py\", line 134, in read\n raise e\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py\", line 120, in read\n yield from self._read_stream(\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py\", line 189, in _read_stream\n for record in record_iterator:\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py\", line 307, in _read_full_refresh\n for record_data_or_message in record_data_or_messages:\n File \"/airbyte/integration_code/source_bing_ads/source.py\", line 125, in read_records\n params = self.request_params(\n File \"/airbyte/integration_code/source_bing_ads/reports.py\", line 206, in request_params\n start_date = self.get_start_date(stream_state, account_id)\n File \"/airbyte/integration_code/source_bing_ads/reports.py\", line 349, in get_start_date\n start_date = self.client.reports_start_date.subtract(days=self.config[\"lookback_window\"])\n File \"/usr/local/lib/python3.9/site-packages/pendulum/datetime.py\", line 721, in subtract\n return self.add(\n File \"/usr/local/lib/python3.9/site-packages/pendulum/datetime.py\", line 667, in add\n dt = self.tz.convert(dt)\nAttributeError: 'NoneType' object has no attribute 'convert'\n", "failure_type": "system_error"*** |
/test connector=connectors/source-bing-ads
Build FailedTest summary info:
|
@tlatrace running the tests again, I'm not able to get integration tests passing locally given our credentials despite setting the lookback_window to a default value of 0. Do you screenshots of passing integration tests? The above images includes passing unit but for integration tests, I'm not seeing any tests being run there. Just trying to verify that this is working so that I can debug my local and get it working in the CI/CD. |
Following the documentation, I first tried to run integration tests with this Docker command:
But I reached this error for 4 tests: I then tried to run integration tests using Gradle:
Which led to Could you please provide help on this @sajarin? 🙏 |
c396329
to
cb37392
Compare
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.
Thank you for your feedback @marcosmarxm. Just to be sure, is something else required from my side? |
Nope! Right now I'm going to wait the final approval from the connector team. Because Bing Ads it is a GA connector there are some discussion to merge new code into the connector. |
Published |
Awesome, thanks @marcosmarxm! |
What
Bing Ads connector doesn’t ingest all conversions for marketing performance reports. There are discrepancies between Bing UI data and data received in the Destination.
At the moment, the conversions' fields (Conversions, AllConversions, ConversionsQualified) in the Destination only count conversions that happened the day of the click. Conversions happening after 2+ days, during the attribution window, are not counted.
The problem comes from the connector cursor field (on the incremental sync) not being appropriately implemented. Indeed, it misses a rollback window to attribute conversions happening after 2+ days.
This PR intends to add an optional parameter
lookback_window
in the connector configuration, for performance reports ingested with incremental streams.Fixes #22930.
How
During a sync, instead of retrieving data from
[cursor_value, now()]
, we’ll retrieve data from[cursor_value - rollback_window, now()]
. So the API call logic is modified (not the cursor logic).This means that if the cursor value is set to 15/12/2022, we’ll retrieve data up to 15/11/2022 (for a 30-day attribution window).
Cons: we’ll ingest lots of duplicates in the history table (30 duplicates per record in most cases!). The
deduped + history
feature will handle the deduplication in the final table.Recommended reading order
Review per commit, in chronological order.
🚨 User Impact 🚨
No breaking changes as the
lookback_window
is an optional parameter.Pre-merge Checklist
Updating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog example