-
Notifications
You must be signed in to change notification settings - Fork 734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log worker script startup time #6318
Log worker script startup time #6318
Conversation
🦋 Changeset detectedLatest commit: 6f2c888 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10114633771/npm-package-wrangler-6318 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6318/npm-package-wrangler-6318 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10114633771/npm-package-wrangler-6318 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10114633771/npm-package-create-cloudflare-6318 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10114633771/npm-package-cloudflare-kv-asset-handler-6318 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10114633771/npm-package-miniflare-6318 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10114633771/npm-package-cloudflare-pages-shared-6318 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10114633771/npm-package-cloudflare-vitest-pool-workers-6318 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
@taylorlee is this number reliable? |
@@ -737,6 +738,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m | |||
}) | |||
); | |||
|
|||
logger.log("Script Startup Time: ", result.startup_time_ms, "ms"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should say "Worker" rather than "Script"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched it
Would like to preview before we merge and release |
I'd prefer the startup time to be logged ahead of the bindings that we report on upload. Fits naturally to be the next metric after Worker size too! |
Thanks @danlapid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM will let someone on Authoring team ✅
9bd6058
to
638cded
Compare
@@ -737,6 +738,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m | |||
}) | |||
); | |||
|
|||
logger.log("Worker Startup Time: ", result.startup_time_ms, "ms"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all the tests this value is undefined
. That doesn't seem right?
Are those tests providing a mock response for the deployment?
Does that mock need to be updated with the startup_time_ms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
@@ -760,6 +764,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m | |||
} | |||
} | |||
} catch (err) { | |||
printBindings({ ...withoutStaticAssets, vars: maskedVars }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this in the catch... could it result in printing the bindings twice? What happens if an error is thrown after the bindings have already been printed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed to me like the code after printBindings
isn't fallible as it's just a few prints, I guess that could change in the future.
I could add a flag to check if the bindings have already been printed if you feel like it's more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a flag.
@danlapid I've re-added the PR template—would you be able to fill it out? In particular, this change will probably need a changeset |
638cded
to
ad0439f
Compare
ad0439f
to
9006d88
Compare
9006d88
to
6f2c888
Compare
Same as cloudflare#6318 , but for version upload Do not merge until API release is out (probably Jul 31).
Same as #6318 , but for version upload
Same as #6318 , but for version upload
* [wrangler] log startup time in version upload Same as #6318 , but for version upload * [wrangler] remove bundle size warning Bundle size was a proxy for startup time. Now that we have startup time reported, focus on bundle size is less relevant. Tracked internally as EW-8219
* [wrangler] log startup time in version upload Same as #6318 , but for version upload * [wrangler] remove bundle size warning Bundle size was a proxy for startup time. Now that we have startup time reported, focus on bundle size is less relevant. Tracked internally as EW-8219
What this PR solves / how to test
Adds a log for worker startup time as per EW-8590.
Author has addressed the following