@extends('layouts.app') @section('title', 'Locust 報告 — ' . $locustResult->school_name) @section('content')

{{ $locustResult->school_name }} 已完成

返回清單 @if($locustResult->report_path && file_exists(public_path($locustResult->report_path))) 完整 HTML 報告 @endif @can('module-admin', 'K6TestController') 編輯 @endcan
{{-- ── 測試概覽 ── --}} @php $s = $locustResult->result_summary ?? []; $failRate = ($s['total_requests'] ?? 0) > 0 ? round(($s['total_failures'] ?? 0) / $s['total_requests'] * 100, 1) : 0; $statusColor = $failRate > 10 ? 'danger' : ($failRate > 0 ? 'warning' : 'success'); @endphp
@php $metricCards = [ ['label'=>'請求總數', 'value'=>number_format($s['total_requests']??0), 'unit'=>'次', 'color'=>'primary', 'icon'=>'bi-send'], ['label'=>'失敗數', 'value'=>number_format($s['total_failures']??0), 'unit'=>'次', 'color'=>'danger', 'icon'=>'bi-x-circle'], ['label'=>'失敗率', 'value'=>$failRate, 'unit'=>'%', 'color'=>$statusColor,'icon'=>'bi-percent'], ['label'=>'平均回應時間', 'value'=>round($s['avg_response']??0), 'unit'=>'ms', 'color'=>'info', 'icon'=>'bi-clock'], ['label'=>'P95 回應時間', 'value'=>round($s['p95_response']??0), 'unit'=>'ms', 'color'=>'warning', 'icon'=>'bi-clock-history'], ['label'=>'每秒請求數', 'value'=>round($s['rps']??0, 1), 'unit'=>'RPS', 'color'=>'success', 'icon'=>'bi-lightning-charge'], ]; @endphp @foreach($metricCards as $mc)
{{ $mc['value'] }} {{ $mc['unit'] }}
{{ $mc['label'] }}
@endforeach
{{-- ── 回應時間分位數 ── --}}
回應時間分佈
@php $percs = [ ['最小值', round($s['min_response']??0)], ['中位數', round($s['med_response']??0)], ['平均值', round($s['avg_response']??0)], ['P90', round($s['p90_response']??0)], ['P95', round($s['p95_response']??0)], ['P99', round($s['p99_response']??0)], ['最大值', round($s['max_response']??0)], ]; $maxVal = max(array_column($percs, 1)) ?: 1; @endphp @foreach($percs as [$label, $val]) @endforeach
{{ $label }}
{{ number_format($val) }} ms
測試設定
測試網址
{{ $locustResult->url }}{{ $locustResult->target_path !== '/' ? $locustResult->target_path : '' }}
虛擬用戶
{{ $locustResult->users }} users({{ $locustResult->spawn_rate }} users/s 生成)
執行時長
{{ $locustResult->duration }}
測試時間
{{ $locustResult->test_time?->format('Y-m-d H:i:s') ?? '—' }}
@if($locustResult->login_path)
登入路徑
{{ $locustResult->login_path }}
@endif
{{-- ── 請求明細表 ── --}} @if(!empty($s['rows']))
各請求端點統計
@foreach($s['rows'] as $row) @endforeach
類型 端點 請求數 失敗數 平均(ms) 中位數(ms) P95(ms) RPS
{{ $row['Type'] ?? '' }} {{ $row['Name'] ?? '' }} {{ number_format($row['Request Count']??0) }} {{ number_format($row['Failure Count']??0) }} {{ round($row['Average Response Time']??0) }} {{ round($row['Median Response Time']??0) }} {{ round($row['95%']??0) }} {{ round($row['Requests/s']??0, 2) }}
@endif {{-- ── 錯誤日誌 ── --}} @if($locustResult->error_log)
執行日誌
{{ $locustResult->error_log }}
@endif
@endsection