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)
| 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. | ||||
| Date | Connection | Queue | Exception |
|---|---|---|---|
| {{ $job->failed_at }} | {{ $job->connection }} | {{ $job->queue }} | {{ substr($job->exception, 0, 150) }}... |
|
No failed jobs found. System is healthy. |
|||