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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.