Back to roadmap

intermediate · Module 2.4

Custom Instrumentation (Go / Node.js)

Learning Objectives

  • Create manual spans around OTT business operations (manifest resolve, DRM fetch).
  • Attach useful, low-cardinality-safe attributes and record errors on spans.
  • Decide when to add manual instrumentation on top of auto-instrumentation.

Key Concepts

Manual spans

tracer.Start(ctx, name) opens a span; always defer span.End(). Manual spans capture business operations that auto-instrumentation cannot see, like a DRM license negotiation.

Attributes and errors

Attach descriptive attributes (content_id, cdn.pop, drm.scheme) and call span.RecordError + SetStatus(Error) on failure so traces show where and why a request broke.

Auto + manual

Auto-instrumentation covers HTTP/gRPC boundaries; add manual spans for domain-specific latency you actually care about during a match.

Warning

Span attributes can carry high-cardinality values (session_id) safely, but never copy those same values onto metric labels.

Insight

Name spans by operation, not by data — playback.resolve_manifest, not resolve_manifest_for_user_123.


Knowledge Check

  1. 1. What is the correct lifecycle for a manually created span in Go?

  2. 2. How should you record a failed DRM fetch on its span?

  3. 3. Which span name follows good practice?