Skip to content

[miniflare] Local dev observability (1/6): opt-in switch + core wiring#14634

Closed
nickpatt wants to merge 1 commit into
cloudflare:mainfrom
nickpatt:wobs-1-enablement
Closed

[miniflare] Local dev observability (1/6): opt-in switch + core wiring#14634
nickpatt wants to merge 1 commit into
cloudflare:mainfrom
nickpatt:wobs-1-enablement

Conversation

@nickpatt

@nickpatt nickpatt commented Jul 9, 2026

Copy link
Copy Markdown

First in a series of small, sequential PRs adding experimental local-dev observability to Miniflare. This one wires the plumbing; capture, storage, the read API, and the UI land in follow-up PRs (each opened once the previous merges).

This PR

Adds the X_LOCAL_OBSERVABILITY opt-in — read by both wrangler dev and the Vite plugin, so there's no separate CLI flag or plugin option — which turns on a single unsafeObservability Miniflare option. When set, Miniflare core attaches an internal trace collector as a streaming-tail consumer of each user Worker and adds the compatibility flags workerd needs to emit that tail, wired once in core so the dev tools don't duplicate it. Defaults to off while experimental.

The collector is a placeholder here (no-op tailStream); folding the tail into spans/logs and persisting them land in the following PRs.

The series (for context)

  1. opt-in switch + core wiring (placeholder collector)this PR
  2. internal SQLite trace store + SQL read API
  3. capture traces into the SQLite store
  4. attribute captured traces to their worker
  5. expose the SQL query API over the Local Explorer HTTP API
  6. Local Explorer UI (traces list + trace detail) — flips the default on by default

Replaces the earlier monolithic exploration in #14391.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: experimental feature gated behind X_LOCAL_OBSERVABILITY (off by default); user-facing docs will follow when it stabilises.

…lder collector)

Experimental. Add the X_LOCAL_OBSERVABILITY env var (read by both wrangler and
the Vite plugin — there is no CLI flag or plugin option), which is translated
into a single `unsafeObservability` Miniflare option. When set, Miniflare core
attaches an internal trace collector as a streaming-tail consumer of each user
worker and adds the compat flags workerd needs to emit that tail — done once in
core so the dev tools don't duplicate the wiring. It defaults to off while
experimental.

The collector is a placeholder for now (no-op tailStream); capturing spans/logs
and persisting them to an internal store land in follow-up PRs.
@nickpatt nickpatt marked this pull request as ready for review July 9, 2026 18:30
@nickpatt nickpatt requested a review from workers-devprod as a code owner July 9, 2026 18:30
@workers-devprod workers-devprod requested review from a team and emily-shen and removed request for a team July 9, 2026 18:30
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/wobs-1-enablement.md: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/core/index.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/core/observability.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/observability/collector.worker.ts: [@cloudflare/wrangler]
  • packages/miniflare/test/plugins/core/observability.spec.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/src/miniflare-options.ts: [@cloudflare/wrangler]
  • packages/workers-utils/src/environment-variables/factory.ts: [@cloudflare/wrangler]
  • packages/workers-utils/src/environment-variables/misc-variables.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/dev/miniflare/index.ts: [@cloudflare/wrangler]
  • turbo.json: [@cloudflare/wrangler]

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@nickpatt

Copy link
Copy Markdown
Author

Closing — consolidating into a single PR (#14633) with the six section commits reviewed commit-by-commit, rather than sequential PRs.

@nickpatt nickpatt closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants