Skip to content

Commit 542c6ea

Browse files
penalosaemily-shen
andauthored
Support profiling the startup phase of a Worker (#8026)
* Startup profiling * fixes * Support Pages * pages * fix lint * Update packages/wrangler/src/check/commands.ts Co-authored-by: emily-shen <[email protected]> * Automatically show message on Pages deploy failures * fix lint --------- Co-authored-by: emily-shen <[email protected]>
1 parent 3fb801f commit 542c6ea

File tree

15 files changed

+1009
-176
lines changed

15 files changed

+1009
-176
lines changed

.changeset/rich-pots-mate.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"wrangler": minor
3+
---
4+
5+
Add `--outfile` to `wrangler deploy` for generating a worker bundle.
6+
7+
This is an advanced feature that most users won't need to use. When set, Wrangler will output your built Worker bundle in a Cloudflare specific format that captures all information needed to deploy a Worker using the [Worker Upload API](https://developers.cloudflare.com/api/resources/workers/subresources/scripts/methods/update/)

.changeset/startup-profiling.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"wrangler": minor
3+
---
4+
5+
Add a `wrangler check startup` command to generate a CPU profile of your Worker's startup phase.
6+
7+
This can be imported into Chrome DevTools or opened directly in VSCode to view a flamegraph of your Worker's startup phase. Additionally, when a Worker deployment fails with a startup time error Wrangler will automatically generate a CPU profile for easy investigation.
8+
9+
Advanced usage:
10+
11+
- `--deploy-args`: to customise the way `wrangler check startup` builds your Worker for analysis, provide the exact arguments you use when deploying your Worker with `wrangler deploy`. For instance, if you deploy your Worker with `wrangler deploy --no-bundle`, you should use `wrangler check startup --deploy-args="--no-bundle"` to profile the startup phase.
12+
- `--worker-bundle`: if you don't use Wrangler to deploy your Worker, you can use this argument to provide a Worker bundle to analyse. This should be a file path to a serialised multipart upload, with the exact same format as the API expects: https://developers.cloudflare.com/api/resources/workers/subresources/scripts/methods/update/

0 commit comments

Comments
 (0)