docs(cloudflare): document Worker observability.traces support#1439
Open
sam-goodwin wants to merge 2 commits into
Open
docs(cloudflare): document Worker observability.traces support#1439sam-goodwin wants to merge 2 commits into
sam-goodwin wants to merge 2 commits into
Conversation
Adds a dedicated Observability section to the Worker docs covering the logs/traces sub-configuration, including a Custom Spans example, and completes the WorkerMetadata logs type with the persist/destinations fields the runtime already sends. Closes #1438 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1438
Background
Issue #1438 requested first-class support for
observability.tracesonCloudflare.Worker. On investigation, the functional support already exists end-to-end:WorkerObservability.tracestype (enabled,headSamplingRate,persist,destinations) is defined inworker.ts.camelToSnakeObjectDeepinworker-metadata.ts.worker.observability, with a passing live test inworker.test.tsasserting both the API metadata and the output shape.The real gap the issue describes — "explicit documentation/examples appears to be missing/partial" — was documentation, plus a small type incompleteness.
Changes
worker-metadata.ts: addedpersistanddestinationsto theobservability.logsmetadata type. The runtime already forwarded these (and the existing test asserts them), but the type omitted them.worker.mdx: added a dedicated Observability section documenting the fullenabled/logs/tracesconfiguration, plus a Traces subsection with a Custom Spans (trace.enterSpan()) example and production-vs-dev sampling guidance. Also surfacedtracesin the quick-config snippet.Usage
And custom spans from within the Worker:
🤖 Generated with Claude Code