Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@fgsch
Copy link
Member

@fgsch fgsch commented Sep 22, 2023

Fixes #1018.

@fgsch fgsch requested a review from Integralist September 22, 2023 08:47
@Integralist Integralist added the enhancement New feature or request label Sep 22, 2023
@fgsch fgsch force-pushed the fgsch/serve-profile-guest branch 5 times, most recently from 4c15c09 to 013dfc7 Compare September 22, 2023 09:28
c.CmdClause.Flag("language", "Language type").Action(c.lang.Set).StringVar(&c.lang.Value)
c.CmdClause.Flag("package-name", "Package name").Action(c.packageName.Set).StringVar(&c.packageName.Value)
c.CmdClause.Flag("skip-build", "Skip the build step").BoolVar(&c.skipBuild)
c.CmdClause.Flag("profile-guest", "Profile the Wasm guest under Viceroy. More info at https://profiler.firefox.com/.").BoolVar(&c.profileGuest)
Copy link
Member Author

Choose a reason for hiding this comment

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

Viceroy displays "View this profile at https://profiler.firefox.com/`.
Maybe using View profiles at https://profiler.firefox.com/ is better?

Copy link
Collaborator

Choose a reason for hiding this comment

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

SGTM.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we sort the flags alphabetically as well while you're here 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@fgsch
Copy link
Member Author

fgsch commented Sep 22, 2023

Output:

$ fastly compute serve --help
USAGE
  fastly compute serve [<flags>]

Build and run a Compute@Edge package locally

OPTIONAL FLAGS
  --addr="127.0.0.1:7676"      The IPv4 address and port to listen on
  --env=ENV                    The environment configuration to use (e.g. stage)
  --file="bin/main.wasm"       The Wasm file to run
  --include-source             Include source code in built package
  --language=LANGUAGE          Language type
  --package-name=PACKAGE-NAME  Package name
  --profile-guest              Profile the Wasm guest under Viceroy. View
                               profiles at https://profiler.firefox.com/.
  --profile-guest-dir=PROFILE-GUEST-DIR
                               The directory where the per-request profiles are
                               saved to. Defaults to guest-profiles.
  --skip-build                 Skip the build step
  --timeout=TIMEOUT            Timeout, in seconds, for the build compilation
                               step
  --viceroy-check              Force the CLI to check for a newer version of the
                               Viceroy binary
  --viceroy-path=VICEROY-PATH  The path to a user installed version of the
                               Viceroy binary
  --watch                      Watch for file changes, then rebuild project and
                               restart local server
  --watch-dir=WATCH-DIR        The directory to watch files from (can be
                               relative or absolute). Defaults to current
                               directory.
...

and:

$ fastly compute serve --profile-guest 
✓ Verifying fastly.toml
✓ Identifying package name
✓ Identifying toolchain
✓ Running [scripts.build]
✓ Creating package archive

SUCCESS: Built package (pkg/name.tar.gz)

✓ Running local server

INFO: Listening on http://127.0.0.1:7676

INFO: Command output:
--------------------------------------------------------------------------------
2023-09-22T09:31:30.760443Z  WARN no backend definitions found in /Users/guest/fastly.toml
2023-09-22T09:31:30.760652Z  INFO Listening on http://127.0.0.1:7676
2023-09-22T09:31:33.691697Z  INFO request{id=0}: handling request GET http://localhost:7676/
FASTLY_SERVICE_VERSION:
2023-09-22T09:31:33.693562Z  INFO request{id=0}:
Profile written to: guest-profiles/1695375093-0.json
View this profile at https://profiler.firefox.com/.
2023-09-22T09:31:33.693573Z  INFO request{id=0}: request completed using 1.4 MB of WebAssembly heap
2023-09-22T09:31:33.693600Z  INFO request{id=0}: request completed in 2ms

@fgsch fgsch marked this pull request as ready for review September 22, 2023 09:34
@fgsch fgsch force-pushed the fgsch/serve-profile-guest branch from 013dfc7 to a75a18e Compare September 22, 2023 09:39
@fgsch fgsch changed the title Add a param to enable profiling under Viceroy Add support for the guest profiler under Viceroy Sep 22, 2023
Should address feedback by @Integralist.
@Integralist Integralist merged commit 24761dc into main Sep 22, 2023
@Integralist Integralist deleted the fgsch/serve-profile-guest branch September 22, 2023 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Add profiler support for compute serve

3 participants