FEATURE #2389 @2h: group http request by url

This commit is contained in:
Michal Kváček
2017-03-28 00:27:31 +02:00
parent 848fa7b7cb
commit aa55ffe46a
6 changed files with 127 additions and 25 deletions
+25 -9
View File
@@ -2,24 +2,40 @@
return [
'name' => 'Profiler',
'index' => [
'createdAt' => 'Datum',
'httpMethod' => 'HTTP metoda',
'url' => 'URL',
'time' => 'Čas',
'systemLoad' => 'Load serveru'
'createdAt' => 'Datum',
'httpMethod' => 'HTTP metoda',
'url' => 'URL',
'time' => 'Čas',
'timeAvg' => 'Průměrný čas',
'timeMin' => 'Minimální čas',
'timeMax' => 'Maximální čas',
'systemLoad' => 'Load serveru',
'calledTotal' => 'Volání',
'pastDays' => [
'today' => 'Dnes',
'overall' => 'Vše',
'days' => '1 den|:count dny|:count dní'
]
],
'settings' => [
'useProfilerInVisitorArea' => 'Zapnout měření ve veřejné části?',
'useProfilerInAdmin' => 'Zapnout měření v administraci?'
],
'request' => [
'info' => 'Detaily requestu',
'sql' => 'SQL dotazy',
'detail' => 'Detail požadavku',
'info' => 'Detaily requestu',
'sql' => 'SQL dotazy',
'detail' => 'Detail požadavku',
'sameRequests' => 'Ostatní volání'
],
'graphs' => [
'responseTime' => 'Doba odezvy'
]
],
'queries' => [
'sql' => 'SQL dotaz',
'time' => 'Čas dotazu'
],
'listDescription' => 'Seznam HTTP požadavků na tuto aplikaci.',
'groupedListDescription' => 'Seznam HTTP požadavků na tuto aplikaci.',
'requestDetail' => 'Detail HTTP požadavku'
];
@@ -0,0 +1,27 @@
<table class="item-list content-overview full-width table striped">
<thead>
<tr>
<td>@lang('profiler::module.index.calledTotal')</td>
<td>@lang('profiler::module.index.httpMethod')</td>
<td>@lang('profiler::module.index.url')</td>
<td>@lang('profiler::module.index.timeAvg')</td>
<td></td>
</tr>
</thead>
<tbody>
@foreach($requests as $request)
<tr>
<td>{{$request->total}}</td>
<td><a href="{{route('profiler.index', ['method' => $request->method])}}">{{$request->method}}</a></td>
<td><a href="{{route('profiler.index', ['url' => $request->url])}}">{{$request->url}}</a></td>
<td>{{number_format($request->time_avg, 2)}} ms</td>
<td>
<a href="{{route('request.detail', ['httpLog' => $request])}}" data-toggle="tooltip"
title="@lang('profiler::module.request.info')">
<i class="fa fa-info"></i>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@@ -2,14 +2,43 @@
@section('pageHeading', trans('profiler::module.name'))
@section('headerButtons')
@if($displayGrouped == false)
<a class="btn btn-sm rounded btn-primary" href="{{route('profiler.index')}}"><i class="fa fa-list"></i></a>
@endif
<div class="pull-right">
@foreach(['0' => 'today', '7' => 'days', '30' => 'days', 'inf' => 'overall'] as $pastDay => $name)
@php $filter['pastDays'] = $pastDay; @endphp
<a class="btn btn-sm rounded @if($pastDays === (string)$pastDay) btn-primary @else btn-secondary @endif"
href="{{route('profiler.index', $filter)}}">{{trans_choice('profiler::module.index.pastDays.'.$name, $pastDay)}}</a>
@endforeach
</div>
@endsection
@if($displayGrouped == false)
@section('pageDescription', trans('profiler::module.listDescription'))
@else
@section('pageDescription', trans('profiler::module.groupedListDescription'))
@endif
@section('content')
<div class="card">
<div class="card-block">
@include('profiler::_partials.requestList', ['requests' => $httpLog])
@if ($displayGrouped == true)
@include('profiler::_partials.groupedRequestList', ['requests' => $httpLog])
@else
@include('profiler::_partials.requestList', ['requests' => $httpLog])
@endif
</div>
<div class="card-footer">
{!! $httpLog->render() !!}
</div>
</div>
@stop
@endsection
@@ -22,7 +22,11 @@
<td>
@php $sql = $query->query; @endphp
@foreach($query->bindings as $value)
@php $sql = preg_replace('/\?/', $value, $sql, 1); @endphp
@php
if (is_array($value) && isset($value['date']))
{$value = \Carbon\Carbon::parse($value['date'])->toDateTimeString();}
$sql = preg_replace('/\?/', $value, $sql, 1);
@endphp
@endforeach
{{$sql}}
@@ -1,6 +1,11 @@
@extends('admin.layoutWithNavigation')
@section('pageHeading', trans('profiler::module.name'))
@section('pageHeading', trans('profiler::module.requestDetail'))
@section('headerButtons')
<a class="btn btn-sm rounded btn-primary" href="{{route('profiler.index')}}"><i class="fa fa-list"></i></a>
@endsection
@section('content')
@@ -17,20 +22,25 @@
<div class="row">
<ul>
<li>@lang('profiler::module.index.httpMethod'): {{$httpLog->method}}</li>
<li>@lang('profiler::module.index.url'): <a href="{{route('profiler.index', ['url' => $httpLog->url])}}">{{$httpLog->url}}</a></li>
<li>@lang('profiler::module.index.time'): {{number_format($httpLog->time, 2)}}</li>
<li>@lang('profiler::module.index.url'): <a
href="{{route('profiler.index', ['url' => $httpLog->url])}}">{{$httpLog->url}}</a>
</li>
<li>@lang('profiler::module.index.time'): {{number_format($httpLog->time, 2)}} ms</li>
<li>@lang('profiler::module.index.systemLoad'): {{$httpLog->load_1}}, {{$httpLog->load_5}}
, {{$httpLog->load_15}}</li>
</ul>
</div>
<div class="row text-center">
<div class="col-sm-3"><h3>{{count($sameRequests)}} &times;</h3> volano</div>
<div class="col-sm-3"><h3>{{number_format($times['min'], 2)}} ms</h3> min</div>
<div class="col-sm-3"><h3>{{number_format($times['max'], 2)}} ms</h3> max</div>
<div class="col-sm-3"><h3>{{number_format($times['avg'], 2)}} ms</h3> prumer</div>
<div class="col-sm-3"><h5>
{{count($sameRequests)}} &times;</h5> @lang('profiler::module.index.calledTotal')</div>
<div class="col-sm-3"><h5>{{number_format($times['min'], 2)}}
ms</h5> @lang('profiler::module.index.timeMin')</div>
<div class="col-sm-3"><h5>{{number_format($times['max'], 2)}}
ms</h5> @lang('profiler::module.index.timeMax')</div>
<div class="col-sm-3"><h5>{{number_format($times['avg'], 2)}}
ms</h5> @lang('profiler::module.index.timeAvg')</div>
</div>
</div>
</div>
</div>