SSR cockpit: label the response time, leave test reports out of the client error counts (0114-FE)
The big response time number is labelled last check. ClientErrorClassifier tells smoke and curl test reports and bot reports apart; tests are counted separately and left out of the tile, the hourly bars, the list and the dashboard tile, bots keep a label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4bc38b1760
commit
06b9bc8293
5 files changed
+125
-41
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Evomedien\Vitec\Service;
|
||||
|
||||
/**
|
||||
* Tells test reports and bot reports in tx_vitec_clienterrorlog apart
|
||||
* from real visitor errors (ticket 0114-FE: the cockpit tile must not
|
||||
* count smoke tests). One rule set for the module and the dashboard.
|
||||
*
|
||||
* Test: sent with curl, a user agent that says "smoke" or "client-error
|
||||
* test", a message starting with "test", or the dummy release "t" of the
|
||||
* endpoint smoke test. Bot: a crawler user agent (Googlebot & Co.); bot
|
||||
* reports stay real errors, they only get a label.
|
||||
*/
|
||||
final class ClientErrorClassifier
|
||||
{
|
||||
public static function isTest(string $message, string $userAgent, string $release = ''): bool
|
||||
{
|
||||
if ($release === 't') {
|
||||
return true;
|
||||
}
|
||||
if (preg_match('#curl/|smoke|client-error test#i', $userAgent) === 1) {
|
||||
return true;
|
||||
}
|
||||
return preg_match('#^\s*test\b#i', $message) === 1;
|
||||
}
|
||||
|
||||
public static function isBot(string $userAgent): bool
|
||||
{
|
||||
return preg_match('#bot\b|crawler|spider|slurp|lighthouse|headlesschrome#i', $userAgent) === 1;
|
||||
}
|
||||
|
||||
public static function isChunkReload(string $message): bool
|
||||
{
|
||||
return str_contains(strtolower($message), 'chunk reload');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user