Skip to content

: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.

727 B
Raw Blame
import { HogTransformer } from './hog-transformer.interface'

/**
 * Scope owner for a hog transformer: starts it on `start()` and stops it on
 * `stop()`, so its lifetime is tied to the owning scope. The concrete
 * transformer is supplied by the caller via a factory (the implementation
 * lives in cdp), so ingestion scopes own its lifecycle without importing cdp.
 */
export class HogTransformerComponent {
    constructor(private readonly create: () => HogTransformer) {}

    async start(): Promise<{ value: HogTransformer; stop: () => Promise<void> }> {
        const hogTransformer = this.create()
        await hogTransformer.start()
        return { value: hogTransformer, stop: () => hogTransformer.stop() }
    }
}