pprof
pprof copied to clipboard
FR: Allow embedding static flamegraphs in an HTML page. Output HTML Flamegraph.
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 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, 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).
I think it's a dupe of #401. I'm not sure on the priority and how enthusiastic I'm about it. On one hand it's useful, on the other hand requests for this are fairly rare and I'd rather keep the pprof surface minimal because deprecating features is hard.
I think you're right that this is a dupe of #401 from the perspective of me wanting to embed an HTML flamegraph in a blogpost, or email it to partners at other companies (where it's not so easy to point them at my workstation's web server).
If it helps on the prioritisation, I was thinking of working on a PR for this, that just uses the existing templates from pprof web, without the header. "scratch my own itch"-style. So I'd just need code review help, but not your team to prioritise it.
But of course it's your software to decide what should go in (and be
maintained on an ongoing basis). I think in this case the extra ongoing
maintenance should be very small, given this would reuse the existing
pprof web
implementation. And flamegraphs and HTML look like solid bets
for things that don't seem likely to be deprecated any time soon?
I think there's benefit to having this inside pprof (rather than in an external tool) so it can compose with the filters (like -tagfocus, -tagroot), and have integration with the interactive prompt.
https://github.com/google/pprof/issues/401#issue-341752532 has 15 thumbs up. That sounds like there's some demand here, but I'm not sure if that's a lot of requests for this feature or not in pprof's context.
On Wed, 10 Nov 2021 at 13:19, Alexey Alexandrov @.***> wrote:
I think it's a dupe of #401 https://github.com/google/pprof/issues/401. I'm not sure on the priority and how enthusiastic I'm about it. On one hand it's useful, on the other hand requests for this are fairly rare and I'd rather keep the pprof surface minimal because deprecating features is hard.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/google/pprof/issues/670#issuecomment-964720442, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAZYOL2XCEP2CTYQ5UYJ6DULHJC3ANCNFSM5HWTX36Q .