How to embed a Flamegraph on your website or blog
--
Stop screenshotting Flamegraphs and start embedding them
Typically a flamegraph is most useful when you’re able to click into particular nodes or stack traces to understand the program more deeply. After several blog posts where Pyroscope featured flamegraphs as a key piece of the posts it seemed that screenshotting pictures of flamegraphs was missing this key functionality compared to being able to interact with flamegraphs.
Other blog posts featuring profiling or flamegraphs, where an embedded flamegraph would have helped with engagement include:
- Brendan Gregg’s original introduction to flamegraphs
- Uber’s blog frequently links to flamegraphs
- Github’s service disruption post explaining how profiling helped them understand an outage
As a result, you can now use flamegraph.com as a place where users can upload, view, and share flamegraphs.
Specifically, recently flamegraph.com added an update that makes it easy to embed flamegraphs in your blog or website. The steps to embed a flamegraph are:
- Upload a flamegraph or flamegraph diff to flamegraph.com
- Click the “Embed” button
- Copy the “Copy” button to copy the embed code snippet
- Paste the embed code snippet into your blog or website
How to upload a flamegraph to flamegraph.com
There are three main ways you can upload a flamegraph to flamegraph.com.
Method 1: Exporting a flamegraph directly from Pyroscope
The first method is to use the “export” menu located on the flamegraph:
Method 2: Profile a static script using pyroscope adhoc
command
The second method is to profile a script using the pyroscope adhoc
command (example), export to JSON, and then upload that JSON to…