- How do I integrate Inspector APM into a Laravel application with minimal setup?
- Add Inspector’s middleware to your Laravel `app/Http/Kernel.php` via `$this->middleware(InspectorMiddleware::class)` to auto-track HTTP requests. Initialize the agent with your ingestion key in a service provider’s boot method. No additional configuration is needed for basic tracing.
- Does Inspector APM support Laravel’s Eloquent ORM and database queries?
- Yes, Inspector automatically instruments Eloquent queries when used with middleware. For granular control, wrap queries in `Inspector::span()` to manually track database performance. This works seamlessly with Laravel’s query builder and raw SQL.
- What Laravel versions and PHP requirements does Inspector APM support?
- Inspector APM requires PHP 8.1+. It works with Laravel 9+ (PHP 8.1+) and Laravel 10/11 (PHP 8.2+). Check your Laravel version’s PHP compatibility first, as older versions may not support the required PHP features.
- Can I use Inspector APM for Laravel queue workers and async jobs?
- Yes, Inspector supports Laravel queues and async workers. Use `Inspector::fork()` to handle process forking (e.g., in queue workers) to avoid corrupted trace hierarchies. This ensures traces propagate correctly across worker processes.
- How does Inspector APM handle performance overhead in production?
- Inspector adds minimal overhead (~1-3% latency) for basic tracing. For high-traffic apps, use `Inspector::setSamplingRate()` to reduce data volume. Custom spans or heavy instrumentation may require sampling to maintain performance.
- Does Inspector APM support OpenTelemetry or other APM tools?
- Inspector APM is not natively OpenTelemetry-compatible, but you can export data via custom transport. If using other APM tools (e.g., Datadog, New Relic), ensure no conflicts with Inspector’s auto-instrumentation or global handlers.
- How do I filter sensitive data (e.g., API keys, user tokens) from traces?
- Use `Inspector::setFilter()` to redact sensitive data in spans or transactions. For example, filter out request payloads or environment variables containing PII. This prevents accidental exposure in the Inspector dashboard.
- Can I self-host Inspector APM or use a custom collector?
- Yes, Inspector supports pure-PHP mode with custom transports. Implement `TransportInterface` to forward data to your own collector (e.g., a self-hosted OpenTelemetry endpoint). This avoids sending data to Inspector’s cloud but requires manual setup.
- What are the alternatives to Inspector APM for Laravel monitoring?
- Alternatives include New Relic, Datadog APM, and open-source tools like OpenTelemetry PHP. New Relic and Datadog offer broader integrations but may have higher costs. OpenTelemetry provides vendor neutrality but requires more configuration.
- How do I correlate traces across microservices (e.g., Laravel + Node.js) in Inspector?
- Inspector automatically propagates context (e.g., request IDs) via headers. Ensure all services (Laravel, Node.js, etc.) use the same context format. In Laravel, rely on middleware to inject headers; in other services, manually set `X-Request-ID` or similar.