- How does TraceReplay differ from Laravel Telescope or Debugbar for debugging complex workflows?
- TraceReplay provides step-level granularity (not just request-level) with a waterfall timeline, deterministic HTTP replay, and AI-assisted debugging. Unlike Telescope or Debugbar, it auto-traces jobs, commands, and Livewire, while masking PII and supporting multi-tenant scoping. It’s designed for workflows like multi-step payments, not just HTTP requests.
- Can I use TraceReplay in production without impacting performance?
- Yes, but with configuration. Use `sample_rate` (e.g., 5–10%) to limit traces, disable `track_db_queries` on high-traffic endpoints, and set `max_payload_size` (default: 64KB). Async queue persistence further reduces DB load. Test with `sample_rate=0.1` first to measure overhead.
- Does TraceReplay support Laravel Octane (Swoole/Preact) and async workers?
- Yes, TraceReplay is compatible with Laravel Octane (PHP 8.2+) and works with async workers like Swoole. It auto-traces jobs and commands, including those dispatched in Octane environments, without requiring manual instrumentation.
- How do I manually instrument a custom step in my Laravel application?
- Use `TraceReplay::step('step_name', $payload)` to log custom steps. For example, `TraceReplay::step('payment_processing', ['amount' => $amount, 'user_id' => $user->id])`. Steps appear in the waterfall timeline and can be replayed or debugged with AI prompts.
- Will TraceReplay work with my existing database (PostgreSQL/MySQL/SQLite) and queue system?
- TraceReplay is database-agnostic and stores payloads in JSON columns, so it works with PostgreSQL, MySQL, and SQLite. It auto-traces Laravel Jobs for Redis, Database, and Beanstalkd queues, but query tracking requires DB driver hooks, which may add minor overhead.
- How does the AI-assisted debugging feature work, and do I need an API key?
- TraceReplay integrates with OpenAI, Anthropic, or Ollama to generate fix prompts from traced execution data. You can enable it via `ai_provider` in config, but it’s optional—manual inspection works without API keys. The AI analyzes the waterfall timeline and suggests fixes for edge cases.
- Is it safe to replay HTTP requests in production? Can it accidentally mutate data?
- No, mutating methods are blocked by default. Replay is opt-in and restricted to `allowed_hosts` in config. Set `TRACE_REPLAY_REPLAY_MUTATING=false` in production to disable unsafe operations entirely. JSON diffs show response changes without execution.
- How do I handle sensitive data (PII) in traced payloads?
- Use `mask_fields` in config to automatically redact sensitive data (e.g., passwords, emails). For example, `mask_fields = ['password', 'credit_card']`. Payloads are masked before storage, ensuring compliance with GDPR/HIPAA. Disable `track_db_query_bindings` in production for extra safety.
- Can TraceReplay track Livewire component interactions and hydration?
- Yes, enable `auto_trace.livewire=true` in config to capture Livewire component hydration, method calls, and props. This helps debug complex UI-driven workflows by showing step-by-step execution, including Livewire-specific events.
- What are the alternatives to TraceReplay for Laravel debugging, and when should I choose it?
- Alternatives include Telescope (request-level debugging), Debugbar (real-time metrics), and Clockwork (HTTP inspection). Choose TraceReplay if you need step-level tracing, deterministic replay, AI debugging, or multi-tenant support. It’s ideal for SaaS, complex workflows, or teams prioritizing developer productivity over third-party tools.