28
Distributed Tracing in Practice Priit Potter

Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Distributed Tracing in Practice

Priit Potter

Page 2: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

What is Plumbr?

• Real User Monitoring + Application Performance Monitoring

• Tracks all user interactions in the front-end

• Detects bottlenecks and errors in the back-end and maps to real user experience

Page 3: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially those built using a microservices architecture.Source: Opentracing manual

Page 4: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 5: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 6: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

From: John The CustomerTo: [email protected]: Cannot complete checkout

I just tried to complete my order #32828, but was unable to finish the checkout process. Your app stalled for 20 seconds and then gave me an error.

Page 7: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 8: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

The 4 rules of distributed tracing

• Every request gets a unique ID

• The ID is passed along to all microservices handling the request

• Every microservice registers the duration and outcome

• Monitoring data is sent to a central server

Page 9: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 10: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 11: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Example #1: response to our supportticket

Page 12: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 13: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Lesson #1: a distributed application callsfor distributed tracing :)

Page 14: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Example #2: smarter response to oursupport ticket

Page 15: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 16: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 17: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 18: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Lesson #2: for faster impact analysis, adderror/bottleneck information to traces

Page 19: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Example #3: the smartest response to oursupport ticket

Page 20: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 21: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 22: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 23: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Lesson #3: for most efficient impactanalysis, include frontend traces too

Page 24: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially
Page 25: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Zipkin PHP example$tracing = create_tracing('php-frontend', '127.0.0.1');$tracer = $tracing->getTracer();$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();

/* Extract the context from HTTP headers */$carrier = array_map(function ($header) {

return $header[0];}, $request->headers->all());$extractor = $tracing->getPropagation()->getExtractor(new Map());$extractedContext = $extractor($carrier);

/* Create a span and set its attributes */$span = $tracer->newChild($extractedContext);$span->start(Timestamp\now());$span->setName('parse_request');$span->setKind(Zipkin\Kind\SERVER);

Page 26: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

Zipkin PHP example

Page 27: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially

-javaagent:path-to/plumbr.jar

<script src="https://browser.plumbr.io/pa.js" crossorigin="anonymous"data-plumbr='{"accountId":"k8g0ta8m6e7gsb2afhq6qm5efh","appName":"REPLACE_WITH_YOUR_APPLICATION_NAME", "serverUrl":"https://bdr.plumbr.io"

}'></script>

Page 28: Distributed Tracing in Practice - GOTO Conference · Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially