query-monitor icon indicating copy to clipboard operation
query-monitor copied to clipboard

Listen for hooks firing within set bounds

Open crstauf opened this issue 6 years ago • 12 comments

Implement hook discovery into QM (as discussed on Twitter).

Thinking something like the following:

do_action( 'qm/listen/start', 'label' );

...

do_action( 'foobar' );

...

$foo = apply_filters( 'bar', 0 );

...

do_action( 'qm/listen/stop', 'label' );

The above would result in display of both the foobar action and the bar filter in QM, with some display of the second parameter of the QM action hook (in this example, label).

The purpose of label would be to serve in identification when multiple bounds have been set.

crstauf avatar Feb 16 '19 00:02 crstauf

As I see it, there are two approaches:

  1. Introduce a new QM collector and output
  2. Add feature to hooks collector and output

I'm personally favoring the second option, as it could introduce a pretty nice interface and contextualize the discovery. It's likely more work than option one, but ultimately I think a more cohesive experience.

With option two though, need to also consider that would add additional complexity to a relatively straight forward collector.

@johnbillion I may start on a PR for option one, but definitely interested in your thoughts before I get too far in.

crstauf avatar Feb 18 '19 02:02 crstauf

Hmm, given that the Hooks panel can be filtered, I'm now thinking of a different option:

  1. Introduce a sub-panel

crstauf avatar Feb 18 '19 19:02 crstauf

Submitted PR (#410).

crstauf avatar Feb 19 '19 05:02 crstauf

Instead of a column for counting successive uses, I think I'll change to display like the Template Parts section:

screen shot 2019-02-19 at 11 56 21 am

crstauf avatar Feb 19 '19 16:02 crstauf

Discovered Hooks sub-panel now looks like this:

screen shot 2019-02-21 at 1 44 39 am

crstauf avatar Feb 21 '19 06:02 crstauf

Planning on adding additional info to the notice that shows when using the all hook.

crstauf avatar Feb 21 '19 07:02 crstauf

  • [x] add line(s) of do_action() fire(s) to Label column as .qm-info.qm-supplemental
  • [ ] add link to Discovered Hooks panel to all hook performance notice

crstauf avatar Feb 22 '19 00:02 crstauf

Added trace info for the start and stop bounds, but I don't like how it displays:

screen shot 2019-02-21 at 8 00 06 pm

Any suggestions?

crstauf avatar Feb 22 '19 01:02 crstauf

I'm not satisfied with the current integration. Going to rebuild as a separate collector.

crstauf avatar Feb 23 '19 00:02 crstauf

Rebuilt using separate collector and output. 😄

crstauf avatar Feb 23 '19 07:02 crstauf

Man, forgot about this; so cool. 😂

crstauf avatar Sep 13 '19 22:09 crstauf

Still so cool.

crstauf avatar Jul 03 '23 20:07 crstauf