Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 31a38b7

Browse files
committedMar 21, 2024
Add current context to event
1 parent 2e77090 commit 31a38b7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎src/Sentry/Laravel/Integration.php

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Database\LazyLoadingViolationException;
77
use Illuminate\Foundation\Configuration\Exceptions;
88
use Illuminate\Routing\Route;
9+
use Illuminate\Support\Facades\Context;
910
use Sentry\EventHint;
1011
use Sentry\EventId;
1112
use Sentry\ExceptionMechanism;
@@ -49,6 +50,14 @@ public function setupOnce(): void
4950
$event->setTransaction(self::getTransaction());
5051
}
5152

53+
if (class_exists(Context::class)) {
54+
$context = Context::all();
55+
56+
if (!empty($context)) {
57+
$event->setContext('laravel', Context::all());
58+
}
59+
}
60+
5261
return $event;
5362
});
5463
}

0 commit comments

Comments
 (0)
Please sign in to comment.