Skip to content
Discussion options

You must be logged in to vote

I think this would make sense as a framework-level API, especially if it builds on top of the existing query event/listener infrastructure rather than introducing a separate mechanism.

One thing that could make the API useful beyond DB::listen() is supporting both a global threshold and per-connection thresholds.

For example:

DB::whenQueryingForLongerThan(500, function ($connection, $event) {
    // ...
});

This could also avoid exposing threshold logic to every application while keeping the callback opt-in.

It might be worth considering whether the callback should receive the connection as well as the query event, since applications may want different monitoring behavior depending on whi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by JenniferTantely
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants