The Simplest Way to Make Lightstep and Nginx Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You pair Lightstep and Nginx to trace web traffic from the edge to your apps. Nginx starts or passes trace headers, and Lightstep reads those spans to show slow paths. This setup lets your team spot bad routes, slow upstream servers, and dropped requests fast. When a user hits a web page, the web server tags the request right away. Downstream services keep that tag so you can see the whole path in one view. How data and keys flow between Lightstep and Nginx Nginx sits at the front of your st

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You pair Lightstep and Nginx to trace web traffic from the edge to your apps. Nginx starts or passes trace headers, and Lightstep reads those spans to show slow paths.

This setup lets your team spot bad routes, slow upstream servers, and dropped requests fast. When a user hits a web page, the web server tags the request right away. Downstream services keep that tag so you can see the whole path in one view.

How data and keys flow between Lightstep and Nginx

Nginx sits at the front of your stack and takes in outside web traffic. A tracing module inside the web server starts a new span for each request. It also reads trace headers that come in from outside clients or load balancers.

The web server then passes that trace context to your backend apps over HTTP headers. At the same time, the tracing module groups finished spans in memory. It sends those batches out to a local collector or straight to the Lightstep ingest point.

To send data, the web server or collector needs a valid project key. You set up this key in your secret store and load it at start time. The ingest service checks the key, accepts the spans, and links them to your project.

Teams must also watch what data goes into span tags and logs. Web requests often hold private values in headers or query strings. Good scrubbing rules rewrite matched fields like emails, phone numbers, card numbers, or national IDs in results.

Common failure modes and how to scope roles

Many teams share one broad ingest key across every web server and test cluster. If that single key leaks, anyone can send fake trace data to your project. A spike in fake spans can hide real errors and burn through your quota.

End-to-End Encryption + NGINX Security Configuration: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, give each cluster or app group its own scoped ingest key. When you rotate a key or shut down a test server, you revoke just that key. Production traffic keeps flowing without any drop in trace data.

Another common bug happens when Nginx drops trace headers before calling upstream apps. If the web server strips unknown headers, the trace breaks into two separate parts. You then see one span for the edge and a broken trace for the backend. Make sure your route rules forward the standard trace headers to every upstream service.

Network blocks also cause silent trace drops in locked-down subnets. If the web server cannot reach the ingest host, spans pile up in memory and drop. Put a local collector inside the same subnet so web nodes only talk to a local port. Only the collector needs an outbound firewall rule to reach the cloud ingest endpoint.

Finally, do not let engineers log in to edge servers with shared root keys to edit rules. Use role-based permissions so each change to tracing rules leaves a clear audit log.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Why do my Nginx spans show up as separate traces in Lightstep?

Your web server is not passing trace context headers to the upstream app. Check your route setup and make sure it forwards trace headers to backend targets.

Should Nginx send spans straight to Lightstep or use a collector?

A local collector is better for most production setups. It keeps outbound keys off your edge nodes and handles retries when the network drops.

How do I keep private user data out of my edge traces?

Avoid recording full query strings or raw auth headers on your web server spans. Set up scrubbing on your collector to rewrite emails, phone numbers, and card numbers in results.

The query runs. The emails stay hidden.