Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/DataCollector/QueryCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class QueryCollector extends PDOCollector
protected $timeCollector;
protected $queries = [];
protected $queryCount = 0;
protected $transactionEventsCount = 0;
protected $softLimit = null;
protected $hardLimit = null;
protected $lastMemoryUsage;
Expand Down Expand Up @@ -439,6 +440,7 @@ protected function getTwigInfo($trace)
*/
public function collectTransactionEvent($event, $connection)
{
$this->transactionEventsCount++;
$source = [];

if ($this->findSource) {
Expand Down Expand Up @@ -484,6 +486,11 @@ public function collect()
$statements = [];
foreach ($queries as $query) {
$source = reset($query['source']);
$normalizedPath = is_object($source) ? $this->normalizeFilePath($source->file ?: '') : '';
if ($query['type'] != 'transaction' && Str::startsWith($normalizedPath, $this->excludePaths)) {
continue;
}

$totalTime += $query['time'];
$totalMemory += $query['memory'];

Expand All @@ -497,11 +504,6 @@ public function collect()
default => false,
};

$source = $this->getDataFormatter()->formatSource($source);
if (Str::startsWith($source, $this->excludePaths)) {
continue;
}

$statements[] = [
'sql' => $this->getSqlQueryToDisplay($query),
'type' => $query['type'],
Expand Down Expand Up @@ -580,7 +582,7 @@ public function collect()
$data = [
'nb_statements' => $this->queryCount,
'nb_visible_statements' => count($statements),
'nb_excluded_statements' => $this->queryCount - count($statements),
'nb_excluded_statements' => $this->queryCount + $this->transactionEventsCount - count($statements),
'nb_failed_statements' => 0,
'accumulated_duration' => $totalTime,
'accumulated_duration_str' => $this->formatDuration($totalTime),
Expand Down
Loading