Skip to content

Instantly share code, notes, and snippets.

@codefromthecrypt
Last active January 11, 2017 05:02
Show Gist options
  • Save codefromthecrypt/80f198ee56343ba864fe8b2a57d3eff7 to your computer and use it in GitHub Desktop.
Save codefromthecrypt/80f198ee56343ba864fe8b2a57d3eff7 to your computer and use it in GitHub Desktop.
Normal case of Zipkin instrumentation
┌──────────────────────────────┐ ┌──────────────────────────────┐
│ Tracer: Web │ │ Tracer: App │
│ │ │ │
└──────────────────────────────┘ │ └──────────────────────────────┘
────────────────────────────────────┴───────────────────────────────────
┌ ─ ─ ─ ─ ─ ─ ─ ─ ┐ ┌─────────────────────────────┐
(1) │(1) Web tracer starts a trace│
│ sr │ │ since no headers exist │
─────────▶ └─────────────────────────────┘
│ │ ┌───────────────────────────────────┐
Span 1 (server) │ (2) Web tracer starts a new span │
│ │ │ for a client request to App, and │
─ ─ ─ ─ ─ ─ ─ ─ ─┌ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ propagates its IDs │
│ (2) └───────────────────────────────────┘
│ │ cs │ ┌───────────────────────────────────┐
│ ─────────▶ │ (3) App tracer sees headers and │
│ ┌──┤ X-B3-.. │ │ continues the span from Web when │
│ │ │ processing the request │
│ │ │ Span 2 (client) │ └───────────────────────────────────┘
│ │ ─ ─ ─ ─ ─ ─ ─ ─ ─┌ ─ ─ ─ ─ ─ ─ ─ ─ ┐
│ │ (3)
│ │ │ sr │
│ │ ─────────▶
└────┐ │ │ X-B3-.. │
│ │
│ │ ┌──────────────────┤ Span 2 (server) │
│ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─
│ │ │
(6)│ │ ┌─────────────────────────────────────────────┐
│ │ │ │(4-6) After responses are sent and received, │
│(5)│ │ Web and App tracers record latency data and │
│ │ │ │report it to zipkin using IDs they created or│
│ │(4) │ which were propagated via headers. │
│ │ │ └─────────────────────────────────────────────┘
┌───▼─▼─▼────────────────────┐
│ Zipkin │
│ │
└───────┬────────────────────┘
│ ┌─────────────────────────────────────────────────┐
(7) │(7) When Zipkin is queried, it merges this data │
│ │together to show 2 RPC operations │
│ │ │
│ │* the server call to Web │
│ │* the client+server call from Web to App │
│ └─────────────────────────────────────────────────┘
┌ ─ ─ ─ ─ ─ ▼ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ─ ┐
┌─────────┐ ┌─────────┐
│ sr│ │cs sr│ │
────────┤Host: Web├───────┤Host: App│
│ ss│ │cr ss│ │
└─────────┘ └─────────┘
│ Span 1 │ Span 2 │
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment