Skip to content

feat(wrangler): report startup profile summary - #14893

Open
apeacock1991 wants to merge 1 commit into
mainfrom
feat/startup-profile-summary
Open

feat(wrangler): report startup profile summary#14893
apeacock1991 wants to merge 1 commit into
mainfrom
feat/startup-profile-summary

Conversation

@apeacock1991

@apeacock1991 apeacock1991 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Show key performance metrics in the output of wrangler check startup, notably:

  • Bundle size
  • Startup profile (with breakdown)

The latter can be extracted from the flamegraph, but it seems nice to just show them directly in the output vs have to fish. Adding bundle size as it's another key start up metric that can greatly affect start up speed.

I will raise a docs PR for this if it's deemed good/reasonable to merge


  • 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:

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4413408

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

This PR includes changesets to release 3 packages
Name Type
wrangler Minor
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

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-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Jul 28, 2026
@workers-devprod
workers-devprod requested review from a team and dario-piotrowicz and removed request for a team July 28, 2026 12:22
@workers-devprod

workers-devprod commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@ask-bonk

ask-bonk Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

devtools-protocol is a declared dependency and already imported elsewhere as a type-only import. Good.

Now let me consider the activeTime semantics once more with a real edge case. If the profile has NO idle samples but the worker was mostly idle, activeTime would be inflated. But that's inherent to CPU profiling. Not a bug.

Let me look at whether there's a division-by-zero or NaN risk when profile.nodes is empty or endTime/startTime are undefined. Protocol.Profiler.Profile guarantees startTime/endTime as numbers, nodes non-empty. Fine.

Let me verify the final concern about formatMicroseconds — the profile time units. V8/workerd CPU profiler timeDeltas and startTime/endTime are in microseconds. formatMicroseconds divides by 1000 → ms. Correct.

I've completed a thorough review. Let me summarize findings:

  • Logic in summarizeStartupProfile: correct, well-tested.
  • getBundleSize: correctly excludes source-maps and the string metadata field.
  • analyseBundle backward compat: shallow-copy {...profile} preserves JSON serialization for existing consumers.
  • Type changes: Protocol is a declared dependency.
  • Units (microseconds→ms): correct.
  • Minor: await cpuProfileResult at line 103 awaits an already-resolved value (harmless).

The only truly minor nit (redundant await) is not worth flagging as it's not a bug and doesn't affect behavior. There are no actionable logic bugs, security issues, backward-compat violations, or incorrect API behavior.

LGTM

github run

@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

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Issues found

  • .changeset/vpc-networks-connect-tunnel.md labels the feature as experimental but does not explain how users can opt in. Please add a note on how users can enable or access this experimental feature.

@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14893

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14893

create-cloudflare

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

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14893

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14893

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14893

wrangler

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

commit: 4413408

@dario-piotrowicz

Copy link
Copy Markdown
Member

Regarding the docs I assume we want to update this page? https://developers.cloudflare.com/workers/wrangler/commands/workers/#check 🤔

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very Nice! 🤩

Approving although the docs still need to be updated I think?

PS: feel free to ignore the Vite plugin E2E failures, those are unrelated to this PR and we're looking into fixing them

@workers-devprod workers-devprod 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.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

3 participants