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.

feat(kafka): add traces cluster profile and route traces topics (#94030)

Frank Hamand5c70b9ce8f17
diff --git a/posthog/kafka_client/profiles.py b/posthog/kafka_client/profiles.py
index 7ee2aa93e525..0a42dcb8e306 100644
--- a/posthog/kafka_client/profiles.py
+++ b/posthog/kafka_client/profiles.py
@@ -16,3 +16,4 @@ class KafkaClusterProfile(StrEnum):
CALCULATED_EVENTS = "calculated_events"
SHARED = "shared"
REPLAY = "replay"
+ TRACES = "traces"
diff --git a/posthog/kafka_client/routing.py b/posthog/kafka_client/routing.py
index 6fbcad0968b0..3098a6b467ba 100644
--- a/posthog/kafka_client/routing.py
+++ b/posthog/kafka_client/routing.py
@@ -49,6 +49,8 @@ from posthog.kafka_client.topics import (
KAFKA_PERSON,
KAFKA_PERSON_DISTINCT_ID,
KAFKA_SIGNALS_REPORT_COMPLETED,
+ KAFKA_TRACES_INGESTION,
+ KAFKA_TRACES_INGESTION_DLQ,
KAFKA_WAREHOUSE_PERSON_PROPERTY_UPDATES,
KAFKA_WAREHOUSE_PERSON_PROPERTY_UPDATES_DLQ,
KAFKA_WAREHOUSE_SOURCE_WEBHOOKS,
@@ -105,6 +107,8 @@ _DEFAULT_TOPIC_ROUTING: dict[str, KafkaClusterProfile] = {
# --- REPLAY (Session replay) ---
KAFKA_CLICKHOUSE_SESSION_RECORDING_EVENTS: KafkaClusterProfile.REPLAY,
KAFKA_CLICKHOUSE_SESSION_REPLAY_EVENTS: KafkaClusterProfile.REPLAY,
+ KAFKA_TRACES_INGESTION: KafkaClusterProfile.TRACES,
+ KAFKA_TRACES_INGESTION_DLQ: KafkaClusterProfile.TRACES,
}
diff --git a/posthog/kafka_client/test/test_routing.py b/posthog/kafka_client/test/test_routing.py
index 170facf58134..40cfcb713963 100644
--- a/posthog/kafka_client/test/test_routing.py
+++ b/posthog/kafka_client/test/test_routing.py
@@ -25,6 +25,8 @@ from posthog.kafka_client.topics import (
KAFKA_DEAD_LETTER_QUEUE,
KAFKA_DWH_CDP_RAW_TABLE,
KAFKA_EVENTS_JSON,
+ KAFKA_TRACES_INGESTION,
+ KAFKA_TRACES_INGESTION_DLQ,
KAFKA_WAREHOUSE_SOURCE_WEBHOOKS,
)
@@ -113,6 +115,8 @@ class CurrentTopicRoutingTest(TestCase):
self.assertEqual(mapping.get(KAFKA_DWH_CDP_RAW_TABLE), KafkaClusterProfile.CYCLOTRON)
# KAFKA_APP_METRICS2 is routed to the INGESTION cluster.
self.assertEqual(mapping.get(KAFKA_APP_METRICS2), KafkaClusterProfile.INGESTION)
+ self.assertEqual(mapping.get(KAFKA_TRACES_INGESTION), KafkaClusterProfile.TRACES)
+ self.assertEqual(mapping.get(KAFKA_TRACES_INGESTION_DLQ), KafkaClusterProfile.TRACES)
def test_env_overrides_add_new_topic(self):
# KAFKA_DEAD_LETTER_QUEUE is deliberately absent from the defaults, so this covers
diff --git a/posthog/kafka_client/topics.py b/posthog/kafka_client/topics.py
index 98bdbb42f8ab..9e29c385b245 100644
--- a/posthog/kafka_client/topics.py
+++ b/posthog/kafka_client/topics.py
@@ -91,3 +91,6 @@ KAFKA_FLAGS_CACHE_INVALIDATION_DLQ = f"{KAFKA_PREFIX}flags_cache_invalidation_dl
# Consumer: a dedicated throttling consumer that rate-limits $set events into capture-internal.
KAFKA_WAREHOUSE_PERSON_PROPERTY_UPDATES = f"{KAFKA_PREFIX}warehouse_person_property_updates{SUFFIX}"
KAFKA_WAREHOUSE_PERSON_PROPERTY_UPDATES_DLQ = f"{KAFKA_PREFIX}warehouse_person_property_updates_dlq{SUFFIX}"
+
+KAFKA_TRACES_INGESTION = f"{KAFKA_PREFIX}ingestion-traces{SUFFIX}"
+KAFKA_TRACES_INGESTION_DLQ = f"{KAFKA_PREFIX}ingestion-traces-dlq{SUFFIX}"