Exercise 3 – tracing functions and passing context

When looking at the trace generated by the version of the Hello application from the second exercise, we noticed that the log entry we added to the span happens very close to the end of the span. We hypothesized that this is because most of the time is spent querying the database, but this is why we are doing distributed tracing in the first place: not to guess, but to measure! We already have the main chunks of the logic, the database access and formatting of the greeting, separated into functions, so let's give each of them a span and get a more meaningful trace.

In this exercise we will:

  • Trace individual functions
  • Combine multiple spans into a single trace
  • Learn to propagate the context in-process ...

Get Mastering Distributed Tracing now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.