:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { PluginEvent } from '~/plugin-scaffold'
/**
* Contract for the hog transformation service, consumed by ingestion.
*
* The concrete implementation (`HogTransformerService`) lives in cdp because it depends on the
* full hog execution machinery (executor, managers, templates, plugins). Ingestion depends only
* on this interface and receives an instance by injection from the server wiring layer, so
* ingestion never imports cdp.
*/
export interface HogTransformationResult {
event: PluginEvent | null
// Opaque to ingestion (it only reads `.length`); cdp narrows this to its concrete result type.
invocationResults: unknown[]
// Set when `event` is null: the transformation that dropped the event.
droppedBy?: { id: string; name: string }
}
export interface HogTransformer {
start(): Promise<void>
stop(): Promise<void>
processInvocationResults(): Promise<void>
transformEventAndProduceMessages(event: PluginEvent): Promise<HogTransformationResult>
// Refresh cached transformation hog-function states for the given teams (used by the ingestion
// prefetch step). Encapsulates the hog-function-manager lookup ingestion would otherwise reach into.
prefetchHogFunctionsForTeams(teamIds: number[]): Promise<void>
}