google / google/pprof

FR: Allow embedding static flamegraphs in an HTML page. Output HTML Flamegraph.

Open
#670 2 comments 0 reactions 0 assignees View on GitHub
Priority: p3 type: feat
Dominant language
Go
Stars
9.3k
Forks
671
Avg merge
1d 11h
Merged PRs (30d)
10

Description

This probably isn't a high priority item, but it might be easy. Filing a Feature Request to track, and to hear if other people think it's a good idea or not.

Recently I published a blogpost about a pprof feature: https://www.markhansen.co.nz/pprof-tagroot/. I wanted to build in an interactive flamegraph that people can hover and see in their browser.

Ideally I'd want to get the [d3-flame-graph JSON format](https://github.com/spiermar/d3-flame-graph) output from the pprof tool, and embed that into my page with my own skinning.

Or, alternatively, have pprof output a single HTML page with the flamegraph in it. Like https://github.com/brendangregg/FlameGraph does, or like how we can output other file formats. Then embed that page in my page as an iframe.

pprof already has an exporter to d3-flame-graph format built-in, as part of the Flamegraph view in `pprof web`. But it's not easy to embed a web server in a blog. I ended up saving the HTML from `pprof web` using the browser's "Save As" function, then hacking the CSS to hide the top-nav-bar (which would be full of broken links if I tried to embed them in a website) with `display: none;`.

Given pprof already has the exporter to d3-flame-graph format, and it seems like a stable format, which [is already output by some other profiling tools](https://profilerpedia.markhansen.co.nz/formats/d3-flamegraph/), I propose adding a `-d3-flame-graph` output option? It could output HTML (containing JSON), or just JSON. Or we could add both options.

The JSON format would be easier to start with (we already have it). The HTML format would be more useful to more people (easily attach it to bugs, for example).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.