Tracing polyglot systems
An OpenTracing Tutorial
Yuri Shkuro (Uber), Won Jun Jang (Uber), Prithvi Raj (Uber) Velocity NYC, Oct 1 2018
1
Tracing polyglot systems An OpenTracing Tutorial Yuri Shkuro - - PowerPoint PPT Presentation
Tracing polyglot systems An OpenTracing Tutorial Yuri Shkuro (Uber), Won Jun Jang (Uber), Prithvi Raj (Uber) Velocity NYC, Oct 1 2018 1 Agenda -- http://bit.do/velocity18 9:00 - 9:15 Introductions 9:15 - 9:45 (talk) Introduction to
Yuri Shkuro (Uber), Won Jun Jang (Uber), Prithvi Raj (Uber) Velocity NYC, Oct 1 2018
1
○ How far did you get? ○ Any questions about the OpenTracing API?
2
3
4
Tracing is fun
5
6
7
8
○ utilization ○ saturation ○ throughput ○ errors
9
10
11
Distributed Concurrency
“The Simple [Inefficient] Thing” Basic Concurrency Async Concurrency
Distributed Concurrency
12
13
14
A B C D E
{context} {context} {context} {context} Unique ID → {context} Edge service
A B E C D time TRACE SPANS
demo time: http://bit.do/jaeger-hotrod
15
16
17
18
Application (automatically instrumented) Application Application (manually instrumented) Agent for automatic instrumentation Manually instrumented frameworks Open Source Instrumentation API Tracing library implementation Tracing system / analytics backend
19
Not Your Service
(Spanner, S3, Kinesis, etc.)
Your Tracing System
(Jaeger, Zipkin)
Your Service Not Your Tracing System
(StackDriver, XRay)
Tracing API context Trace-Data Trace Data Shared Libraries Tracer Describing Transactions Correlating Transactions Recording Transactions Analyzing Transactions Federating Transactions Trace Data
http://opentracing.io
20
21
metadata about distributed transactions. Vendor neutral. Data formats agnostic.
including general purpose, transaction-scoped “baggage”.
existing systems, libraries, and frameworks, and/or enable them to include instrumentation built-in.
fields) for describing metadata of common operations, such as http or database calls
22
23
24
OpenTracing API
application logic µ-service frameworks Lambda functions RPC & control-flow frameworks existing instrumentation
tracing infrastructure
main()
I N S T A N A
CNCF Jaeger
microservice process
2.5 years old (https://opentracing.devstats.cncf.io) Tracer implementations: Jaeger, Zipkin, LightStep, SkyWalking, others All sorts of companies use OpenTracing:
25
26
A distributed tracing system
27
28
29
30
Doc http://bit.do/velocity18
31
32
33
34
35
36
Span A Span B Span C Span D Span E Span F Span G Span H
37
A B E C D time F G H
38
A human-readable string which concisely represents the work of the span.
get too general get_account/12345 too specific get_account good, “12345” could be a tag
https://github.com/opentracing/specification/blob/master/semantic_conventions.md
39
40
41
42
43
cfg := &config.Configuration{ Sampler: &config.SamplerConfig{ Type: "const", Param: 1, }, Reporter: &config.ReporterConfig{LogSpans: true}, } tracer, closer, err := cfg.New(serviceName)
44
45
46
47
48
49
50
51
52
53
54
MY SERVICE
inbound request
request
Tracer library Send trace data to tracing backend (background thread) 1
instrumentation
Handler
Headers TraceID Context Span Context Span Headers TraceID instrumentation
Client 2 3
55
56
57
58
Tracer TextMap Carrier Binary Carrier AddHeader(key, value) Write(byte[]) RPC Adapter RPC Request Set(key, value) Write(byte[]) Adapter RPC Request
59
60
61
Client Span
button=buy
Frontend Span
button=buy, exp_id=57
Ad Span
button=buy, exp_id=57
Content Span
button=buy, exp_id=57
Shard A Span
button=buy, exp_id=57
Shard B Span
button=buy, exp_id=57
Cassandra Spans
button=buy, exp_id=57
Cassandra Spans
button=buy, exp_id=57
Cassandra Spans
button=buy, exp_id=57
Cassandra Spans
button=buy, exp_id=57
Cassandra Spans
button=buy, exp_id=57
Problem: how to aggregate disk writes in Cassandra by “button” type (or experiment id, etc, etc)?
See the Pivot Tracing paper http://pivottracing.io/
span.SetBaggageItem("Bender", "Rodriguez")
62
A C D E B
63
64
65
Metrics - Record events as aggregates (e.g. counters) Tracing - Record transaction-scoped events Logging - Record unique events
Low volume High volume
66
Industry advice: don’t log on success (https://vimeo.com/221066726)
Practitioner’s Advice
67
68
69
70
71
72
73
74
Wow, what a great audience!
75
76
http://opentracing.io http://jaegertracing.io
– Registration & Sponsorships now open: kubecon.io
– 11月13-15日 November 13 – 15, 2018 | 中国上海 Shanghai, China
– December 11 – 13, 2018 | Seattle, WA
77
78
79