jameysharp added the enhancement label to Issue #7666.
jameysharp added the wasmtime label to Issue #7666.
jameysharp opened issue #7666:
Feature
When invoking the guest profiler via either its
GuestProfiler
Rust API or the Wasmtime CLI, we should provide the option of running a local web server to serve profile data, then generating links to https://profiler.firefox.com/ that direct it to load the profile data directly from the local web server.Benefit
Currently, we write the profile data to a file, then tell the user the path to that file. They then browse to https://profiler.firefox.com/ and use their browser's file-open dialog to find the path we told them. It would be more convenient to give them a single URL which automatically loads the profile data.
Running a local web server also allows us to symbolicate lazily and serve source code to the viewer on-demand, in principle.
Implementation
The Samply profiler illustrates how to do this, in https://github.com/mstange/samply/blob/main/samply/src/server.rs.
Alternatives
We could continue just writing the profile to a file and letting the user find it in their filesystem.
I was hesitant to suggest doing this in Wasmtime before because it means we need to depend on an HTTP server like
hyper
. I thought it would be better to implement the parts which depend on a web server in embedders such as Viceroy that have their own web server. But now that we've implemented wasi-http, Wasmtime depends onhyper
anyway, so we might as well do it in Wasmtime where it can be shared across multiple embedders.
Last updated: Dec 23 2024 at 12:05 UTC