Module Review: Custom Instrumentation

This module explores the core principles of Custom Instrumentation, deriving solutions from first principles to build world-class, production-ready expertise.

1. Key Takeaways

  • Auto-instrumentation handles HTTP/DB timing, but manual instrumentation is needed for business logic.
  • Use @WithSpan to easily wrap methods and @SpanAttribute for arguments.
  • Span Events act as timestamped annotations for checkpoints within a single span.
  • Baggage propagates data across network boundaries (via headers), unlike span attributes which stay local.
  • Record exceptions on spans explicitly so stack traces appear in your backend.

2. Flashcards

Click to reveal: What is the difference between Attributes and Baggage?

3. Cheat Sheet

Feature Use Case Scope
Attributes Key/value pairs (e.g., user.id) Local to a single Span
Events Timestamped logs within a span Local to a single Span
Baggage Key/value pairs passed downstack Propagated across services
Status OK or ERROR Local to a single Span

4. Quick Revision

  • Always prefer semantic conventions (e.g., http.request.method) over custom names.
  • Span names should be low cardinality; do not put variable data like IDs in the span name.

5. Next Steps