OpenResty, My Bestie: Tracing NGINX With Lua
summary
Shopify traces OpenResty proxies with embedded Lua using OpenTelemetry, instrumenting ingress NGINX to extract/inject context and run a per-worker batch span processor inside each worker so spans buffer and export without DOSing the host. Key wins: visibility across proxies for peaks of 75.98 million requests per minute, deferred sampling to let the app decide, moving expensive work to the log phase, and a 92x faster RNG for span IDs; the implementation runs in production and functions at scale.
AI-written summary · about
chapters (15)
- 0:00Introduction and motivation
- 1:47Tracing proxy with OpenTelemetry
- 3:35Choosing OpenTelemetry over Zipkin
- 5:05OpenTelemetry C++ vs OpenResty
- 6:29What is OpenResty
- 7:30Ingress NGINX with OpenResty
- 8:12Naive tracing implementation
- 11:03Productionizing at scale
- 13:12NGINX and OpenResty process models
- 16:26Demo setup and execution
- 18:36Live demo walkthrough
- 21:11Resiliency and performance tweaks
- 23:18Deferred sampling technique
- 25:24Challenges and lessons learned
- 26:06Q&A session
