Sorting of debug data #27

Closed
thiagotalma opened this Issue Jun 9, 2015 · 17 comments

Projects

None yet

5 participants

@thiagotalma
Contributor

Probably the biggest motivator (not the only) to access the debug panel is to track the execution of the application, step by step.

What is the opinion of you on making the time column as default sorting in all panels?

@samdark
Member
samdark commented Jun 9, 2015

My main motivator is to find out slow parts and optimize them.

@joe-meyer

Personally if I want to see something (even database profiling) in order by time I find that usually I want to look at the "Profiling" tab anyway. This gives more verbose stack output than the simplified database profiling (which doesn't list things like database connection opening / closing). Additionally it does default to sort by the time column.

@mikehaertl
Contributor

+1 for sort order by time of execution. I was very confused today and spent quite some time to figure out, why some query was executed before some other query, which was not possible by looking at my code. I had to open #60 where @samdark finally pointed me to the default sorting.

To me it's quite un-intuitive.

@mikehaertl
Contributor

... or if you do default sorting by duration, then at least keep the # column intact. Why is there a 1 in that column if that wasn't the first query being executed?

@samdark
Member
samdark commented Oct 14, 2015

Last suggestion totally makes sense.

@samdark
Member
samdark commented Oct 14, 2015

Also we may consider making sorting sticky.

@samdark samdark added the enhancement label Oct 14, 2015
@mikehaertl
Contributor

My main motivator is to find out slow parts and optimize them.

Right, so sorting by duration is fine under "Profiling". But why do the same under "Database" by default? I expect to see the DB related log entries there. And log entries are usually always ordered by timestamp.

@mikehaertl
Contributor

Now what is really funny: Under "Profiling" the rows are obviously sorted by timestamp by default. :D

@thiagotalma
Contributor

@samdark my suggestion:

Use the "sort" as a module property and allow each developer to do the way he wants, specific to each panel.

Something like this:

Module.php

    public $panelSort = [
        '_default' => [
            'attributes' => ['duration', 'seq', 'type', 'query'],
            'defaultOrder' => [
                'duration' => SORT_DESC
            ]
    ];
    private function getSort($panel)
    {
        return ArrayHelper($module->panelSort, $panel, $module->panelSort['_default']);
    }

main-local.php

    [
        'bootstrap' => ['debug'],
        'modules' => [
            'debug' => [
                'class' => 'yii\debug\Module',
                'allowedIPs' => ['192.168.88.100'],
                'panelSort ' => [
                    'db' => [
                        'attributes' => ['seq', 'duration', 'type', 'query'],
                        'defaultOrder' => [
                            'duration' => SORT_ASC
                        ]
                    ]
                ]
            ]
        ]
    ]
@samdark
Member
samdark commented Oct 14, 2015

It's better just to make it sticky per page so when sorted once it's remembered.

@mikehaertl
Contributor

Sticky is fine. But still there should be sane defaults. I think, the current ones are not. They are exactly the opposite of what you would expect:

  • Profiling: Sort by duration
  • Database, Logs: Sort by timestampl
@samdark
Member
samdark commented Oct 14, 2015

Agree.

@cbepxpa3ym

This still needs to be done, please.

@thiagotalma
Contributor
thiagotalma commented Aug 14, 2016 edited

@yiisoft/core-developers
Hi guys, we need more opinions here...

Edit: I can't mention teams 😯

@samdark
Member
samdark commented Aug 15, 2016

I've voiced my opinion already. @yiisoft/core-developers?

@thiagotalma
Contributor

@samdark I can send a PR with the above suggestion?

@cbepxpa3ym

It's useless, I think. Just what mikehaertl suggested would be enough.

@samdark samdark added this to the 2.0.7 milestone Nov 23, 2016
@samdark samdark self-assigned this Nov 23, 2016
@samdark samdark added a commit that closed this issue Nov 23, 2016
@samdark samdark Fixes #27: Adjusted sorting defaults, removed row numbers from databa…
…se, log and profiling panels
5d57382
@samdark samdark closed this in 5d57382 Nov 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment