Automating Observability With Roslyn Source Generators
summary
Automates instrumentation by generating decorator classes that start OpenTelemetry activities for every public interface, using Roslyn incremental source generators plus an Otel collector and Jaeger; the generator emits decorator code, an extension that replaces registrations at startup, and produces full traces showing every method call so debugging is easier — it works but only for interfaces and is additive. Switching to interceptors in .NET 8 removes the interface requirement but is a preview feature with limits. OpenTelemetry + Roslyn is viable at scale.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:17Observability challenge
- 6:36Demo: OpenTelemetry basics
- 12:44Manual vs automatic limits
- 18:56Automating with Roslyn
- 21:05Building the generator
- 31:01Decorators integration
- 35:03Generator limits and future
- 36:32Introducing .NET 8 interceptors
- 42:43Conclusion
related talks
54mExploring Source Generators
01h 02mRoslyn Source Generators Never send a human to do a machine's job
52mCode that writes code - .NET Source generators
01h 00mAutomate Yourself Out of a Job with Roslyn
55mCode that writes code - .NET Source generators
01h 12mC# Source Generators in Action
01h 15mLet’s Build an Incremental Source Generator With Roslyn
59mC# Source Generators - Write code that writes code
