boltZharp Docs
cloud_uploadSDKs

Cloudflare's own export

Cloudflare can send a Worker's traces and logs to any OpenTelemetry endpoint, Zharp's included, with no code. It's quick to turn on, but it leaves out what most people come to Zharp for.

info
We recommend @zharp/cloudflare

Cloudflare's export is in open beta, and it doesn't give you errors as issues, readable stacks or a trace that continues into your API. @zharp/cloudflare does. The two can run together.

1. Add two destinations

In the Cloudflare dashboard, go to Workers & Pages → Observability → Destinations and add one destination for traces and one for logs:

NameTypeOTLP endpoint
zharp-tracesTraceshttps://api.zharp.io/api/v1/otlp/v1/traces
zharp-logsLogshttps://api.zharp.io/api/v1/otlp/v1/logs

On both, add the header Authorization with the value Bearer zpk_…: the key from the app's settings in Zharp. Cloudflare sends a test export when you save, so a mistyped key shows up straight away.

2. Name them in your Wrangler config

// wrangler.jsonc
{
  "observability": {
    "traces": { "enabled": true, "destinations": ["zharp-traces"] },
    "logs": { "enabled": true, "destinations": ["zharp-logs"] }
  }
}
# wrangler.toml
[observability.traces]
enabled = true
destinations = ["zharp-traces"]

[observability.logs]
enabled = true
destinations = ["zharp-logs"]

Then deploy. Each block also takes head_sampling_rate (a share from 0 to 1) and persist: false sends the data to Zharp without also keeping it in Cloudflare.

What it leaves out

  • It's in open beta: span names and attributes may still change.
  • No errors as issues: an exception only shows up as a log line, if it's logged.
  • No readable stacks: stacks point into the minified bundle, and there's no code that ran.
  • No trace across services: Cloudflare doesn't pass trace IDs on to services outside Cloudflare yet, so your browser's trace and your API's don't join the Worker's.
  • Data arrives minutes late, not seconds.
  • No request headers or failed D1 queries with their SQL.

What it does give you is Cloudflare's own spans for every binding — KV, R2, Durable Objects and the rest — without choosing which ones are wrapped. With @zharp/cloudflare running too, you get both, in two traces.