How we migrated a live routing system using AI-assisted refactoring | Datadog

This post details the migration of Datadog's Stream Router from a KV-based storage model (FoundationDB/RocksDB) to a relational schema backed by PostgreSQL (write path) and DuckDB (read path). The migration was driven by the limitations of the KV model in handling complex relationships between routes, sharding strategies, and rules, which led to transaction size limits and performance bottlenecks. The new schema directly models these relationships with foreign keys. The migration process was significantly accelerated using AI-assisted refactoring tools (Claude, Cursor) in a test-driven workflow, where AI generated code based on old implementations, new schemas, and failing tests. The post highlights the benefits of this approach for safely evolving critical production systems, emphasizing the human expertise still required for validation and complex logic.
More from the Data Completeness Measurement trail
- How we measure data completeness at scale | Datadog
- How we built reliable log delivery to thousands of unpredictable endpoints | Datadog
- Achieving relentless Kafka reliability at scale with the Streaming Platform | Datadog
- How we use formal modeling, lightweight simulations, and chaos testing to design reliable distributed systems | Datadog
- Scaling Self-Serve Analytics: The Tools Empowering 5,000 Employees | Datadog