88use Sentry \EventHint ;
99use Sentry \ExceptionMechanism ;
1010use Sentry \Logs \Logs ;
11+ use Sentry \Metrics \TraceMetrics ;
1112use Sentry \State \HubInterface ;
1213use Sentry \State \Scope ;
1314use Symfony \Component \Console \Event \ConsoleCommandEvent ;
@@ -36,8 +37,8 @@ class ConsoleListener
3637 /**
3738 * Constructor.
3839 *
39- * @param HubInterface $hub The current hub
40- * @param bool $captureErrors Whether to capture console errors
40+ * @param HubInterface $hub The current hub
41+ * @param bool $captureErrors Whether to capture console errors
4142 */
4243 public function __construct (HubInterface $ hub , bool $ captureErrors = true )
4344 {
@@ -61,7 +62,7 @@ public function handleConsoleCommandEvent(ConsoleCommandEvent $event): void
6162 }
6263
6364 if ($ input instanceof ArgvInput) {
64- $ scope ->setExtra ('Full command ' , (string ) $ input );
65+ $ scope ->setExtra ('Full command ' , (string )$ input );
6566 }
6667 }
6768
@@ -73,6 +74,7 @@ public function handleConsoleCommandEvent(ConsoleCommandEvent $event): void
7374 public function handleConsoleTerminateEvent (ConsoleTerminateEvent $ event ): void
7475 {
7576 Logs::getInstance ()->flush ();
77+ TraceMetrics::getInstance ()->flush ();
7678 $ this ->hub ->popScope ();
7779 }
7880
@@ -84,7 +86,7 @@ public function handleConsoleTerminateEvent(ConsoleTerminateEvent $event): void
8486 public function handleConsoleErrorEvent (ConsoleErrorEvent $ event ): void
8587 {
8688 $ this ->hub ->configureScope (function (Scope $ scope ) use ($ event ): void {
87- $ scope ->setTag ('console.command.exit_code ' , (string ) $ event ->getExitCode ());
89+ $ scope ->setTag ('console.command.exit_code ' , (string )$ event ->getExitCode ());
8890
8991 if ($ this ->captureErrors ) {
9092 $ hint = EventHint::fromArray ([
0 commit comments