Design: Correlation ID Tracking in Microservices
Design the mechanism to generate, propagate, and log correlation IDs across microservices. Out of scope: detailed implementation of each microservice business logic.
Functional Requirements
FR1: Assign a unique correlation ID to each client request entering the system
FR2: Propagate the correlation ID through all microservices involved in processing the request
FR3: Log the correlation ID with all service logs related to the request
FR4: Allow tracing and debugging of requests across multiple services using the correlation ID
FR5: Support asynchronous communication patterns (e.g., message queues) with correlation ID propagation
FR6: Ensure minimal performance overhead when generating and passing correlation IDs
Non-Functional Requirements
NFR1: System must handle 10,000 concurrent requests with correlation tracking
NFR2: Correlation ID propagation latency should not add more than 5ms per service hop
NFR3: Logging with correlation IDs must not degrade overall system availability below 99.9%
NFR4: Correlation IDs must be globally unique and collision-resistant
NFR5: Support both synchronous HTTP calls and asynchronous messaging