Skip to content

feat(cdp): batch hogfun watcher #30603

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

Merged
merged 46 commits into from
Apr 14, 2025
Merged

Conversation

meikelmosby
Copy link
Contributor

@meikelmosby meikelmosby commented Mar 31, 2025

Problem

Because we do not want to run getStates per Event or just using a percentage of our traffic we perform the operation using hogwatcher per batch

Changes

  • implemented saving hogwatcher-state on hogtransformer class
  • filtering (currently only logging) out of functions that are degraded
  • added instrumentation for added latency of hogwatcher operations (redis calls)
  • added function to get hogfunctionIds for a Team

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

How did you test this code?

  • added new tests

@meikelmosby meikelmosby changed the title Feat/meikel/batch hogfun watcher feat(cdp): batch hogfun watcher Mar 31, 2025
@meikelmosby meikelmosby marked this pull request as ready for review March 31, 2025 15:37
@posthog-bot
Copy link
Contributor

Hey @meikelmosby! 👋
This pull request seems to contain no description. Please add useful context, rationale, and/or any other information that will help make sense of this change now and in the distant Mars-based future.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR refactors the ingestion pipeline to support batch processing of Hog functions and their watcher states, reducing per-event overhead.

• Updated plugin-server/src/worker/ingestion/event-pipeline/runner.ts to accept a new teamHogFunctions parameter and aggregate watcher promises.
• Modified plugin-server/src/ingestion/ingestion-consumer.ts to prefetch and filter Hog functions in batches using hogWatcher states.
• Refactored plugin-server/src/cdp/hog-transformations/hog-transformer.service.ts to simplify transformation logic and accept team hog functions.
• Aligned plugin-server/src/worker/ingestion/event-pipeline/transformEventStep.ts to maintain consistent watcherPromises output.

4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@meikelmosby meikelmosby mentioned this pull request Apr 1, 2025
26 tasks
@meikelmosby meikelmosby requested a review from benjackwhite April 2, 2025 11:13
@meikelmosby meikelmosby requested a review from benjackwhite April 3, 2025 07:54
@meikelmosby meikelmosby requested a review from benjackwhite April 4, 2025 09:46
@meikelmosby meikelmosby requested a review from benjackwhite April 4, 2025 13:28
Copy link
Contributor

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

Small change request otherwise looks good

@meikelmosby meikelmosby merged commit da6edd4 into master Apr 14, 2025
94 checks passed
@meikelmosby meikelmosby deleted the feat/meikel/batch-hogfun-watcher branch April 14, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.