@@ -33,6 +33,64 @@ Here's a diagram describing this flow:
33
33
To see if an instrumentation library already exists for your platform, see the
34
34
list of [ existing instrumentations] ({{ site.github.url}}/pages/existing_instrumentations).
35
35
36
+ Example flow
37
+ -----------------------
38
+
39
+ As mentioned in the overview, identifiers are sent in-band and details are sent
40
+ out-of-band to Zipkin. In both cases, trace instrumentation is responsible for
41
+ creating valid traces and rendering them properly. For example, a tracer ensures
42
+ parity between the data it sends in-band (downstream) and out-of-band (async to
43
+ Zipkin).
44
+
45
+ Here's an example sequence of http tracing where user code calls the resource
46
+ /foo. This results in a single span, sent asynchronously to Zipkin after user
47
+ code receives the http response.
48
+
49
+ ```
50
+ ┌─────────────┐ ┌───────────────────────┐ ┌─────────────┐ ┌──────────────────┐
51
+ │ User Code │ │ Trace Instrumentation │ │ Http Client │ │ Zipkin Collector │
52
+ └─────────────┘ └───────────────────────┘ └─────────────┘ └──────────────────┘
53
+ │ │ │ │
54
+ ┌─────────┐
55
+ │ ──┤GET /foo ├─▶ │ ────┐ │ │
56
+ └─────────┘ │ record tags
57
+ │ │ ◀───┘ │ │
58
+ ────┐
59
+ │ │ │ add trace headers │ │
60
+ ◀───┘
61
+ │ │ ────┐ │ │
62
+ │ record timestamp
63
+ │ │ ◀───┘ │ │
64
+ ┌─────────────────┐
65
+ │ │ ──┤GET /foo ├─▶ │ │
66
+ │X-B3-TraceId: aa │ ────┐
67
+ │ │ │X-B3-SpanId: 6b │ │ │ │
68
+ └─────────────────┘ │ invoke
69
+ │ │ │ │ request │
70
+ │
71
+ │ │ │ │ │
72
+ ┌────────┐ ◀───┘
73
+ │ │ ◀─────┤200 OK ├─────── │ │
74
+ ────┐ └────────┘
75
+ │ │ │ record duration │ │
76
+ ┌────────┐ ◀───┘
77
+ │ ◀──┤200 OK ├── │ │ │
78
+ └────────┘ ┌────────────────────────────────┐
79
+ │ │ ──┤ asynchronously report span ├────▶ │
80
+ │ │
81
+ │{ │
82
+ │ "traceId": "ab", │
83
+ │ "id": "6b", │
84
+ │ "name": "get", │
85
+ │ "timestamp": 1483945573944000,│
86
+ │ "duration": 386000, │
87
+ │ "annotations": [ │
88
+ │--snip-- │
89
+ └────────────────────────────────┘
90
+ ```
91
+
92
+ Trace instrumentation report spans asynchronously to prevent delays or failures
93
+ relating to the tracing system from delaying or breaking user code.
36
94
37
95
Transport
38
96
---------
0 commit comments