Add access to cumulative query times and logs within request lifecycle. #54629
Unanswered
LogicSatinn
asked this question in
Ideas
Replies: 1 comment
-
This will pass when db does not have big data sets and will start sending emails when the db increases in size. Current implementation /**
* The duration of all executed queries in milliseconds.
*
* @var float
*/
protected $totalQueryDuration = 0.0;
So this means all executed queries in a connection instance so at least one of your requests is fulfilled.
These rise the issue of memory filling in order to cache all queries that a connection executed and then in worker or octane environment you would have to empty that memory. You could use for that /**
* Enable the query log on the connection.
*
* @return void
*/
public function enableQueryLog()
{
$this->loggingQueries = true;
}
// and
if ($this->loggingQueries) {
$this->queryLog[] = compact('query', 'bindings', 'time');
}
// and
/**
* Get the connection query log.
*
* @return array
*/
public function getQueryLog()
{
return $this->queryLog;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently,
whenQueryingForLongerThan
only provides access to individual query details, even when multiple queries within a request cumulatively exceed the threshold.Eg.
Problem:
Proposal:
Add an event to access:
This would help identify requests with high cumulative DB load without using application monitoring tools.
Thoughts on implementation approach or alternative solutions?
Beta Was this translation helpful? Give feedback.
All reactions