jazzband / django-debug-toolbar

A configurable set of panels that display various debug information about the current request/response.
https://django-debug-toolbar.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
7.97k stars 1.03k forks source link

CPU Time includes DJDT's own time #1903

Open vanschelven opened 2 months ago

vanschelven commented 2 months ago

The CPU Time displayed in the DJDT shows the total time taken to render the request, including the time to render the DJDT itself. This is not what I care about, because the DJDT will not be there when running in production.

Is it possible to get the time elapsed of the actual rendered view on-screen somewhere?

tim-schilling commented 2 months ago

If you're looking for metrics on the app running in production, I'd suggest looking into an APM product or an observability product.

vanschelven commented 2 months ago

I don't think I said that although I see how what I said could be interpreted in that way. Let me clarify: in my case, the number as-shown was for c. 90% caused by the DJDT itself. Because I was in the assumption that the DJDT was saying something (mostly) about my code, rather than about itself, this led me on a wild goose chase, searching for the slowness in my application. This could have been prevented if the DJDT time/cpu panel had one or 2 lines about the "thing under measurement" explicitly

tim-schilling commented 2 months ago

I appreciate the clarification.

I can see how that is a problem. I suspect it's possible for the tollbar middleware to track how long it's been running, then present that in the response along side the overall time.

I'm not sure we'd want to do the subtraction automatically because the total time is the total time. The toolbar is a part of the application.

Is that something you're interested in creating a PR for?

vanschelven commented 2 months ago

Is that something you're interested in creating a PR for?

"maybe"... I'll let you know :smile: