Trace Cloudflare Workers with no SDK

Workers Observability can export a Worker's traces and logs over OTLP. Create two destinations in the Cloudflare dashboard, name them in your Wrangler config, and every invocation reaches Maple. The runtime records the spans, so no code changes.

fetch 4 spans · 58ms
DurationStatus
fetchedge-router
58.0msOk
kv_get
4.0msOk
fetch
37.0msOk
r2_put
9.0msOk

Example: a Worker invocation with KV, fetch and R2 spans

Quick start

Set up Cloudflare Workers

1

Create a traces destination and a logs destination

text
# Cloudflare dashboard: Workers & Pages > Observability > Destinations
Destination name: maple-traces
Destination type: Traces
OTLP endpoint:    https://ingest.maple.dev/v1/traces
Custom headers:   Authorization: Bearer YOUR_INGEST_KEY

Destination name: maple-logs
Destination type: Logs
OTLP endpoint:    https://ingest.maple.dev/v1/logs
Custom headers:   Authorization: Bearer YOUR_INGEST_KEY
2

Name them in the Worker's Wrangler config

jsonc
// wrangler.jsonc
{
	"observability": {
		"traces": {
			"enabled": true,
			"destinations": ["maple-traces"],
		},
		"logs": {
			"enabled": true,
			"destinations": ["maple-logs"],
		},
	},
}
3

Deploy

bash
wrangler deploy

This is the short path. The full Cloudflare Workers guide covers the rest.

Organization in the EU region? Send to https://ingest.eu.maple.dev instead of https://ingest.maple.dev. An ingest key only works in its own region.

What you get

What a Worker sends to Maple

Handler spans

One root span per fetch, scheduled or queue invocation, named after the Worker script.

Outbound fetch

Each subrequest is a child span with its timing and status code.

Bindings

KV and R2 operations and Durable Object calls, RPC included, nest under the handler span.

console output

console.log, console.error and the invocation log for each request arrive as logs from the same invocation.

Cloudflare Worker panel

Maple reads the Cloudflare attributes on a span and shows the script, version, CPU and wall time, edge location and Ray ID.

Metrics from the API

Destinations export no metrics. Connect the Cloudflare integration for request counts, error rates and CPU time.

What is different on Workers

Workers Paid only

OTLP export is not available on Workers Free, and Cloudflare bills exported events past its allowance. head_sampling_rate: 0.1 records one invocation in ten.

Traces stop at the Worker

Cloudflare does not yet propagate trace context to services outside Cloudflare. A backend the Worker calls starts its own trace.

0 ms spans are expected

The runtime only advances the clock on I/O. CPU work between two I/O calls reports no duration.

インテグレーション

その他のインテグレーション

今日、最初のトレースを。

SDKを追加し、OTLPエクスポーターをMapleに向ければトレースが届きます。

maple.dev:OpenTelemetryの上のオブザーバビリティ