Skip to content

Commit 4a0df7e

Browse files
authored
Merge pull request #449 from derekmd/query-location-can-ignore-vendor-packages
QueryWatcher location can ignore Composer packages
2 parents 807e2ed + ab123a8 commit 4a0df7e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

config/telescope.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999

100100
Watchers\QueryWatcher::class => [
101101
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
102+
'ignore_packages' => true,
102103
'slow' => 100,
103104
],
104105

src/Watchers/QueryWatcher.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,20 @@ protected function getCallerFromStackTrace()
8080
}
8181

8282
return ! Str::contains($frame['file'],
83-
base_path('vendor'.DIRECTORY_SEPARATOR.'laravel')
83+
base_path('vendor'.DIRECTORY_SEPARATOR.$this->ignoredVendorPath())
8484
);
8585
});
8686
}
87+
88+
/**
89+
* Choose the frame outside of either Telescope/Laravel or all packages.
90+
*
91+
* @return string|null
92+
*/
93+
protected function ignoredVendorPath()
94+
{
95+
if (! ($this->options['ignore_packages'] ?? true)) {
96+
return 'laravel';
97+
}
98+
}
8799
}

0 commit comments

Comments
 (0)