Skip to content

local explorer: add telemetry#13392

Merged
jamesopstad merged 8 commits intomainfrom
emily/le-telemetry
Apr 13, 2026
Merged

local explorer: add telemetry#13392
jamesopstad merged 8 commits intomainfrom
emily/le-telemetry

Conversation

@emily-shen
Copy link
Copy Markdown
Contributor

@emily-shen emily-shen commented Apr 10, 2026

I would recommend reviewing the first commit separately to the rest - there I’ve extracted telemetry/metrics helpers from wrangler into workers-utils. edit: un-moved this to workers-utils.

We then pass these options into miniflare via a new ‘telemetry’ option. We can’t just directly get the telemetry settings in miniflare, because users can set telemetry config in their wrangler config.
Telemetry settings are then passed to the explorer worker via a JSON binding.

We collect telemetry in the API, rather than in the UI, because we want to detect API-only usage as well.

This is done by adding a middleware component that sends an event after all API requests. The telemetry event schema can be seen in the changes description.

Telemetry is only collected when accessed via wrangler dev, not via the vite plugin or standalone miniflare.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows: will add tests in a followup. have tested manually and events are showing up in amplitude
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: general explorer docs being added separately. telemetry docs updated here.

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: 3b31d42

The changes in this PR will be included in the next version bump.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Changeset Review

Reviewed Changeset: local-explorer-telemetry.md

✅ All changesets look good

Validation Summary

Check Status Notes
Version Type Correctly marked as minor - telemetry/analytics changes should be minor per guidelines
Changelog Quality Meaningful description with clear explanation of what's collected, how to disable it, and event schema
Markdown Headers No h1/h2/h3 headers found; uses bold text for emphasis which is correct
Analytics Minor bump is appropriate for telemetry collection changes
Dependabot N/A Not a dependency update changeset
Experimental Features Explicitly notes that Local Explorer and local REST API are experimental

Notes

  • Good inclusion of the event schema for transparency
  • Clear instructions on how to disable telemetry (wrangler telemetry disable)
  • Appropriately scoped to only when dev session is started via Wrangler

ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 10, 2026

I'm Bonk, and I've done a quick review of your PR.

This PR adds anonymous telemetry to the Local Explorer, sending usage events to Sparrow for successful API requests. The implementation is clean — route name mapping, fire-and-forget event dispatch, and piggybacking off wrangler's existing metrics.json config.

I posted one actionable issue:

  1. WRANGLER_SEND_METRICS env var not respectedgetLocalExplorerTelemetryConfig() in packages/miniflare/src/shared/telemetry-config.ts only reads permission from metrics.json, but wrangler's own telemetry system checks WRANGLER_SEND_METRICS env var with highest priority. Users who rely on this env var (common in CI) to disable telemetry would still have local explorer telemetry active. I posted a suggestion with a fix.

github run

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13392

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13392

miniflare

npm i https://pkg.pr.new/miniflare@13392

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13392

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13392

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13392

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13392

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13392

wrangler

npm i https://pkg.pr.new/wrangler@13392

commit: 3b31d42

@emily-shen emily-shen force-pushed the emily/le-telemetry branch 2 times, most recently from 277b092 to 9810c0f Compare April 13, 2026 07:30
@emily-shen emily-shen marked this pull request as ready for review April 13, 2026 07:31
@workers-devprod workers-devprod requested review from a team and vicb and removed request for a team April 13, 2026 07:31
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 13, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Looking good - a few things that are maybe not quite blocking but I thought I would be defensive and not officially approve yet.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Sweet and simple. Need to update that changeset though

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Apr 13, 2026
@jamesopstad jamesopstad merged commit 2589395 into main Apr 13, 2026
49 checks passed
@jamesopstad jamesopstad deleted the emily/le-telemetry branch April 13, 2026 11:30
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Apr 13, 2026
NuroDev pushed a commit that referenced this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants