catcombo/django-speedinfo

Store Content-Type?

blueyed opened this issue · 5 comments

Especially with DRF it is relevant if a request's response is of Content-Type text/html, text/json etc.

I think it would be nice to store this information (without the charset, i.e. everything up until ";").

What do you think?

I use DRF in my work too and understand what you are talking about. But I think it is not worth it. In django-rest-framework the rendering part is the only difference when you requesting the same view in different formats. Thus the time and other stats for this view requested in json or xml formats will be pretty much the same.

But maybe you have other arguments and you can convince me to change my mind :)

I was thinking more about the "html" view, which might take (much) longer where there are non-optimized selection fields rendered with DRF's browsable API.

But then I also wonder how to display/handle this - the best might be to allow for filtering by content-type maybe, instead of or additional to displaying it in the table.

Nice idea, I like it. I think a more general solution can be used. I can add a function to filter views by custom criteria. By default it will filter views by urls defined in SPEEDINFO_EXCLUDE_URLS (same as it works now), but it can be also extended to check request/response object. I need a time to think about how best to implement it. Thanks for the idea!

Hey @blueyed! Check out the latest changes in the develop branch. I've added the ability to write custom classes to define profiling conditions. I think that's what you asked for. What do you think about it?

Released in v1.4.0