Before choosing a tracing platform for Cloudflare Workers, you need to check four things: whether it supports Workers’ specific execution model (including Durable Objects and CPU time limits), how it handles asynchronous I/O and subrequests, its pricing for high-volume edge invocations, and its data retention and sampling controls. These factors determine whether the platform will give you useful, actionable traces or just a noisy, expensive data dump.
Background: Why Tracing Workers Is Different
Cloudflare Workers run on the V8 engine at the edge, not on a traditional server or container. Each invocation has a hard CPU time limit (10 ms on the free plan, 50 ms on paid plans for most requests, with longer limits for some features), and the runtime is designed to suspend and resume execution around I/O operations like fetch() or Cache API calls. This means a trace isn’t a simple timeline of threads; it’s a record of CPU bursts and the asynchronous gaps between them.
Most tracing tools built for Node.js or serverless platforms like AWS Lambda assume a single, continuous execution context. They may not capture the suspension/resumption points correctly, or they may count wall-clock time instead of CPU time, which is misleading for Workers. A platform that understands Workers’ isolate lifecycle and the waitUntil() extension is more likely to give you accurate spans.
How Workers Tracing Works Under the Hood
Cloudflare provides its own observability features—Workers Trace Events and Logpush—which send structured logs and trace events to an external destination. But a dedicated tracing platform typically ingests these events via an HTTP API or a collector, then correlates them into distributed traces. The key is whether the platform can parse the cf-ray ID, the traceparent header, and the worker’s own span context to link requests across subrequests and downstream services.
When you instrument a Worker, you usually add a tracing SDK or a custom wrapper around fetch() calls. The SDK generates a span ID for each outbound request, attaches it to the traceparent header, and sends the span data to the platform. The platform then stitches these spans into a trace. For this to work, the platform must support the W3C Trace Context standard, which Cloudflare Workers uses by default for its own fetch() subrequests.
Key Criteria to Evaluate
When comparing platforms, go beyond the marketing page and check these specific technical points:
- CPU vs. wall-clock timing: Does the platform show CPU time separately from elapsed time? Workers are billed on CPU time, so a trace that shows 100 ms of wall time but only 5 ms of CPU is normal, not a problem. If the platform only shows wall time, it will mislead you.
- Sampling and ingestion rate: Workers can be invoked millions of times per second across the globe. Can the platform handle that volume without dropping traces? Look for built-in sampling (e.g., head-based or tail-based) and rate limits on the free tier.
- Durable Objects support: If you use Durable Objects, you need a platform that can trace across the DO’s storage operations and its own fetch handlers. Not all tracing tools understand DO’s single-threaded concurrency model.
- Subrequest correlation: A single Worker request often fans out to multiple
fetch()calls (to APIs, KV, R2, etc.). The platform must correctly nest these as child spans, not flatten them into separate traces. - Data retention: How long are traces stored? For debugging a production incident that happened 3 days ago, you need at least 7 days of retention. Some platforms only keep 24 hours on lower tiers.
- Integration with Cloudflare’s own tools: Can it ingest from Workers Trace Events directly, or do you need to write a custom exporter? Native integrations reduce setup time and failure points.
Common Pitfalls and Misconceptions
A frequent mistake is assuming that any OpenTelemetry-compatible platform will work out of the box. While Workers can send OTLP (OpenTelemetry Protocol) over HTTP, the runtime’s limitations mean you can’t use the standard Node.js OTel SDK. You need the @cloudflare/workers-otel library or a similar lightweight exporter, and not all platforms have tested that path.
Another misconception is that tracing will show you the full request path. Workers do not have a native way to trace the Cloudflare network itself (e.g., DNS, TLS, or cache lookups). You only see what happens inside your Worker code and the subrequests it makes. If a request is slow because of a cache miss at the CDN layer, your trace won’t show that directly—you’ll see a gap between the start and the first CPU burst.
Also, beware of platforms that charge per span. A Worker that makes 10 subrequests generates 10+ spans per invocation. At high traffic, this can be far more expensive than the Worker itself. Always check the pricing model for span count, not just per-trace.
Comparing Popular Options
There is no single “best” platform; it depends on your existing stack. Here’s a rough comparison of the categories you’ll encounter:
- All-in-one observability suites (e.g., Datadog, New Relic, Grafana Cloud): These offer APM, logs, and metrics in one place. They have mature Cloudflare integrations, but they can be pricey at scale and may require a custom exporter for Workers.
- OpenTelemetry-native backends (e.g., Jaeger, Tempo, SigNoz): These are more flexible and often self-hostable. You control the data, but you must build and maintain the exporter pipeline and handle scaling yourself.
- Cloudflare’s own observability (Workers Trace Events + Logpush): This is the lowest-friction option. It gives you basic traces and logs, but lacks advanced features like distributed tracing across external services or custom span attributes.
- Edge-specific tools (e.g., Baselime, Dash0): These are built for serverless and edge runtimes, so they handle the suspension/resumption model well. However, they are newer and may have smaller communities or fewer integrations.
For a small project, Cloudflare’s built-in tools may be enough. For a large production system with many services, an OTel-native backend gives you the most control and avoids vendor lock-in.
Costs and Data Volume Management
Cost is often the deciding factor. Tracing platforms typically charge per ingested span, per active trace, or per GB of data. Workers can generate a huge volume of spans, especially if you instrument every fetch() call. To keep costs down, you need:
- Head-based sampling: Decide at the start of the request whether to keep the trace (e.g., 1% of traffic). This is simple but can miss rare errors.
- Tail-based sampling: Keep all traces for a short time, then decide which to store based on errors or latency. This is more accurate but requires more compute and storage.
- Attribute filtering: Only send spans that match certain criteria (e.g., HTTP status >= 400). This reduces volume but can miss silent issues.
Also, check if the platform has a free tier that includes a reasonable number of spans per month. Many do, but the limits are often lower than you’d expect for a busy worker.
Security and Data Privacy Considerations
Workers often handle sensitive data (cookies, tokens, personal info). When you send traces to a third-party platform, you’re sending span attributes, which may include URL paths, query parameters, or request headers. Make sure the platform supports:
- Attribute redaction: The ability to strip or hash sensitive fields before sending.
- Data residency: Options to store data in specific regions if you have compliance requirements (GDPR, HIPAA, etc.).
- Encryption in transit and at rest: TLS for ingestion and encryption for stored data.
Read the platform’s data processing agreement carefully. Some platforms use your trace data to improve their own services, which may not be acceptable for your use case.
Alternatives to a Third-Party Platform
If you don’t want to add a dependency, you can build a minimal tracing setup yourself. Use Workers Trace Events to log structured JSON to R2 or a logging service, then query it with a tool like Grafana or even a simple script. This gives you full control over data and cost, but you lose the automatic correlation and UI that a dedicated platform provides.
Another alternative is to use Cloudflare’s own wrangler tail for local debugging. This shows live logs and exceptions, but it’s not persistent and doesn’t give you distributed traces. For production, you’ll still need a way to store and query trace data.
Frequently Asked Questions
Can I use any OpenTelemetry SDK with Cloudflare Workers?
No. The standard Node.js OTel SDK relies on Node APIs that don’t exist in the Workers runtime. You need a Workers-compatible OTel exporter, such as @cloudflare/workers-otel or a custom implementation that uses the fetch() API to send OTLP over HTTP.
How much does tracing cost for a high-traffic Worker?
It depends on the platform’s per-span pricing and your sampling rate. A Worker that makes 5 subrequests and receives 1 million requests per day generates 5 million spans. At $0.50 per 100,000 spans (a typical rate), that’s $25 per day, or $750 per month. Sampling at 10% reduces that to $75 per month.
Does Cloudflare provide native tracing for Workers?
Yes, Cloudflare offers Workers Trace Events and Logpush, which give you basic traces and logs. However, these are not full distributed traces across external services, and you must set up your own storage and querying.
What’s the difference between CPU time and wall time in a Worker trace?
CPU time is the actual compute time your Worker code uses, while wall time is the total elapsed time including I/O waits. Workers are billed on CPU time, so a trace that shows 50 ms wall time but only 5 ms CPU time is normal. A tracing platform should display both separately.
Can I trace Durable Objects with these platforms?
Some platforms support Durable Objects, but not all. You need to check if the platform can handle DO’s single-threaded concurrency and its storage operations. Cloudflare’s own tracing does include DO events, but third-party tools may require manual instrumentation.
Is it safe to send sensitive data in traces?
Only if you configure the platform to redact or omit sensitive attributes. Most platforms allow you to define which fields to scrub, but you must enable it. Never send raw tokens or personal data in span attributes unless you have explicit consent and security measures.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Skip Ryobi and Milwaukee? Harbor Freight Tools to Buy
- Funny Subreddits That Make You Laugh
- Why Retro Gaming Is Still Worth Playing Today
- Neptune Facts That Will Blow Your Mind
- Survival Crafting Game Fatigue: Why & How to Fix It
- Sell Your EV Now Before Prices Plummet?