Profpatsch/users/Profpatsch/firefox-profiler
- README.md 1.1 KiB
- default.nix 2.5 KiB
- firefox-config.png 40.9 KiB
- firefox-profiler.1 3.8 KiB
- go.mod 33 B
- main.go 4.0 KiB
Local Firefox Profiler as single static binary
The “official” firefox profiler is hosted at https://profiler.firefox.com/. Firefox itself does not provide its own local-only profiler anymore, but any profiles you create (or upload) will be opened on the Mozilla-hosted website.
Mozilla employees assured me that currently no telemetry is used on profiler.firefox.com, but the linked privacy policy basically allows Mozilla to do any kind of data collection (breaching GDPR …).
However, it is possible to change the profiler Firefox uses to an arbitrary URL.
In about:config, set the preference
devtools.performance.recording.ui-base-url
to http://localhost:5252 (or whichever port you use):

So if you want to host your profiler yourself (e.g. on your local machine or in your own company network (profiles are IP-critical pieces of data!), you can use this nix expression to build a simple golang binary which serves the javascript files.
nix run https://sources.profpatsch.de/Profpatsch.tar.gz#firefox-profiler
firefox-profiler(1)
NAME
firefox-profiler - serve the Firefox Profiler frontend locally
SYNOPSIS
firefox-profiler [-port port] [-open file]
DESCRIPTION
firefox-profiler is a standalone HTTP server that serves the Firefox Profiler web application from a single self-contained binary.
The official Firefox Profiler is hosted at https://profiler.firefox.com/. Firefox no longer ships its own local profiler; any profiles you capture are opened on the Mozilla-hosted website. While Mozilla employees have stated that no telemetry is currently collected, the linked privacy policy permits Mozilla to perform arbitrary data collection, which may conflict with GDPR obligations and is problematic for IP-sensitive profiling data such as company-internal performance work.
firefox-profiler solves this by building the profiler frontend from a pinned upstream commit and embedding it into a single binary, which serves both the JavaScript application and stub API endpoints from the same origin. The upload, delete, and URL-shortening API endpoints all return "501 Not Implemented" — the server is intended purely for local profile viewing, not sharing.
To use firefox-profiler, configure Firefox to open profiles with your local server instead of https://profiler.firefox.com/. In Firefox, go to about:config and set the preference devtools.performance.recording.ui-base-url to http://localhost:5252 (or whichever port you are using).
The arguments are as follows:
-port port
The TCP port to listen on. Defaults to 5252, or a random free port when -open is used.
-open file
Open a profile file directly in the browser. firefox-profiler serves the file at /cli/open/profile and opens the browser at the corresponding /from-url/ address. The route is de-registered after the first fetch so the profile data is not kept in memory, but the server itself keeps running. Implies a random port unless -port is also given.
API ENDPOINTS
The following endpoints are implemented:
GET /__lbheartbeat__
Returns 200 OK. Load-balancer liveness check.
GET /__heartbeat__
Returns 200 OK. Health check.
GET /__version__
Returns a JSON object with version information.
GET /
Serves the Firefox Profiler single-page application. All paths not matching a known static asset fall back to index.html for client-side routing.
The following endpoints return "501 Not Implemented":
POST /compressed-store
Profile upload (requires Google Cloud Storage in the original server).
DELETE /profile/token
Profile deletion.
POST /shorten
URL shortening (requires Bitly in the original server).
POST /expand
URL expansion.
EXAMPLES
Start the server on the default port:
$ firefox-profiler
firefox-profiler listening on http://localhost:5252
Open a profile file directly in the browser (random port, server stays running):
$ firefox-profiler -open profile.json.gz
firefox-profiler listening on http://localhost:48291
opening http://localhost:48291/from-url/http%3A%2F%2Flocalhost%3A48291%2Fcli%2Fopen%2Fprofile
profile served, route deactivated
Use a custom port:
$ firefox-profiler -port 8080
Build and run directly with Nix:
$ nix run git+https://codeberg.org/Profpatsch/Profpatsch#firefox-profiler -- -open profile.json.gz
Use a custom port:
$ firefox-profiler-server -port 8080
Build and run directly with Nix:
$ nix run git+https://codeberg.org/Profpatsch/Profpatsch#firefox-profiler
SEE ALSO
AUTHORS
Profpatsch