Skip to content

OpenTelemetry export

Last updated View as MarkdownAgent setup

Workers can export OpenTelemetry-compliant logs and traces to external destinations. First, create a destination and configure your provider.

Supported telemetry

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

Configure export

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 = false

Redeploy your Worker after updating its Wrangler configuration. Events may take several minutes to reach your destination.

Known limitations

Workers infrastructure metrics and custom metrics cannot be exported through OpenTelemetry.

Was this helpful?