Distributed tracing is a method to track and observe requests as they flow through different services in a distributed system. It helps identify where delays or errors occur.
Click to reveal answer
beginner
What is a 'trace' in distributed tracing?
A trace represents the entire journey of a request across multiple services. It is made up of multiple spans that record individual operations.
Click to reveal answer
beginner
What is a 'span' in distributed tracing?
A span is a single unit of work or operation within a trace. It records the start time, end time, and metadata about that operation.
Click to reveal answer
intermediate
Why is distributed tracing important in microservices?
Because microservices split functionality across many small services, distributed tracing helps understand how requests move between them and where problems happen.
Click to reveal answer
beginner
Name two popular distributed tracing tools.
Jaeger and Zipkin are two widely used open-source distributed tracing tools.
Click to reveal answer
What does a 'span' represent in distributed tracing?
AA single operation within a trace
BThe entire request journey
CA database query
DA network packet
✗ Incorrect
A span is a single operation or unit of work within a trace.
Which of the following is NOT a benefit of distributed tracing?
AImproving system observability
BTracking request flow in microservices
CIdentifying bottlenecks across services
DAutomatically fixing bugs
✗ Incorrect
Distributed tracing helps observe and diagnose issues but does not automatically fix bugs.
What is a 'trace' composed of?
AMultiple users
BMultiple databases
CMultiple spans
DMultiple servers
✗ Incorrect
A trace is made up of multiple spans representing operations.
Which tool is commonly used for distributed tracing?
ARedis
BJaeger
CMySQL
DDocker
✗ Incorrect
Jaeger is a popular open-source distributed tracing tool.
Distributed tracing is especially useful in which architecture style?
AMicroservices
BMonolithic
CSingle-page applications
DDesktop applications
✗ Incorrect
Distributed tracing helps track requests across many microservices.
Explain how distributed tracing helps in debugging a microservices system.
Think about how requests move through many small services.
You got /4 concepts.
Describe the difference between a trace and a span in distributed tracing.
One is the big picture, the other is a small piece.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of distributed tracing in a system? TraceID and spans are used to:
easy
A. Balance load between servers automatically
B. Store user data securely in a database
C. Track requests as they move through multiple services
D. Encrypt communication between clients and servers
Solution
Step 1: Understand distributed tracing basics
Distributed tracing helps track how a request flows through different parts of a system.
Step 2: Identify the role of TraceID and spans
TraceID links all parts of a request, and spans represent each step or service involved.
Final Answer:
Track requests as they move through multiple services -> Option C
Quick Check:
Distributed tracing = Track requests [OK]
Hint: TraceID connects steps in request flow [OK]
Common Mistakes:
Confusing tracing with data storage
Mixing tracing with load balancing
Thinking tracing encrypts data
2. Which of the following is the correct way to represent a span in distributed tracing data?
easy
A. "traceId:abc123;spanId:xyz789;operation:db_query"
B. { "traceId": "abc123", "spanId": "xyz789", "operation": "db_query" }
C. [ "traceId", "spanId", "operation" ]
D. abc123xyz789
Solution
Step 1: Identify correct data format for spans
Spans are usually represented as structured data like JSON objects with keys and values.
Step 2: Compare options
{ "traceId": "abc123", "spanId": "xyz789", "operation": "db_query" } shows a JSON object with clear keys for traceId, spanId, and operation, which is standard.
What is the correct order of operations for this request?
medium
A. frontend -> backend -> db_query
B. db_query -> backend -> frontend
C. backend -> frontend -> db_query
D. frontend -> db_query -> backend
Solution
Step 1: Analyze parent-child relationships
The span with parentId null is the root: frontend (s1). Backend (s2) is child of frontend, and db_query (s3) is child of backend.
Step 2: Determine operation order
Request flows from frontend to backend to db_query following parent-child links.
Final Answer:
frontend -> backend -> db_query -> Option A
Quick Check:
Parent-child order = frontend to db_query [OK]
Hint: Follow parentId links from root span [OK]
Common Mistakes:
Ignoring parentId null as root
Reversing operation order
Mixing span order in array with execution order
4. You notice that some spans in your distributed tracing system have missing traceId values. What is the most likely cause?
medium
A. The tracing library failed to propagate the traceId across services
B. The database storing traces is full
C. The network is too slow to send trace data
D. The user did not authenticate properly
Solution
Step 1: Understand traceId propagation
TraceId must be passed along all services handling the request to link spans correctly.
Step 2: Identify cause of missing traceId
If traceId is missing, it usually means the tracing library or instrumentation did not forward it properly.
Final Answer:
The tracing library failed to propagate the traceId across services -> Option A
Quick Check:
Missing traceId = propagation failure [OK]
Hint: Missing traceId means propagation error [OK]
Common Mistakes:
Blaming storage or network issues
Confusing authentication with tracing
Assuming traceId is optional
5. You want to design a distributed tracing system for a microservices architecture with hundreds of services. Which approach best ensures scalability and minimal overhead?
hard
A. Store all trace data locally on each service without aggregation
B. Trace every request fully and store all spans in a single centralized database
C. Send trace data synchronously during each request to avoid data loss
D. Use sampling to trace only a subset of requests and store spans in a scalable backend
Solution
Step 1: Consider scalability challenges
Tracing every request fully creates huge data and overhead, which is not scalable for hundreds of services.
Step 2: Evaluate best practices
Sampling reduces data volume by tracing only some requests, and scalable backends handle storage efficiently.
Step 3: Assess other options
Synchronous sending blocks requests, and local storage prevents global analysis.
Final Answer:
Use sampling to trace only a subset of requests and store spans in a scalable backend -> Option D