Skip to content

Commit

Permalink
Set status for console command transactions (#891)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeffrey Hung <[email protected]>
Co-authored-by: Michi Hoffmann <[email protected]>
  • Loading branch information
3 people authored Nov 20, 2024
1 parent a6b680e commit 0949fc2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/EventListener/TracingConsoleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Sentry\State\HubInterface;
use Sentry\Tracing\Span;
use Sentry\Tracing\SpanContext;
use Sentry\Tracing\SpanStatus;
use Sentry\Tracing\Transaction;
use Sentry\Tracing\TransactionContext;
use Sentry\Tracing\TransactionSource;
Expand Down Expand Up @@ -93,6 +94,7 @@ public function handleConsoleTerminateEvent(ConsoleTerminateEvent $event): void
$span = $this->hub->getSpan();

if (null !== $span) {
$span->setStatus(0 === $event->getExitCode() ? SpanStatus::ok() : SpanStatus::internalError());
$span->finish();
}
}
Expand Down

0 comments on commit 0949fc2

Please sign in to comment.