@@ -26,7 +26,7 @@ public function handle($request, Closure $next)
26
26
27
27
\DB ::listen (function ($ query ) {
28
28
$ this ->queriesCount ++;
29
- if ($ query ->time > config ('slow-query-detector .query.max_time ' )) {
29
+ if ($ query ->time > config ('sqd .query.max_time ' )) {
30
30
$ this ->heavyQueryCount ++;
31
31
if ($ query ->time > $ this ->heaviestQueryTime ) {
32
32
$ this ->heaviestQueryTime = $ query ->time ;
@@ -48,29 +48,33 @@ public function handle($request, Closure $next)
48
48
49
49
protected function needNotify ()
50
50
{
51
- return $ this ->queriesCount > config ('slow-query-detector .code.max_queries ' )
52
- || $ this ->executionTime > config ('slow-query-detector .code.max_time ' )
53
- || $ this ->heaviestQueryTime > config ('slow-query-detector .query.max_time ' );
51
+ return $ this ->queriesCount > config ('sqd .code.max_queries ' )
52
+ || $ this ->executionTime > config ('sqd .code.max_time ' )
53
+ || $ this ->heaviestQueryTime > config ('sqd .query.max_time ' );
54
54
}
55
55
56
56
protected function notify ($ request )
57
57
{
58
- app ('log ' )->critical (print_r ([
59
- 'Execution Time ' => $ this ->executionTime ,
60
- 'Queries Count ' => $ this ->queriesCount ,
61
- 'Heavy Queries Count ' => $ this ->heavyQueryCount ,
62
- 'Full URL ' => $ request ->fullUrl (),
63
- 'Action ' => $ request ->route ()->getActionName (),
64
- 'Heaviest Query ' => [
65
- 'Query ' => $ this ->heaviestQuery ,
66
- 'Time ' => $ this ->heaviestQueryTime ,
58
+ $ data = [
59
+ 'SQD ' => [
60
+ 'Execution Time ' => $ this ->executionTime . ' ms. ' ,
61
+ 'Queries Count ' => $ this ->queriesCount ,
62
+ 'Heavy Queries Count ' => $ this ->heavyQueryCount ,
63
+ 'Full URL ' => $ request ->fullUrl (),
64
+ 'Action ' => $ request ->route ()->getActionName (),
65
+ 'Heaviest Query ' => [
66
+ 'Query ' => $ this ->heaviestQuery ,
67
+ 'Time ' => $ this ->heaviestQueryTime . ' ms. ' ,
68
+ ]
67
69
]
68
- ], true ));
70
+ ];
71
+
72
+ app ('log ' )->critical (print_r ($ data , true ));
69
73
}
70
74
71
75
protected function getQuery ($ query )
72
76
{
73
- return config ('slow-query-detector .query.with_bindings ' )
77
+ return config ('sqd .query.with_bindings ' )
74
78
? Str::replaceArray ('? ' , $ query ->bindings , $ query ->sql )
75
79
: $ query ->sql ;
76
80
}
0 commit comments