Traces
Tracing gives you end-to-end visibility into the life of a request as it travels through your Workers application and connected services, helping you to identify performance bottlenecks, debug issues, and understand complex request flows. With tracing you can answer questions such as:
- What is the cause of a long-running request?
- How long do subrequests to my Worker take?
- How long are my calls to my KV Namespace or R2 bucket taking?

Cloudflare Workers provides automatic tracing instrumentation out of the box - no code changes or no SDK installation required. Simply enable tracing on your Worker and Cloudflare automatically captures telemetry data for:
- Fetch calls - All outbound HTTP requests, capturing timing, status codes, and request metadata. This enables you to quickly identify which external dependencies are affecting your application's performance.
- Binding calls - Interactions with various Worker bindings such as KV reads and writes, R2 object storage operations and Durable Object invocations
- Handler calls - The complete lifecycle of each Worker invocation, including triggers such as fetch handlers, scheduled handlers, and queue handlers.
While our work for automatic instrumentation is ongoing, we've documented all existing spans and attributes currently instrumented today.
To view traces in the Workers dashboard, set the following in your Wrangler configuration file:
{ "observability": { "traces": { "enabled": true, // optional sampling rate "head_sampling_rate": 0.05 } }}
[observability.traces]enabled = truehead_sampling_rate = 0.05
Or if you have already set observability.enabled = true
in your wrangler configuration file, tracing and logs will be automatically enabled.
Workers tracing follows OpenTelemetry (OTel) standards ↗, making it compatible with popular observability platforms while requiring zero development effort from you. If your observability provider has an available OpenTelemetry endpoint, you can export traces (and logs!)
Learn more about exporting OpenTelemetry data from Workers to your provider of choice here.
With head-based sampling, you can trace a percentage of incoming requests in your Cloudflare Worker to manage volume and costs, while still providing meaningful insights into your application.
The valid sampling range is from 0 to 1, where 0 indicates zero out of one hundred invocations will be traced, and 1 indicates every requests will be traced.
{ "observability": { "traces": { "enabled": true, // set tracing sampling rate to 5% "head_sampling_rate": 0.05 }, "logs": { "enabled": true, // set logging sampling rate to 60% "head_sampling_rate": 0.6 } }}
[observability.traces]enabled = truehead_sampling_rate = 0.05
[observability.logs]enabled = truehead_sampling_rate = 0.6
If you have head_sampling_rate
configured for logs, you can also create a separate rate for traces.
TODO: update this --> If head_sampling_rate
is unspecified, it defaults to tracing 100% of requests.
Workers tracing is currently free during the early beta period. This includes all tracing functionality such as collecting traces, storing them, and viewing them in the Cloudflare dashboard.
Starting on January 15, 2026, tracing will be billed as part of your usage on the Workers Free Paid and Enterprise plans. Each span in a trace represents one observability event, sharing the same monthly quota and pricing as Workers logs:
Events (trace spans or log events) | Retention | |
---|---|---|
Workers Free | 200,000 per day | 3 Days |
Workers Paid | 10 million included per month +$0.60 per additional million events | 7 Days |
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark