Workers can export OpenTelemetry-compliant logs and traces to external destinations. First, create a destination and configure your provider.
You can export these Workers telemetry types:
- Traces - Request flows through your Worker and connected services
- Logs - Application and system logs, including
console.log()output
Add your destination names to your Wrangler configuration. Each name must match a destination configured in the dashboard.
{
"observability": {
"traces": {
"enabled": true,
"destinations": ["tracing-destination-name"],
// traces sample rate of 5%
"head_sampling_rate": 0.05,
// optional: export without storing traces in Cloudflare
"persist": false
},
"logs": {
"enabled": true,
"destinations": ["logs-destination-name"],
// logs sample rate of 60%
"head_sampling_rate": 0.6,
// optional: export without storing logs in Cloudflare
"persist": false
}
}
}[observability.traces]
enabled = true
destinations = [ "tracing-destination-name" ]
head_sampling_rate = 0.05
persist = false
[observability.logs]
enabled = true
destinations = [ "logs-destination-name" ]
head_sampling_rate = 0.6
persist = falseWhen persist is enabled, the Cloudflare-stored copy of your logs and traces follows your account's Customer Metadata Boundary setting when one is configured. Exported data is sent to the destination you configure.
Viewing availability for the Cloudflare-stored copy is subject to the Customer Metadata Boundary limitations listed in Data Localization compatibility.
Redeploy your Worker after updating its Wrangler configuration. Events may take several minutes to reach your destination.
Workers infrastructure metrics and custom metrics cannot be exported through OpenTelemetry.