select('queue', DB::raw('count(*) as total')) ->groupBy('queue') ->get(); // Average Duration from Telescope $averageDurations = []; $processedCounts = []; $globalAvgDuration = 0; try { // Check if telescope_entries exists $entries = DB::table('telescope_entries') ->where('type', 'job') ->where('created_at', '>', now()->subHours(24)) ->orderBy('created_at', 'desc') ->limit(500) ->get(); $durations = []; foreach($entries as $entry) { $content = json_decode($entry->content, true); // Telescope content for jobs usually contains 'data' object which has 'queue' // But for finished jobs, the top level content might have 'queue' and 'duration' // We'll check both locations to be safe $queue = $content['queue'] ?? $content['data']['queue'] ?? 'default'; $duration = $content['duration'] ?? null; if($duration !== null) { if(!isset($durations[$queue])) { $durations[$queue] = []; } $durations[$queue][] = $duration; if(!isset($processedCounts[$queue])) $processedCounts[$queue] = 0; $processedCounts[$queue]++; } } $totalDuration = 0; $totalCount = 0; foreach($durations as $queue => $times) { $count = count($times); $sum = array_sum($times); $totalCount += $count; $totalDuration += $sum; $avg = $count > 0 ? $sum / $count : 0; $averageDurations[$queue] = round($avg, 2); } $globalAvgDuration = $totalCount > 0 ? round($totalDuration / $totalCount, 2) : 0; } catch (\Exception $e) { // Telescope table might be missing } ?> whereNull('reserved_at')->count(); $active = DB::table('jobs')->whereNotNull('reserved_at')->count(); $failed = DB::table('failed_jobs')->count(); $totalWork = $processed + $pending + $active + $failed; $processedPerc = $totalWork > 0 ? ($processed / $totalWork) * 100 : 0; $activePerc = $totalWork > 0 ? ($active / $totalWork) * 100 : 0; $pendingPerc = $totalWork > 0 ? ($pending / $totalWork) * 100 : 0; $failedPerc = $totalWork > 0 ? ($failed / $totalWork) * 100 : 0; ?> @if($totalWork > 0)

Overall Queue Progress

@if($globalAvgDuration > 0) Average: {{ $globalAvgDuration }} ms @endif {{ round($processedPerc) }}% Completed
@if($processedPerc > 5) {{ round($processedPerc) }}% @endif
@if($activePerc > 5) {{ round($activePerc) }}% @endif
@if($pendingPerc > 5) {{ round($pendingPerc) }}% @endif
@if($failedPerc > 5) {{ round($failedPerc) }}% @endif
Processed ({{$processed}})
Active ({{$active}})
Pending ({{$pending}})
Failed ({{$failed}})
@endif
{{ $pending }}
Pending Jobs
{{ $active }}
Active Jobs
{{ DB::table('failed_jobs')->count() }}
Failed Jobs
{{ $pending + $active }}
Total In Queue

Queue Detailed Metrics

@php // Merge all queues found in waiting and history $allQueues = $queueCounts->pluck('queue')->toArray(); $allQueues = array_unique(array_merge($allQueues, array_keys($averageDurations))); @endphp @forelse($allQueues as $queue) @php $waiting = $queueCounts->where('queue', $queue)->first()->total ?? 0; $avgDuration = $averageDurations[$queue] ?? '-'; $processed = $processedCounts[$queue] ?? 0; $statusColor = $waiting > 100 ? 'danger' : ($waiting > 10 ? 'warning' : 'success'); @endphp @empty @endforelse
Queue Name Waiting Processes Processed (Last 500 Jobs) Avg Duration (ms) Status
{{ $queue }} {{ $waiting }} {{ $processed }} {{ $avgDuration }} @if($waiting > 0) Processing @else Idle @endif
No queue activity found.

Recent Failed Jobs

@php $failedJobs = DB::table('failed_jobs')->orderBy('failed_at', 'desc')->limit(10)->get(); @endphp @forelse($failedJobs as $job) @empty @endforelse
Date Connection Queue Exception
{{ $job->failed_at }} {{ $job->connection }} {{ $job->queue }} {{ substr($job->exception, 0, 150) }}...

No failed jobs found. System is healthy.