It sounds like you've already done a lot of troubleshooting, which is great. Here are a few additional steps you can take to try to resolve the issue with the duration not showing in Laravel Telescope:
-
Check Telescope Configuration: Ensure that the
telescope.phpconfiguration file is correctly set up in both applications. Specifically, check if there are any differences in thewatchersarray that might affect the recording of request durations.// config/telescope.php 'watchers' => [ Watchers\RequestWatcher::class => [ 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), 'size_limit' => env('TELESCOPE_REQUEST_WATCHER_SIZE_LIMIT', 64), ], // other watchers... ], -
Middleware: Verify that the
TelescopeMiddlewareis correctly applied in both applications. This middleware is responsible for collecting request data.// app/Http/Kernel.php protected $middleware = [ // other middleware... \Laravel\Telescope\Http\Middleware\Authorize::class, ]; -
Database Schema: Ensure that the database schema for the
telescope_entriestable is identical in both applications. Specifically, check that thedurationcolumn exists and is of the correct type.Schema::create('telescope_entries', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('batch_id'); $table->string('family_hash')->nullable(); $table->string('should_display_on_index')->default(true); $table->string('type'); $table->text('content'); $table->unsignedInteger('duration')->nullable(); $table->timestamps(); }); -
Clear Cache: Sometimes, configuration or route caches can cause issues. Clear the caches to ensure that the latest configurations are being used.
php artisan config:cache php artisan route:cache php artisan view:cache php artisan cache:clear -
Update Telescope: Ensure that both applications are using the same version of Laravel Telescope. You can update Telescope using Composer.
composer require laravel/telescope -
Check Telescope Service Provider: Ensure that the
TelescopeServiceProvideris correctly registered in both applications.// app/Providers/TelescopeServiceProvider.php use Laravel\Telescope\Telescope; use Laravel\Telescope\TelescopeApplicationServiceProvider; class TelescopeServiceProvider extends TelescopeApplicationServiceProvider { // ... } -
Debugging: Add some debugging statements in the
TelescopeServiceProviderto log or dump the request data to ensure that the duration is being captured correctly.// app/Providers/TelescopeServiceProvider.php use Laravel\Telescope\IncomingEntry; public function register() { Telescope::filter(function (IncomingEntry $entry) { if ($entry->type === 'request') { \Log::info('Request Duration: ' . $entry->content['duration']); } return true; }); }
By following these steps, you should be able to identify and resolve the issue with the duration not showing in Laravel Telescope. If the problem persists, consider comparing the entire Telescope configuration and setup between the two applications to identify any discrepancies.