djdt-flamegraph icon indicating copy to clipboard operation
djdt-flamegraph copied to clipboard

Update djdt-flamegraph to work with newest django debug toolbar

Open aleksanb opened this issue 4 years ago • 6 comments

Lifecycle methods changed on djdt 2.0 release, and scripts stopped executing as well. This change requires you to add djdt_flamegraph to INSTALLED_APPS.

aleksanb avatar Jun 04 '20 10:06 aleksanb

Hey @aleksanb, we don't really use this tool internally any more so I don't have a good way to test the changes. Happy to merge this though. However, why was the script extracted to its own file? Also, if extra steps are required to make this work, could you update the readme? Cheers.

blopker avatar Jun 04 '20 17:06 blopker

I installed this fork in my Django 2.2 project with django-debug-toolbar 2.2 and although the flamegraph tab now shows up in the toolbar, it is grayed out. My DEBUG_TOOLBAR_CONFIG.DISABLE_PANELS = {}, so I think it should be enabled. Is this a problem with this fork, or the base project?

ngearhart avatar Jun 07 '20 20:06 ngearhart

I installed this fork in my Django 2.2 project with django-debug-toolbar 2.2 and although the flamegraph tab now shows up in the toolbar, it is grayed out. My DEBUG_TOOLBAR_CONFIG.DISABLE_PANELS = {}, so I think it should be enabled. Is this a problem with this fork, or the base project?

Hi.

A thing i see i forgot to mention here, is that we're running django debug toolbar from master, as when debugging why the script moving content to the iframe wasn't executing in the frontend, i found this notice in the changelogs for unreleased djdt 3.0: https://django-debug-toolbar.readthedocs.io/en/latest/changes.html#a1-2020-06-05

Loading panel content no longer executes the scripts elements embedded in the HTML. Third party panels that require JavaScript resources should now use the Panel.scripts property.

Assuming that perhaps this already had broken on earlier versions, i just as well wrote this patch with support for 3.0 instead.

Conclusion: It might not actually work against djdt < 3.0.0

aleksanb avatar Jun 09 '20 10:06 aleksanb

@aleksanb I think it may work with djdt 2.2 - I upgraded to 3.0a1 and am seeing the same grayed out behavior

EDIT: Actually, turns out the styling of my site destroyed the checkbox I had to click to enable it. However, it appears blank - is this correct? image

ngearhart avatar Jun 09 '20 21:06 ngearhart

EDIT: Actually, turns out the styling of my site destroyed the checkbox I had to click to enable it. However, it appears blank - is this correct?

the iframe should be filled with an enormous svg, if the script loaded correctly. I'm afraid that means you'll have to bump to 3.0.

aleksanb avatar Jun 10 '20 10:06 aleksanb

@blopker
Is there any chance of merging it? (this PR made flamegraph usable with django 3.2)

pktiuk avatar Dec 08 '21 11:12 pktiuk