Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117723600
D2605.1774890344.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D2605.1774890344.diff
View Options
diff --git a/src/.env.example b/src/.env.example
--- a/src/.env.example
+++ b/src/.env.example
@@ -16,6 +16,7 @@
SUPPORT_EMAIL=
LOG_CHANNEL=stack
+LOG_SLOW_REQUESTS=5
DB_CONNECTION=mysql
DB_DATABASE=kolabdev
diff --git a/src/app/Http/Middleware/RequestLogger.php b/src/app/Http/Middleware/RequestLogger.php
--- a/src/app/Http/Middleware/RequestLogger.php
+++ b/src/app/Http/Middleware/RequestLogger.php
@@ -26,6 +26,13 @@
$time = microtime(true) - self::$start;
\Log::debug(sprintf("C: %s %s [%sM]: %.4f sec.", $method, $url, $mem, $time));
+ } else {
+ $threshold = \config('logging.slow_log');
+ if ($threshold && ($time = microtime(true) - self::$start) > $threshold) {
+ $url = $request->fullUrl();
+ $method = $request->getMethod();
+ \Log::warning(sprintf("[STATS] %s %s: %.4f sec.", $method, $url, $time));
+ }
}
}
}
diff --git a/src/app/OpenVidu/Room.php b/src/app/OpenVidu/Room.php
--- a/src/app/OpenVidu/Room.php
+++ b/src/app/OpenVidu/Room.php
@@ -58,7 +58,15 @@
'auth' => [
\config('openvidu.api_username'),
\config('openvidu.api_password')
- ]
+ ],
+ 'on_stats' => function (\GuzzleHttp\TransferStats $stats) {
+ $threshold = \config('logging.slow_log');
+ if ($threshold && ($sec = $stats->getTransferTime()) > $threshold) {
+ $url = $stats->getEffectiveUri();
+ $method = $stats->getRequest()->getMethod();
+ \Log::warning(sprintf("[STATS] %s %s: %.4f sec.", $method, $url, $sec));
+ }
+ },
]
);
}
diff --git a/src/config/logging.php b/src/config/logging.php
--- a/src/config/logging.php
+++ b/src/config/logging.php
@@ -91,4 +91,6 @@
],
],
+ 'slow_log' => (float) env('LOG_SLOW_REQUESTS', 5),
+
];
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 30, 5:05 PM (3 d, 56 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18817821
Default Alt Text
D2605.1774890344.diff (2 KB)
Attached To
Mode
D2605: Add slow requests log
Attached
Detach File
Event Timeline