architecture17 min read

Tracing Discord's Elixir Systems (Without Melting Everything)

3 similar posts
  • OpenTelemetry
  • Discord

AI Summary

Discord shares how they integrated distributed tracing into their Elixir-based microservices architecture without causing downtime or performance degradation. Because Elixir uses native message passing between lightweight processes instead of standard HTTP headers for internal communication, Discord built a custom internal library called Transport to propagate OpenTelemetry trace context. They discuss overcoming performance bottlenecks caused by context parsing overhead on high-throughput guilds, optimizing sampling strategies, and utilizing profiling tools to diagnose production issues.

Key Takeaways

  • Elixir communicates via lightweight processes passing messages rather than traditional HTTP headers, requiring a custom propagation layer for trace contexts.
  • Discord created an internal message-passing library named Transport to wrap messages in Envelopes, normalizing and managing trace context cleanly.
  • Initial rollouts caused high CPU overhead on busy guilds due to unpacking trace contexts for un-sampled messages, leading to optimizations that only transmit context when actually sampled.

Why it matters

Distributed tracing is critical for understanding latency and system bottlenecks in complex microservices. This article provides rare, practical engineering insights into implementing OpenTelemetry across an Erlang/Elixir actor-model stack, handling high-throughput message passing, and solving CPU overhead challenges during large-scale rollouts.

Conversation0

What would you add from your experience?

Checking your session…

Every good conversation starts with one perspective.