Keep your sanity with compositional tracing
summary
Shows how to get MDC and distributed tracing to survive Scala async by actually wrapping the ExecutionContext and lifting thread‑local get/set into IO with a bracket-based set, plus an important shift before async trick so context isn’t lost. Compares manual parameter passing vs thread‑local magic (Kamon/Zipkin/Jaeger/Honeycomb), demonstrates converting spans to headers and logging trace/span IDs, recommends ReaderT/Context approach with cats‑effect integrations, and admits the approach mostly works but is fragile and requires careful instrumentation.
AI-written summary · about
chapters (8)
- 0:00Start
- 5:34Async Programming on the Jvm
- 8:54Run with Context
- 13:02Lazy Evaluation
- 15:05Set Context
- 20:27Shift before the Async
- 26:32Distributed Tracing
- 45:21We Also Need some Sort of Escape Hatches so that the Code That Was Not Built with that in Mind for Example some General Libraries or Akka or Whatever You Still Want To See the Transaction or the Trace and Span Ids in the Logs so You Need a Way To Get from the Context That's Functional to that Do Pure World and Set for Example that Thread-Local the Killing Block of Code That's Not Really Hard To Implement and I Would Argue that It's Much Easier To Do than All the Magic That We Did To Get a Old Work with that but I'M Dc-Dc Was I Wouldn't Say and Ec Is Better for Context Propagation but It's Still Useful
related talks
54mA TRACE TO REMEMBER: COMPOSITIONAL TRACING
49mDistributed Tracing: How the Pros Debug Concurrent and Distributed Systems
26mThe Trouble with Tracers
15mTRACING AKKA STREAMS
57mDistributed Tracing: How the Pros Debug Concurrent and Distributed Systems
46mHow to Properly Blame Things for Causing Latency
31mDistributed Application Tracing with Trace4Cats
37mObservability, Distributed Tracing & the Complex World
