Boss lesson · Unit 01
Traces
Spans with parents and durations, context passed between services, and one slow request read to the slow hop.
What you practise
- Spans with parents and durations, context passed between services, one slow request read span by span to the hop that is slow
Try a question from this lesson
Pick one
One checkout took 2.4 seconds. It passed through a gateway and four services, and each logged "done". What would let you find the slow one in a single look?
Hint
You need facts about this one request, laid out by who called whom.
Correct answer
Each piece of work recorded with its duration and its caller
Why
Averages describe all requests, not this one. DEBUG lines and CPU graphs make you rebuild the timeline by hand. If every piece of work records how long it took and who called it, the request draws its own map. That record is a trace.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Spans and traces
A span is one unit of work: a name, a start, an end, its own id and the id of its parent span. A trace is every span that shares one trace id.
The root span has no parent: it is the whole request. Each call it makes becomes a child span, and so on down.
trace 7f3a
span name parent ms
a1 GET /checkout - 2400
b2 auth.check a1 40
c3 cart.load a1 110
d4 payment.charge a1 2200
e5 bank.http d4 2150Concept
Context travels with the call
Each service only sees its own work. To join the spans, the caller sends two ids with every outgoing call: the trace id and its own span id. The receiver starts its span with that span id as parent. This is context propagation.
Over HTTP the ids ride in one header, traceparent, a W3C standard.
traceparent:
00-<trace id>-<parent span id>-01
00 version
trace id 32 hex digits
parent id 16 hex digits
01 flags: this one is sampled10 more exercises in the app
- 3× type the answer
- 4× multiple choice
- 1× order the lines
- 1× true or false
- 1× fill the blanks
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.