amarc-sudo/sentry-enhanced-tracing
DB, Cache, and EventDispatcher in Symfony equivalents).tymon/jwt-auth, the package’s event-based user context can be adapted via Laravel’s auth.jwt events.Illuminate\Database → Symfony DBALCache → Symfony CacheEvents → Symfony EventDispatcherBlade → Twig (or mock spans for Blade)SentryTraceStamp (similar to Symfony’s TraceableStamp).| Risk Area | Severity | Mitigation |
|---|---|---|
| Symfony Dependency | High | Use Symfony Bridge (symfony/http-foundation, symfony/cache) or adapters. |
| JWT Auth Mismatch | Medium | Replace LexikJWTAuthenticationBundle listeners with Laravel’s auth.jwt events. |
| Blade vs. Twig | Medium | Mock Twig spans or use Laravel’s stack:trace for manual instrumentation. |
| Performance Overhead | Low | Configure traces_sample_rate (e.g., 0.1 in production). |
| Breaking Changes | Low | Package is MIT-licensed; fork if needed. |
auth.jwt events to trigger EnhancedUserInterface.auth events.SentryTraceStamp for Illuminate\Queue.stack:trace for manual spans.SENTRY_DSN configured? (Laravel’s .env vs. Symfony’s %env(SENTRY_DSN)%)| Laravel Component | Symfony Equivalent | Integration Strategy |
|---|---|---|
Illuminate\Database |
Doctrine\DBAL |
Use DBAL Connection Adapter or mock spans. |
Illuminate\Cache |
Symfony\Contracts\Cache |
Wrap Laravel Cache in Symfony CacheInterface. |
Illuminate\Events |
Symfony\EventDispatcher |
Use Symfony EventDispatcher as a facade. |
Blade |
Twig |
Mock spans or use Laravel’s stack:trace. |
tymon/jwt-auth |
LexikJWTAuthentication |
Replace listeners with Laravel’s auth.jwt. |
Illuminate\Queue |
Symfony\Messenger |
Adapt SentryTraceStamp for Laravel Queues. |
Phase 1: Core Tracing (High Priority)
composer require symfony/http-foundation symfony/cache doctrine/dbal
DB and Cache in Symfony interfaces.config/bundles.php (if using Symfony).Phase 2: Event Listeners (Medium Priority)
Event facade with Symfony’s EventDispatcher.kernel.* events to Laravel’s Illuminate\Events.Phase 3: User Context (Low Priority)
User model with EnhancedUserInterface.auth.jwt events to populate Sentry user context.Phase 4: Blade/Twig (Optional)
Sentry\startSpan().| Component | Compatibility | Notes |
|---|---|---|
| Laravel 10+ | ✅ High | Works with Symfony 6.4+ components. |
| Lumen 9+ | ⚠️ Medium | Requires Symfony Bridge. |
| Octane (Swoole) | ⚠️ Medium | Test async worker tracing. |
| Horizon (Queues) | ✅ High | Adapt SentryTraceStamp for Laravel. |
| Sanctum/Passport Auth | ❌ Low | Replace with custom JWT event listeners. |
composer require amarc-sudo/sentry-enhanced-tracing symfony/cache doctrine/dbal
.env:
SENTRY_DSN=your_dsn
SENTRY_TRACES_SAMPLE_RATE=0.1
// config/bundles.php
AmarcSudo\SentryEnhancedTracing\SentryEnhancedTracingBundle::class => ['all' => true],
// app/Providers/AppServiceProvider.php
use Doctrine\DBAL\Connection;
use Illuminate\Support\Facades\DB;
public function register()
{
$db = DB::connection();
$dbalConnection = new Connection($db->getPdo(), $db->getConfig());
$this->app->singleton(Connection::class, fn() => $dbalConnection);
}
kernel.controller.auth.jwt and populate EnhancedUserInterface.Illuminate\Queue\Events\JobProcessed to inject SentryTraceStamp.| Task | Effort | Notes |
|---|---|---|
| Bundle Updates | Low | MIT license → fork if needed. |
| Laravel Core Updates | Medium | May require adapter updates (e.g., DBAL). |
| Sentry DSN Rotation | Low | Update .env and restart workers. |
| Performance Tuning | Medium | Adjust traces_sample_rate in production. |
| Issue Type | Resolution Path |
|---|---|
| Missing Spans | Check Symfony event listeners are fired. |
| JWT User Context Fails | Verify auth.jwt events are triggered. |
| Blade Tracing Missing | Implement manual spans or switch to Twig. |
| Queue Spans Not Linked | Ensure SentryTraceStamp is injected. |
traces_sample_rate=1.0 (full tracing).traces_sample_rate=0.1 (10% sampling).if (request()->is('api/heavy-endpoint*')) {
Sentry\configureScope(fn($scope) => $scope->setSpan(null));
}
| Failure Scenario | Impact
How can I help you explore Laravel packages today?