Design Distributed Tracing With Sampling Across Google Microservices

Last updated: November 29, 2026

Quick Overview

Design a Dapper-style distributed tracing system that records the path and latency of requests across thousands of services, with sampling, low overhead, and a UI to find the slowest spans for a given request type.

Google
System Design
Software Engineer
Google
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

0

0 solved


Design a Dapper-style distributed tracing system that records the path and latency of requests across thousands of services, with sampling, low overhead, and a UI to find the slowest spans for a given request type.

Tracing originated at Google, and this question tests whether a candidate understands context propagation, the overhead budget of always-on instrumentation, and how sampling choices affect the ability to debug rare slow requests. It often appears in onsites for infrastructure and SRE-facing roles.

What the Interviewer Expects
  • Explain trace and span ids and context propagation through RPC metadata
  • Keep instrumentation overhead under ~1% CPU
  • Compare head-based and tail-based sampling and when each fits
  • Design collection, storage and indexing of spans
  • Support queries such as slowest traces for an endpoint in the last hour
Key Topics to Cover
Context propagation
Sampling strategies
Span collection
Trace storage
Overhead control
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you capture traces for rare errors if you sample 1 in 1000?
  • How do you trace through asynchronous queues?
  • How do you handle clock skew between hosts when drawing spans?
  • How would you link traces to metrics and logs?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: each request gets a trace id; each unit of work is a span with parent id, start, duration, service, method, status and annotations; users search traces and view a waterfall.

**Non-fun...

High-Level Design
  • Instrumentation in the RPC library: creates spans automatically, propagates (trace_id, span_id, sampled flag) in RPC metadata, so application code needs almost no changes.
  • **Local span buffe...

Submit Your Answer
Markdown supported