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 PostHog: Fix events stream pagination #44016

Merged

Conversation

LouisAuneau
Copy link
Contributor

What

This PR contains two changes:

  1. It solves PostHog source pagination bug on stream events, that was raised through issue [source-posthog] Connector historical sync #33915. Indeed, the stream was using a cursor based pagination. However, the pagination in PostHog API is broken (see issue): the cursor (field next in API response) returns the same URL that was called, causing Airbyte stream to loop infinitely over the same page. There is no plan on PostHog end to fix this as the API endpoint is deprecated and kept only for backward compatibility (see documentation).
  2. It updates the connector README.md according to the poetry update.

How

For the issue on the events stream, there is a possible workaround, by using an offset based pagination. PostHog's API has limit and offset query parameters that are working. Once the pagination returns no results, the result is null.

Therefore I updated the manifest.yaml key definitions.events_stream.retriever.paginator.pagination_strategy to an OffsetIncrement.

Review guide

  1. airbyte-integrations/connectors/source-posthog/source_posthog/manifest.yaml
  2. airbyte-integrations/connectors/source-posthog/README.md
  3. docs/integrations/sources/posthog.md

User Impact

Instead of an infinite loop and a failing stream, the user will get all events.

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

Copy link

vercel bot commented Aug 13, 2024

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

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 9:49pm

@CLAassistant
Copy link

CLAassistant commented Aug 13, 2024

CLA assistant check
All committers have signed the CLA.

type: RequestPath
$parameters:
url_base: "#/definitions/requester/url_base"
type: RequestOption
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't particularly mind, but generally cursor should be better than offset/increment. Can you link me to posthog docs explaining whether that stream does / does not have the cursor?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hypothetically, the response.next should be there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see.

Copy link
Contributor

@natikgadzhi natikgadzhi left a comment

Choose a reason for hiding this comment

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

Ok I understand the change and it doesn't break any new tests.

type: RequestPath
$parameters:
url_base: "#/definitions/requester/url_base"
type: RequestOption
Copy link
Contributor

Choose a reason for hiding this comment

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

Hypothetically, the response.next should be there.

type: RequestPath
$parameters:
url_base: "#/definitions/requester/url_base"
type: RequestOption
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see.

@natikgadzhi
Copy link
Contributor

@airbytehq/dev-tooling tagging you to check out a PR where regression tests can't run with "NotGitRepo" — I think that's because it's from a fork?

@natikgadzhi natikgadzhi merged commit cc6c6a4 into airbytehq:master Aug 15, 2024
34 of 36 checks passed
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 community connectors/source/posthog
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants