Scaling Distributed Tracing on Android With a Kotlin IR Compiler Plugin
summary
Builds a Kotlin IR compiler plugin that rewrites function bodies at compile time to wrap methods in structured trace spans and automatically handle lifecycle, sampling and exporters to Sentry, Perfetto, Firebase Performance or internal warehouses. Instrumentation requires one annotation on a method or class; suspend functions work without extra handling. The implementation is compact—four files and ~300 lines—adds a small build-time cost, runs in production across golden flows, and cuts root-cause time from days to hours by surfacing the exact slow span.
AI-written summary · about
chapters (8)
- 0:00Distributed tracing on Android
- 7:24Cost of manual span instrumentation
- 10:56Auto-instrumenting Kotlin with compiler plugins
- 16:18How compiler rewrites code
- 20:54Testing and deploying tracing plugin
- 25:53Performance impact and production use
- 30:06Other compiler plugin use cases
- 33:13Q&A
related talks
36mWriting a Kotlin Compiler Plugin
34mAdventures building a Kotlin Multiplatform Benchmarking Library
43mPerformance in a Kotlin World
38mKSP and Plugins. Optimizing Kotlin Multiplatform common code
37mBuilding a Kotlin Compiler Plugin for Compose Insights
45mPerformance in a Kotlin world
36mMeta-programming with Kotlin compiler plugins
36mKotlin Native Compiler Under the Hood
