Capture additional metrics

This commit is contained in:
David Bomba 2024-05-19 19:42:20 +10:00
parent a1fa52dfd3
commit aaae12e691
3 changed files with 21 additions and 1 deletions

View File

@ -52,6 +52,10 @@ class DbQuery extends GenericMixedMetric
public $string_metric7 = 'ip_address';
public $string_metric8 = 'client_version';
public $string_metric9 = 'platform';
/**
* The counter
* set to 1.

View File

@ -73,7 +73,22 @@ class QueryLogging
$ip = $request->ip();
}
LightLogs::create(new DbQuery($request->method(), substr(urldecode($request->url()), 0, 180), $count, $time, $ip))
$client_version = '';
$platform = '';
if ($request->hasHeader('X-CLIENT-PLATFORM')) {
$platform = $request->header('X-CLIENT-PLATFORM');
}
elseif($request->hasHeader('X-React')){
$platform = 'react';
}
if ($request->hasHeader('X-CLIENT-VERSION'))
{
$client_version = $request->header('X-CLIENT-VERSION');
}
LightLogs::create(new DbQuery($request->method(), substr(urldecode($request->url()), 0, 180), $count, $time, $ip, $client_version, $platform))
->batch();
}

View File

@ -27,6 +27,7 @@ class AccountFactory extends Factory
'default_company_id' => 1,
'key' => Str::random(32),
'report_errors' => 1,
'referral_code' => Str::lower(Str::random(32)),
];
}
}