ObservabilityDestination
Source:
src/Cloudflare/Workers/ObservabilityDestination.ts
A Workers observability destination — an account-level OTLP export of Workers Logs telemetry (traces, logs, or metrics) pushed to an external HTTPS collector via Logpush.
A destination is identified by its Cloudflare-derived slug (stable,
computed from the name at creation). The endpoint URL, headers, and
enabled flag are mutable in place; name and logpushDataset force a
replacement.
Cloudflare preflights the endpoint with a POST on create (skippable
via skipPreflightCheck) and on every in-place update (not skippable),
so the collector must answer 2xx for updates to converge.
Safety: destinations carry no ownership markers and Cloudflare enforces
one destination per name. When there is no prior state, read scans the
account for a destination with the same name and reports it as
Unowned, so the engine refuses to take it over unless --adopt (or
adopt(true)) is set.
Exporting Workers traces
Section titled “Exporting Workers traces”const traces = yield* Cloudflare.ObservabilityDestination("Traces", { url: "https://otel.example.com/v1/traces", headers: { authorization: secret }, logpushDataset: "opentelemetry-traces",});Exporting Workers logs
Section titled “Exporting Workers logs”const logs = yield* Cloudflare.ObservabilityDestination("Logs", { name: "my-app-logs", url: "https://collector.example.com/v1/logs", logpushDataset: "opentelemetry-logs", skipPreflightCheck: true,});Pausing an export
Section titled “Pausing an export”yield* Cloudflare.ObservabilityDestination("Logs", { name: "my-app-logs", url: "https://collector.example.com/v1/logs", logpushDataset: "opentelemetry-logs", enabled: false,});