Skip to content

Commit

Permalink
fix trace data for artisan
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacarpet committed Jun 6, 2022
1 parent 44bf363 commit 1b6621c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/A1comms/sqlcommenter/PDO/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace A1comms\sqlcommenter\PDO;

use Illuminate\Support\Arr;
use OpenCensus\Trace\Propagator\TraceContextFormatter;
use OpenCensus\Trace\Tracer;
use PDO as BasePDO;
Expand Down Expand Up @@ -49,8 +50,8 @@ protected function getTraceData(): array
{
return [
'framework' => 'Laravel '.app()->version(),
'route' => request()->route()->getName() ?? request->path(),
'controller' => request()->route()->getActionName(),
'route' => app()->runningInConsole() ? Arr::get(request()->server(), 'argv.1') : (request()->route()->getName() ?? request->path()),
'controller' => app()->runningInConsole() ? 'artisan' : request()->route()->getActionName(),
'traceparent' => (new TraceContextFormatter())->serialize(
Tracer::spanContext()
),
Expand Down

0 comments on commit 1b6621c

Please sign in to comment.