Skip to content

Telemetry

Source: src/Cloudflare/Workers/Telemetry.ts Kind: Layer · Provides: Tracer.Tracer

Mirror Effect spans into Cloudflare Workers Observability.

A binding layer: at deploy time it turns on observability.traces on the host Worker (the same path as Cloudflare.cache()) and registers a per-event Effect Tracer. Cloudflare auto-instruments fetch/KV/R2/D1; Effect.withSpan / Effect.fn frames nest in that waterfall. Cloudflare owns sampling and export — no OTLP URL, flush, or Wrangler block.

Until the global default compatibility date is raised past 2026-07-28, pin compatibility: { date: "2026-08-25" } (or later) or deploy fails. alchemy dev does not gate the date: what a local Worker records is the local runtime’s concern.

Compose it into the Function/Worker’s single Effect.provide:

export default Cloudflare.Worker(
"Worker",
{
main: import.meta.url,
compatibility: { date: "2026-08-25" },
},
Effect.gen(function* () {
return {
fetch: Effect.gen(function* () {
yield* doWork().pipe(Effect.withSpan("operation"));
return HttpServerResponse.text("ok");
}),
};
}).pipe(
Effect.provide(
Layer.mergeAll(
Cloudflare.R2.ReadWriteBucketBinding,
Cloudflare.Telemetry(),
),
),
),
);
Effect.provide(
Layer.mergeAll(
Cloudflare.Telemetry(),
// omit `traces` — Cloudflare.Telemetry provides the Tracer
Axiom.Telemetry({ token: Ingest, logs: Logs, metrics: Metrics }),
),
)

To ship the same waterfall (Effect + platform spans) elsewhere, export it from Cloudflare with Cloudflare.Workers.ObservabilityDestination rather than sending a second Worker-side OTLP trace stream.