Skip to content

Commit

Permalink
Fixed instrumentation of DB queries - has() seems to only check if in…
Browse files Browse the repository at this point in the history
…stance already made
  • Loading branch information
asgrim committed Apr 2, 2021
1 parent 2a8885c commit aefef10
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Laravel/Providers/ScoutApmServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,19 @@ public function boot(
$runningInConsole = $application->runningInConsole();
}

if ($application->has('connection')) {
$connection = $application->make('connection');
try {
$connection = $application->make('db')->connection();
$this->instrumentDatabaseQueries($agent, $connection);
} catch (BindingResolutionException $bindingResolutionException) {
$log->info(
sprintf(
'Could not set up DB instrumentation: %s',
$bindingResolutionException->getMessage()
),
[
'exception' => $bindingResolutionException,
]
);
}

if ($agent->shouldInstrument(self::INSTRUMENT_LARAVEL_QUEUES)) {
Expand Down

0 comments on commit aefef10

Please sign in to comment.