4
4
5
5
use Exception ;
6
6
use Illuminate \Auth \Events as AuthEvents ;
7
- use Illuminate \Console \Events as ConsoleEvents ;
8
7
use Illuminate \Contracts \Auth \Authenticatable ;
9
8
use Illuminate \Contracts \Container \BindingResolutionException ;
10
9
use Illuminate \Contracts \Container \Container ;
21
20
use Sentry \Laravel \Tracing \Middleware ;
22
21
use Sentry \SentrySdk ;
23
22
use Sentry \State \Scope ;
24
- use Symfony \Component \Console \Input \ArgvInput ;
25
- use Symfony \Component \Console \Input \InputInterface ;
26
23
27
24
class EventHandler
28
25
{
@@ -35,8 +32,6 @@ class EventHandler
35
32
LogEvents \MessageLogged::class => 'messageLogged ' ,
36
33
RoutingEvents \RouteMatched::class => 'routeMatched ' ,
37
34
DatabaseEvents \QueryExecuted::class => 'queryExecuted ' ,
38
- ConsoleEvents \CommandStarting::class => 'commandStarting ' ,
39
- ConsoleEvents \CommandFinished::class => 'commandFinished ' ,
40
35
];
41
36
42
37
/**
@@ -96,13 +91,6 @@ class EventHandler
96
91
*/
97
92
private $ recordLaravelLogs ;
98
93
99
- /**
100
- * Indicates if we should add command info to the breadcrumbs.
101
- *
102
- * @var bool
103
- */
104
- private $ recordCommandInfo ;
105
-
106
94
/**
107
95
* Indicates if we should add tick info to the breadcrumbs.
108
96
*
@@ -137,7 +125,6 @@ public function __construct(Container $container, array $config)
137
125
$ this ->recordSqlQueries = ($ config ['breadcrumbs.sql_queries ' ] ?? $ config ['breadcrumbs ' ]['sql_queries ' ] ?? true ) === true ;
138
126
$ this ->recordSqlBindings = ($ config ['breadcrumbs.sql_bindings ' ] ?? $ config ['breadcrumbs ' ]['sql_bindings ' ] ?? false ) === true ;
139
127
$ this ->recordLaravelLogs = ($ config ['breadcrumbs.logs ' ] ?? $ config ['breadcrumbs ' ]['logs ' ] ?? true ) === true ;
140
- $ this ->recordCommandInfo = ($ config ['breadcrumbs.command_info ' ] ?? $ config ['breadcrumbs ' ]['command_info ' ] ?? true ) === true ;
141
128
$ this ->recordOctaneTickInfo = ($ config ['breadcrumbs.octane_tick_info ' ] ?? $ config ['breadcrumbs ' ]['octane_tick_info ' ] ?? true ) === true ;
142
129
$ this ->recordOctaneTaskInfo = ($ config ['breadcrumbs.octane_task_info ' ] ?? $ config ['breadcrumbs ' ]['octane_task_info ' ] ?? true ) === true ;
143
130
}
@@ -316,68 +303,6 @@ private function configureUserScopeFromModel($authUser): void
316
303
});
317
304
}
318
305
319
- protected function commandStartingHandler (ConsoleEvents \CommandStarting $ event ): void
320
- {
321
- if ($ event ->command ) {
322
- Integration::configureScope (static function (Scope $ scope ) use ($ event ): void {
323
- $ scope ->setTag ('command ' , $ event ->command );
324
- });
325
-
326
- if (!$ this ->recordCommandInfo ) {
327
- return ;
328
- }
329
-
330
- Integration::addBreadcrumb (new Breadcrumb (
331
- Breadcrumb::LEVEL_INFO ,
332
- Breadcrumb::TYPE_DEFAULT ,
333
- 'artisan.command ' ,
334
- 'Starting Artisan command: ' . $ event ->command ,
335
- [
336
- 'input ' => $ this ->extractConsoleCommandInput ($ event ->input ),
337
- ]
338
- ));
339
- }
340
- }
341
-
342
- protected function commandFinishedHandler (ConsoleEvents \CommandFinished $ event ): void
343
- {
344
- if ($ this ->recordCommandInfo ) {
345
- Integration::addBreadcrumb (new Breadcrumb (
346
- Breadcrumb::LEVEL_INFO ,
347
- Breadcrumb::TYPE_DEFAULT ,
348
- 'artisan.command ' ,
349
- 'Finished Artisan command: ' . $ event ->command ,
350
- [
351
- 'exit ' => $ event ->exitCode ,
352
- 'input ' => $ this ->extractConsoleCommandInput ($ event ->input ),
353
- ]
354
- ));
355
- }
356
-
357
- // Flush any and all events that were possibly generated by the command
358
- Integration::flushEvents ();
359
-
360
- Integration::configureScope (static function (Scope $ scope ): void {
361
- $ scope ->removeTag ('command ' );
362
- });
363
- }
364
-
365
- /**
366
- * Extract the command input arguments if possible.
367
- *
368
- * @param \Symfony\Component\Console\Input\InputInterface|null $input
369
- *
370
- * @return string|null
371
- */
372
- private function extractConsoleCommandInput (?InputInterface $ input ): ?string
373
- {
374
- if ($ input instanceof ArgvInput) {
375
- return (string )$ input ;
376
- }
377
-
378
- return null ;
379
- }
380
-
381
306
protected function octaneRequestReceivedHandler (Octane \RequestReceived $ event ): void
382
307
{
383
308
$ this ->prepareScopeForOctane ();
0 commit comments