Menu
Datadog Blog·November 5, 2026

Continuously Validating Formal Specifications in Production with FETCh

Datadog developed FETCh, a system to continuously validate the behavior of production services against formal specifications written in TLA+. This approach helps uncover subtle, hard-to-find bugs that traditional testing methods often miss, ensuring that complex distributed systems adhere to their intended design principles even under real-world load. It represents a robust strategy for increasing confidence in the correctness of critical system components.

Read original on Datadog Blog

The Challenge of Distributed System Correctness

Ensuring the correctness of distributed systems is notoriously difficult. As systems grow in complexity, with concurrent operations, network latencies, and partial failures, traditional testing methods often fall short in revealing subtle race conditions or unexpected state transitions. Formal methods, like TLA+, provide a rigorous way to specify desired system behavior, but validating these specifications against actual production systems has been a significant hurdle. Datadog's FETCh system addresses this by bringing formal verification closer to runtime validation.

FETCh: Bridging Formal Specifications and Production

FETCh (Formal Equivalence Test Checker) operates by observing the runtime behavior of a service and comparing it against a TLA+ specification. It's designed to run continuously in production, making it a powerful tool for catching regressions or deviations from the formal model that might arise from code changes, infrastructure updates, or unexpected interactions. This continuous validation is crucial for maintaining the integrity of critical components.

  • Trace Collection: FETCh intercepts requests and responses, along with internal service states, to form a trace of execution.
  • Model Translation: These production traces are translated into an input format consumable by a TLA+ model checker.
  • Specification Checking: The model checker evaluates whether the observed trace conforms to the TLA+ specification. Any deviation signals a potential bug or an unhandled scenario.
💡

Why Formal Methods in Production?

Integrating formal methods like TLA+ into production validation cycles offers a proactive approach to system reliability. Instead of solely relying on reactive monitoring or post-incident analysis, it allows engineers to catch fundamental architectural or logical flaws before they manifest as critical failures. This elevates the level of assurance beyond what unit, integration, or even end-to-end tests can provide, especially for complex state machines or consensus algorithms.

Impact and Architectural Implications

The implementation of FETCh uncovered a subtle bug related to concurrent operations that traditional testing had not exposed. This demonstrates the value of such systems in validating complex invariants in highly concurrent environments. Architecturally, it implies the need for services to expose sufficient internal state and provide robust tracing mechanisms to enable effective validation against formal models. This encourages a design philosophy where systems are built with observability and verifiability as first-class citizens.

formal verificationTLA+production validationdistributed systemssystem correctnessobservabilityreliability engineeringDatadog

Comments

Loading comments...