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 Klaviyo: add state_checkpoint_interval #32291

Merged
merged 3 commits into from
Nov 9, 2023

Conversation

askarpets
Copy link
Contributor

@askarpets askarpets commented Nov 8, 2023

What

Updates requested during certification checklist review:

  • Add logic to have regular checkpointing schedule
  • Update list of supported streams in klaviyo.md

How

Set state_checkpoint_interval property to maximum items per page returned by API for streams Profiles, GlobalExclusions, Events, Flows, and EmailTemplates

Recommended reading order

  1. streams.py
  2. klaviyo.md

🚨 User Impact 🚨

No breaking changes

Pre-merge Actions

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Unit & integration tests added

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.

@askarpets askarpets self-assigned this Nov 8, 2023
Copy link

vercel bot commented Nov 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Nov 8, 2023 2:39pm

@octavia-squidington-iii octavia-squidington-iii added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Nov 8, 2023
Copy link
Contributor

github-actions bot commented Nov 8, 2023

Before Merging a Connector Pull Request

Wow! 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:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan.
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • You've updated the connector's metadata.yaml file any other relevant changes, including a breakingChanges entry for major version bumps. See metadata.yaml docs
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • Migration guide updated in docs/integrations/<source or destination>/<name>-migrations.md with an entry for the new version, if the version is a breaking change. See migration guide example
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.

artem1205
artem1205 previously approved these changes Nov 8, 2023
@artem1205 artem1205 self-requested a review November 8, 2023 12:29
@octavia-squidington-iv octavia-squidington-iv requested a review from a team November 8, 2023 12:32
@askarpets askarpets requested a review from brianjlai November 8, 2023 14:46

### Step 2: Set up the Klaviyo connector in Airbyte

1. [Log into your Airbyte Cloud](https://cloud.airbyte.io/workspaces) account.
2. Click **Sources** and then click **+ New source**.
2. Click **Sources** and then click **+ new source**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locally, I have a different behavior than prod hence, I can't validate this fix.

Locally
image

Prod
image

How does removing the capital N removes the bullet list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me either, unfortunately. This is just my assumption based on what I've seen on other connectors which don't have such issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! Keep me posted on the result of this change and we'll update the checklist based on that. Thanks!


cursor_field = "updated"
api_revision = "2023-02-22"
page_size = 100
state_checkpoint_interval = 100 # API can return maximum 100 records per page
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little bit afraid of this change as we don't use sorting in the API endpoints. How can we validate that the records are emitted in the order of the cursor field? If they are not, this is dangerous as we could have:

  • emit record with cursor value 10
  • emit a state message with cursor value 10
  • emit record with cursor value 5
  • the sync crash

In that case, we wouldn't lose the record with cursor value 5 but we can see that if the crash happens just before, we would have lost the record.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is only applied to the streams which have sorting by cursor field at the API level - we add sorting param here: https://github.com/airbytehq/airbyte/pull/32291/files#diff-eb5f2206f720a1d96317e5a8b62e21de2eaa12b401666efccb798362b337eaf3R148

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given all the checkpoint_interval you added are for IncrementalKlaviyoStream, everything looks good then.

One non blocking question though: why the comment next to the checkpoint interval? How is the page size linked to the checkpoint_interval?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The connector is emitting its state after every page it's read. If the page is not full, the state will be emitted at the end of the read, otherwise, since pages are sorted by cursor, we can checkpointing after each page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic has been changed somewhat recently : we are emitting a state message after X number of records not after X number of records in a slice. Does that change the way you look at this problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, since there are no overridden stream_slices

Copy link
Contributor

@maxi297 maxi297 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one non blocking comment so I'm good to approve this PR. Thanks Anton!

@askarpets askarpets merged commit 2544a91 into master Nov 9, 2023
30 checks passed
@askarpets askarpets deleted the source-klaviyo-checkpoint-interval branch November 9, 2023 20:08
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/klaviyo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants