- How do I install and set up leventcz/laravel-top for Laravel 13.x/Octane?
- Run `composer require leventcz/laravel-top` to install. Publish the config with `php artisan vendor:publish --tag=top` and ensure your `config/database.php` has a valid Redis connection. The package requires PHP 8.2+ and Redis 5.0+, and is officially compatible with Laravel 10+ and Octane.
- Does leventcz/laravel-top support Laravel Octane’s event loop and async workers?
- The package is compatible with Octane but lacks explicit testing for its event loop or async workers. It assumes traditional request lifecycles, so behavior in high-concurrency Octane environments may vary. Test under load to validate metrics accuracy for async contexts.
- What metrics does leventcz/laravel-top track, and are queues/commands included?
- The package monitors HTTP request metrics like busiest routes, response times, and server-wide performance. It does **not** track queues, CLI commands, or background jobs—only events from incoming requests. For non-HTTP workloads, consider alternatives like Laravel Horizon or Sentry.
- How does Redis storage work, and what’s the TTL for aggregated data?
- Metrics are stored in Redis with a **short TTL (5-second aggregation window)** to avoid historical bloat. Data is auto-cleaned, but high request volumes (>5k RPS) may require Redis tuning (e.g., pipelining, `maxmemory-policy`). The package assumes Redis is available; downtime handling is undocumented.
- Can I use leventcz/laravel-top in a multi-server Laravel deployment?
- Yes, the package aggregates data across all servers via Redis. However, it assumes a single Redis instance and lacks distributed tracing. For multi-server setups, ensure Redis is properly configured for high throughput and test for contention under load.
- What happens if Redis fails while leventcz/laravel-top is running?
- The package has **no documented fallback** for Redis failures. If Redis is unavailable, it may crash or silently degrade. For production, implement Redis resilience (e.g., retries, circuit breakers) or use a secondary Redis instance for monitoring.
- Is leventcz/laravel-top safe for production, and are there memory leaks?
- The package is designed for production but lacks benchmarks for Laravel 13.x/Octane. No memory leaks are documented, but the event listener’s behavior in long-running requests or Octane’s concurrent workers is untested. Monitor Redis memory usage and test under load.
- How do I customize or extend leventcz/laravel-top’s metrics?
- Use the facade API (`Top::http()`, `Top::routes()`) to programmatically access metrics. Publish the config to adjust Redis settings or event listeners. For custom metrics, extend the event listener or integrate with Laravel’s `events` system, but note the package only tracks HTTP events.
- Are there alternatives to leventcz/laravel-top for Laravel monitoring?
- For HTTP metrics, consider **Laravel Debugbar**, **Telescope**, or **Sentry**. For queues/commands, use **Horizon** or **Laravel Scout**. For distributed tracing, **OpenTelemetry** or **Datadog** are better suited. Unlike this package, alternatives often support long-term storage and non-HTTP workloads.
- How do I test leventcz/laravel-top in CI/CD or staging environments?
- Run `php artisan top` manually or automate it in CI with `php artisan top --no-interaction`. Mock Redis in tests using Laravel’s `RedisFake` or a local Redis instance. Validate metrics against known traffic patterns, but note the package’s limited testing for Laravel 13.x/Octane edge cases.