brendangregg / FlameGraph

Stack trace visualizer
http://www.brendangregg.com/flamegraphs.html
17.2k stars 1.96k forks source link

Question: multiple SVG files per page? #221

Open KarateSnowMachine opened 4 years ago

KarateSnowMachine commented 4 years ago

I am trying to lower the barrier to entry for looking at flame graphs on my headless environment by putting some python wrapper code into a Jupyter Notebook to run the stack collapse + flame graph scripts on the server and just displaying the SVG output in the browser. For a single SVG file this works fantastically great -- I get the flame graph and the interactivity and I can iterate quickly.

One thing I was hoping to do was to have the notebook render some baseline flame graph in one cell and then keep the iteration graphs in subsequent cells. However, it appears that the scripts create a lot of DOM(?) elements that aren't unique and so the interactivity features get very broken (for example, doing a search in the second SVG updates the boxes in the first SVG).

Before I dig into the code with my rusty web skills, I was wondering if anyone had any idea how difficult it would be to make each invocation of the flame graph script to basically generate unique elements so each SVG wouldn't interfere with the other SVGs on the page. Is there some quick workaround I can use?

Thanks for your time.

versable commented 4 years ago

Consider wrapping/isolating each SVG into an iframe, if possible