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.

3.4 KB
Raw Blame
import {
    ASYNC_OUTPUT,
    EVENTS_OUTPUT,
    FLAG_EVALUATIONS_OUTPUT,
    PERSONS_OUTPUT,
    PERSON_DISTINCT_IDS_OUTPUT,
    PERSON_MERGE_EVENTS_OUTPUT,
    REALTIME_ONLY_EVENTS_OUTPUT,
} from '.'

import {
    APP_METRICS_OUTPUT,
    DLQ_OUTPUT,
    GROUPS_OUTPUT,
    INGESTION_WARNINGS_OUTPUT,
    LOG_ENTRIES_OUTPUT,
    OVERFLOW_OUTPUT,
    TOPHOG_OUTPUT,
} from '~/common/outputs'
import { IngestionOutputsBuilder } from '~/common/outputs/ingestion-outputs-builder'

/** Register all analytics ingestion outputs on the builder. Call `.build(registry, config)` to resolve. */
export function createOutputsRegistry() {
    return (
        new IngestionOutputsBuilder()
            .register(EVENTS_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_EVENTS_TOPIC',
                producerKey: 'INGESTION_OUTPUT_EVENTS_PRODUCER',
            })
            .register(FLAG_EVALUATIONS_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_FLAG_EVALUATIONS_TOPIC',
                producerKey: 'INGESTION_OUTPUT_FLAG_EVALUATIONS_PRODUCER',
            })
            .register(REALTIME_ONLY_EVENTS_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_REALTIME_ONLY_EVENTS_TOPIC',
                producerKey: 'INGESTION_OUTPUT_REALTIME_ONLY_EVENTS_PRODUCER',
            })
            .register(INGESTION_WARNINGS_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_INGESTION_WARNINGS_TOPIC',
                producerKey: 'INGESTION_OUTPUT_INGESTION_WARNINGS_PRODUCER',
            })
            .register(DLQ_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_DLQ_TOPIC',
                producerKey: 'INGESTION_OUTPUT_DLQ_PRODUCER',
            })
            .register(OVERFLOW_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_OVERFLOW_TOPIC',
                producerKey: 'INGESTION_OUTPUT_OVERFLOW_PRODUCER',
            })
            .register(ASYNC_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_ASYNC_TOPIC',
                producerKey: 'INGESTION_OUTPUT_ASYNC_PRODUCER',
            })
            .register(GROUPS_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_GROUPS_TOPIC',
                producerKey: 'INGESTION_OUTPUT_GROUPS_PRODUCER',
            })
            .register(PERSONS_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_PERSONS_TOPIC',
                producerKey: 'INGESTION_OUTPUT_PERSONS_PRODUCER',
            })
            .register(PERSON_DISTINCT_IDS_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_PERSON_DISTINCT_IDS_TOPIC',
                producerKey: 'INGESTION_OUTPUT_PERSON_DISTINCT_IDS_PRODUCER',
            })
            // Single-target: consumed by the cohort-stream-processor (Rust), not ClickHouse, so no dual-write.
            .register(PERSON_MERGE_EVENTS_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_PERSON_MERGE_EVENTS_TOPIC',
                producerKey: 'INGESTION_OUTPUT_PERSON_MERGE_EVENTS_PRODUCER',
            })
            .register(APP_METRICS_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_APP_METRICS_TOPIC',
                producerKey: 'INGESTION_OUTPUT_APP_METRICS_PRODUCER',
            })
            .register(LOG_ENTRIES_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_LOG_ENTRIES_TOPIC',
                producerKey: 'INGESTION_OUTPUT_LOG_ENTRIES_PRODUCER',
            })
            .register(TOPHOG_OUTPUT, {
                topicKey: 'INGESTION_OUTPUT_TOPHOG_TOPIC',
                producerKey: 'INGESTION_OUTPUT_TOPHOG_PRODUCER',
            })
    )
}