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.

1.3 KB
Raw Blame
import { KafkaProducerRegistryBuilder } from '~/common/outputs/kafka-producer-registry-builder'

import {
    WAREHOUSE_PRODUCER,
    WAREHOUSE_PRODUCER_CONFIG_MAP,
    WARPSTREAM_CYCLOTRON_PRODUCER,
    WARPSTREAM_CYCLOTRON_PRODUCER_CONFIG_MAP,
    WARPSTREAM_INGESTION_PRODUCER,
    WARPSTREAM_INGESTION_PRODUCER_CONFIG_MAP,
} from './producers'

/**
 * Producers used by the CDP deployments.
 *
 * - `WARPSTREAM_INGESTION_PRODUCER` — hog function monitoring (app metrics +
 *   log entries). Targets the warpstream-ingestion cluster.
 * - `WARPSTREAM_CYCLOTRON_PRODUCER` — Cyclotron Warpstream cluster used for
 *   batch hogflow request enqueue. Distinct env-var prefix from the legacy
 *   `KAFKA_CDP_PRODUCER_*` so output routing is decoupled from the cyclotron
 *   job queue's own producer.
 * - `WAREHOUSE_PRODUCER` — dedicated cluster for warehouse source webhooks.
 */
export function createCdpProducerRegistry(kafkaClientRack: string | undefined) {
    return new KafkaProducerRegistryBuilder(kafkaClientRack)
        .register(WARPSTREAM_INGESTION_PRODUCER, WARPSTREAM_INGESTION_PRODUCER_CONFIG_MAP)
        .register(WARPSTREAM_CYCLOTRON_PRODUCER, WARPSTREAM_CYCLOTRON_PRODUCER_CONFIG_MAP)
        .register(WAREHOUSE_PRODUCER, WAREHOUSE_PRODUCER_CONFIG_MAP)
}