Repository navigation
Conversation
Spans are going away from streaming tail events: workerd can now export each invocation's spans itself, as OTLP (`tracing.otlp`, from cloudflare/workerd#7686). With `unsafeObservability`, Miniflare makes the observability collector workerd's OTLP collector. Its new `/v1/traces` endpoint decodes the protobuf export with a small reader for the fields workerd sets and stores the spans; the streaming tail now supplies only logs and exceptions, so `tail_worker_user_spans` is no longer enabled. `tracing.otlp` traces every service in the config, including Miniflare's own Workers. The collector keeps only the spans of the services Miniflare passes it (user workers and the Workflows services that run their workflows, with the worker names the tail props used to carry) and drops the rest. An invocation started by one of those dropped spans, such as the entry Worker's, would then point at a parent that is never stored, so the store keeps a span whose parent is missing as a root and parks the parent in `pending_parents`. If the parent arrives later, as a calling user worker's span does after its callee has been exported, the span is attached to it again. The config types are regenerated from the workerd schema that adds `tracing`, so this needs a workerd release that includes it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: f3f9d28 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
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.
Depends on cloudflare/workerd#7686.
Spans are going away from streaming tail events. cloudflare/workerd#7686 lets workerd export each invocation's spans itself, as OTLP, through a new
tracing.otlpconfig setting. This moves Miniflare's local observability (unsafeObservability) onto it:tracing.otlpto the observability collector. Its newPOST /v1/tracesdecodes workerd's protobuf export (a small reader for the fields workerd sets, no new dependency) and stores the spans. They carry precise timestamps instead of the coarse I/O time tail events report.tail_worker_user_spansis no longer enabled. Logs still reference spans correctly: the tail events carry the same span IDs workerd exports.tracing.otlptraces every service in the config, including Miniflare's own Workers (the entry Worker, simulators, queue brokers, …). The collector receives a map from workerd service name to worker name: user workers, plus the Workflows services that run their workflows. It keeps only those services' spans. This map replaces the per-tailpropsthat used to carry the worker name.pending_parentstable. If the parent arrives later, the span is attached to it again. That happens when one user worker calls another, because the callee usually finishes and is exported first. So distributed traces across user workers still join up.The config types in
src/runtime/config/generated/workerd.tsare regenerated from the workerd schema in #7686 (the only difference is the newtracingfield). This can't merge until a workerd release that includes #7686 is published and Miniflare's workerd dependency is bumped: with today's workerd,tracingis ignored and no spans are captured. Until then, CI fails the tests that need captured spans: the four capture tests intest/plugins/core/observability.spec.tsand "captures the selected same-instance Worker in Observability" intest/plugins/local-explorer/scheduled.spec.ts.While
tracing.otlpis set, workerd stops delivering spans to streaming tail workers, so with local observability on (the default) a streaming tail worker configured locally no longer receivesspanOpen/spanClose. That's intended: spans on streaming tail workers are being deprecated in local dev and production alike, and users can't deploy streaming tail workers.A failed span's
errorcolumn is its last exception (workerd records uncaught exceptions on the invocation span), else its status message, else itserror.type, so a span that failed without an exception, such as a 5xx fetch, still counts as an error.unsafeObservabilityis an unsafe, undocumented option, and what the Local Explorer shows is unchanged.Tested against workerd built from #7686 (
MINIFLARE_WORKERD_PATH):test/plugins/core/observability.spec.ts,test/plugins/local-explorer/,test/plugins/workflows/,test/plugins/core/andtest/index.spec.tsall pass. New tests cover parent re-linking in the store and dropping Miniflare's own spans.🤖 Generated with Claude Code