-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat: Hog transformation comparer #28104
Conversation
Size Change: -5 B (0%) Total Size: 1.16 MB ℹ️ View Unchanged
|
@@ -164,20 +168,38 @@ export class HogTransformerService { | |||
return promises | |||
} | |||
|
|||
public transformEvent(event: PluginEvent): Promise<TransformationResult> { | |||
public transformEventAndProduceMessages(event: PluginEvent): Promise<TransformationResult> { |
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.
Wasn't sure of the naming here but basically wanted one function that does the transform and another that does it and produces the kafka messages
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.
PR Summary
This PR introduces a comprehensive system for safely migrating from plugin transformations to hog functions. Here's a summary of the key changes:
- Added comparison mechanism in
compareToHogTransformStep.ts
to validate hog transformations against existing plugin outputs with configurable sampling rate - Introduced
templating: false
property across transformation plugin templates to explicitly control template processing behavior - Modified
HogTransformerService
to separate message production from event transformation logic and improve error handling - Added migration scripts with
--kind
parameter to support selective migration of 'destination' or 'transformation' plugins - Added
HOG_TRANSFORMATIONS_COMPARISON_PERCENTAGE
config to control sampling rate and prevent excessive load on ingestion pipeline
Key points to review:
- The hardcoded project name in
createInvocationGlobals
needs to be addressed - The
execute
method inHogTransformerService
doesn't awaithogExecutor.execute
result which could cause timing issues - The downsampling plugin template has a simplified
return event
implementation that may not fully replicate original functionality - Error handling in
transformEvent
continues execution after errors instead of failing fast
22 file(s) reviewed, 13 comment(s)
Edit PR Review Bot Settings | Greptile
plugin-server/src/cdp/legacy-plugins/_transformations/language-url-splitter-app/template.ts
Show resolved
Hide resolved
plugin-server/src/cdp/legacy-plugins/_transformations/language-url-splitter-app/template.ts
Show resolved
Hide resolved
plugin-server/src/cdp/legacy-plugins/_transformations/posthog-filter-out-plugin/template.ts
Show resolved
Hide resolved
plugin-server/src/cdp/legacy-plugins/_transformations/semver-flattener-plugin/template.ts
Show resolved
Hide resolved
plugin-server/src/worker/ingestion/event-pipeline/compareToHogTransformStep.ts
Outdated
Show resolved
Hide resolved
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.
Looked at the TS code, LGTM. I haven't worked on the migration bit at all, so it's hard for me to do a review yet.
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Problem
We want to safely roll out the migration to hog functions but the question is - how?
Changes
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Does this work well for both Cloud and self-hosted?
How did you test this code?