The Simplest Way to Make Azure Functions and Lightstep Work Like They Should
Pairing azure functions and lightstep lets teams track serverless runs with end-to-end trace data. Azure Functions runs event-driven code, while Lightstep collects spans to show latency and errors. Serverless apps start and stop fast based on incoming events. When a slow request happens, standard logs often miss the root cause. Sending trace spans from each function run gives your team a clear map. You can see every downstream call, database query, and external API request in one view. How da
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.
Pairing azure functions and lightstep lets teams track serverless runs with end-to-end trace data. Azure Functions runs event-driven code, while Lightstep collects spans to show latency and errors.
Serverless apps start and stop fast based on incoming events. When a slow request happens, standard logs often miss the root cause. Sending trace spans from each function run gives your team a clear map. You can see every downstream call, database query, and external API request in one view.
How data and keys flow between azure functions and lightstep
To link the two tools, your function code uses an OpenTelemetry SDK. During each run, the SDK builds spans that record start times, durations, and tags. Before the function stops, the SDK exports those spans over the network to Lightstep.
Lightstep checks a project key on every incoming request before accepting trace data. Teams store this key inside an Azure key store rather than in source code. The function app uses a managed identity to read the secret at startup. This setup keeps static keys out of your code repos and build logs.
Context passing is also vital for serverless trace flows. When an upstream service triggers a function, it sends trace headers in the request. The function reads those headers and attaches new child spans to the same trace. If you use queues or event buses, your code must pass trace headers inside message metadata.
Common failure modes and how to scope access
Dropped spans are the most common failure mode in serverless tracing. An Azure Function often freezes or shuts down right after it returns a response. If the telemetry SDK buffers spans in memory, the host may stop before flushing them. Teams fix this by calling an explicit flush method before the function exits.
Shared API keys across dev, staging, and prod apps create another big risk. If one test app leaks a shared key, someone can flood production with fake traces. Give each stage its own Lightstep project or scoped ingest token. Assign narrow read roles so each function app only reads its own secret.
Azure RBAC + Cloud Functions IAM: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Trace payloads can also leak private data when developers log full request bodies. Span tags might capture emails, phone numbers, card numbers, or national IDs by mistake. Teams should add data scrubbing rules in the telemetry pipeline before spans leave the host. Good scrubbing rewrites matched fields in results so raw secrets do not reach trace storage.
Best practices for cold starts and sampling
Heavy telemetry libraries can slow down cold starts in serverless apps. Keep your SDK imports small and only load the auto-instrumentation packages your code needs. If your function only calls an HTTP API and a database, skip unused plugins.
High-volume functions can also generate huge trace bills and network overhead. Set up head or tail sampling rules to control how many spans you send. Always sample error runs and slow runs, while sending a smaller slice of normal traffic. Review your ingest keys and rotate them on a set schedule to keep access tight.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Why are spans missing from my Azure Functions traces?
The serverless host often freezes the process right after the function finishes its main task. Call the SDK flush method at the end of each run so spans send out.
Where should I store the Lightstep ingest key in Azure?
Store the ingest key in Azure Key Vault and grant your function a managed identity. Reference that secret in your app settings so the key stays out of source control.
How do I stop sensitive user data from appearing in trace spans?
Avoid attaching full request bodies to span attributes in your function code. Add redaction rules in your telemetry processor to rewrite emails, phone numbers, and card numbers.
Related guides
In this post