X-Request-Id handling.X-Request-Id header injection/extraction.request_id to every log.request_id into queue payloads (e.g., via Illuminate\Queue\SerializesModels or dispatchSync wrappers).monolog/monolog by default; the bundle’s processor can be adapted via a custom Handler or Processor.X-Request-Id is set before other middleware (e.g., auth, validation) runs.Ramsey\Uuid or symfony/uuid can generate UUIDv7 (if not already in use).| Risk Area | Severity | Mitigation |
|---|---|---|
| Laravel-Symfony Abstraction | High | Abstract Messenger logic into a queue listener wrapper (e.g., QueueRequestIdMiddleware). |
| Log Correlation Gaps | Medium | Validate request_id propagation in all log handlers (e.g., SingleHandler, StreamHandler). |
| Performance Overhead | Low | UUIDv7 generation is O(1); header/log injection adds <1ms latency. |
| Queue Worker Isolation | Medium | Test worker crashes to ensure request_id isn’t lost in retries. |
| Vendor Lock-in | Low | Bundle is MIT-licensed; extract core logic if needed. |
request_id injection?request_id propagation mechanism?Phase 1: HTTP Layer (1-2 days)
RequestIdListener with Laravel middleware:
// app/Http/Middleware/RequestIdMiddleware.php
public function handle($request, Closure $next) {
$request->headers->set('X-Request-Id', Uuid::v7()->toString());
return $next($request);
}
app/Http/Kernel.php.Phase 2: Logging (1 day)
request_id:
// config/logging.php
'processors' => [
(new \Amashukov\TracingBundle\Processor\RequestIdProcessor())->withAttribute('request_id'),
],
Phase 3: Queue Propagation (2-3 days)
dispatchSync for critical paths (no queue bridge needed).request_id:
// app/Jobs/TraceableJob.php
public function handle() {
Log::info('Processing job', ['request_id' => $this->requestId]);
}
Illuminate\Queue\Queue to auto-inject headers (advanced).Phase 4: Validation (1 day)
request_id.request_id persists in retry logs.| Component | Compatibility | Notes |
|---|---|---|
| Laravel Middleware | ✅ High | Direct replacement for Symfony’s RequestIdListener. |
| Monolog | ✅ High | Processor can be adapted to Laravel’s config. |
| Laravel Queues | ⚠️ Medium | Requires custom wrapper for request_id injection. |
| Horizon Workers | ✅ High | Works if request_id is passed in job payload. |
| Custom Log Handlers | ⚠️ Low | May need additional config to include extra.request_id. |
ramsey/uuid or symfony/uuid for UUIDv7 generation.request_id drops in logs/queues.request_id enables easy filtering in ELK/Datadog.request_id issues require cross-layer tracing.request_id remains in extra field.request_id in alerting rules (e.g., "no logs for this ID").How can I help you explore Laravel packages today?