Skip to content

Listen for hooks firing within set bounds #405

Open
@crstauf

Description

@crstauf

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.

Activity

crstauf

crstauf commented on Feb 18, 2019

@crstauf
ContributorAuthor

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

crstauf commented on Feb 18, 2019

@crstauf
ContributorAuthor

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

  1. Introduce a sub-panel
added a commit that references this issue on Feb 19, 2019
crstauf

crstauf commented on Feb 19, 2019

@crstauf
ContributorAuthor

Submitted PR (#410).

crstauf

crstauf commented on Feb 19, 2019

@crstauf
ContributorAuthor

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

crstauf commented on Feb 21, 2019

@crstauf
ContributorAuthor

Discovered Hooks sub-panel now looks like this:

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

crstauf

crstauf commented on Feb 21, 2019

@crstauf
ContributorAuthor

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

crstauf

crstauf commented on Feb 22, 2019

@crstauf
ContributorAuthor
  • 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

crstauf commented on Feb 22, 2019

@crstauf
ContributorAuthor

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

crstauf commented on Feb 23, 2019

@crstauf
ContributorAuthor

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

crstauf

crstauf commented on Feb 23, 2019

@crstauf
ContributorAuthor

Rebuilt using separate collector and output. 😄

crstauf

crstauf commented on Sep 13, 2019

@crstauf
ContributorAuthor

Man, forgot about this; so cool. 😂

crstauf

crstauf commented on Jul 3, 2023

@crstauf
ContributorAuthor

Still so cool.

linked a pull request that will close this issue on Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @crstauf

      Issue actions

        Listen for hooks firing within set bounds · Issue #405 · johnbillion/query-monitor