The Simplest Way to Make Lightstep and Spanner Work Like They Should
Teams use lightstep and spanner together to track slow queries across global databases. Your app sends trace data to the collector while running transactions on the database. This workflow helps engineers spot bottlenecks in distributed reads and writes right away. You can see which service call triggered a heavy database lock or transaction retry. Setting up both tools well keeps your data safe and your system fast. How data and permissions flow in lightstep and spanner Your app sits at the
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.
Teams use lightstep and spanner together to track slow queries across global databases. Your app sends trace data to the collector while running transactions on the database.
This workflow helps engineers spot bottlenecks in distributed reads and writes right away. You can see which service call triggered a heavy database lock or transaction retry. Setting up both tools well keeps your data safe and your system fast.
How data and permissions flow in lightstep and spanner
Your app sits at the center of this setup and talks to both tools. First, the app uses a cloud identity role to log in to the database. Once inside, the app runs queries and reads rows from your tables. At the same time, the tracing library records how long each database call takes.
Next, the tracing client sends those timing spans out to the collector endpoint. It uses a dedicated project key to prove it has the right to send metrics. The database never talks straight to the tracing backend on its own. Instead, your app code bridges the two systems by wrapping each query with trace metadata.
Good role design keeps these two data paths separate and safe at all times. Your cloud service account should only hold the exact database permissions the app needs. Likewise, your ingestion key should only allow sending trace spans, not reading account settings. When you split these roles, a leaked metric key will not expose your core data.
Common failure modes and how to scope roles
Many teams make the mistake of sharing one broad service account across all apps. When every app uses the same database role, your audit logs lose their value. You can no longer tell which team or service ran a bad query. Shared metric keys cause similar confusion when bad trace data floods your dashboard.
Another big risk comes from putting raw query parameters into your trace tags. If an engineer logs full query strings, sensitive fields might travel to the tracing tool. You must strip emails, phone numbers, card numbers, and national IDs from trace spans. Masking rewrites matched fields in results before they leave your internal network.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged manual queries also create blind spots during live incident calls. Engineers often log in with high permissions to fix a broken table by hand. These manual sessions bypass your app tracing and leave weak trails in cloud logs. To fix this, give each service and user a small, scoped role.
Securing live database checks during trace alerts
When a trace alert fires, on-call engineers need to check the database right away. They look at slow spans and then inspect the live tables to find the cause. If they use static admin keys for this check, they create a huge risk. Static keys sit on laptops and never expire on their own.
A better plan pairs your trace alerts with tight, role-based database permissions. Engineers should log in with their own work identity when checking a slow query. You should also limit their queries to read-only commands during initial checks. Write commands should require a quick peer review before they run on production tables.
Network rules also play a key part in keeping both tools safe. Keep your database on a private network path that blocks public internet traffic. Only allow outbound traffic to the tracing collector over secure, encrypted ports. This setup keeps your data tight while giving teams clear visibility into query speed.
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
Does Spanner send trace data straight to Lightstep?
No, the database does not send spans to the tracing tool on its own. Your app code collects the timing data using a tracing library during each query. The app then sends those spans out to the collector over the network.
How do we stop sensitive data from leaking into trace spans?
Configure your tracing library to scrub query text before it sends data out. Never attach raw user inputs as span tags in your app code. Make sure masking rewrites matched fields in results for emails, phone numbers, and card numbers.
How should we scope roles for services using both tools?
Give each microservice its own cloud identity with minimal read or write permissions. Use a separate, restricted key just for sending telemetry data to your collector. Rotate your telemetry keys often and monitor your cloud logs for odd query patterns.
Related guides
In this post