more error tracking
This commit is contained in:
parent
7636b8a022
commit
44cb364bf6
@ -17,6 +17,7 @@ class Sentry
|
|||||||
'company_id' => (string) company_id(),
|
'company_id' => (string) company_id(),
|
||||||
'locale' => (string) app()->getLocale(),
|
'locale' => (string) app()->getLocale(),
|
||||||
'timezone' => (string) config('app.timezone'),
|
'timezone' => (string) config('app.timezone'),
|
||||||
|
'app_type' => (string) static::getAppType(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
@ -24,14 +25,14 @@ class Sentry
|
|||||||
|
|
||||||
public static function tracesSampler(SamplingContext $context): float
|
public static function tracesSampler(SamplingContext $context): float
|
||||||
{
|
{
|
||||||
if (static::filterAgent()) {
|
if (static::shouldFilterAgent()) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return config('sentry.traces_sample_rate');
|
return config('sentry.traces_sample_rate');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function filterAgent(): bool
|
public static function shouldFilterAgent(): bool
|
||||||
{
|
{
|
||||||
$user_agent = request()->userAgent();
|
$user_agent = request()->userAgent();
|
||||||
|
|
||||||
@ -47,4 +48,23 @@ class Sentry
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getAppType()
|
||||||
|
{
|
||||||
|
$hostname = gethostname();
|
||||||
|
|
||||||
|
if (Str::contains($hostname, '-queue-')) {
|
||||||
|
$app_type = 'queue';
|
||||||
|
} elseif (Str::contains($hostname, '-cron-')) {
|
||||||
|
$app_type = 'cron';
|
||||||
|
} elseif (request()->isApi()) {
|
||||||
|
$app_type = 'api';
|
||||||
|
} elseif (app()->runningInConsole()) {
|
||||||
|
$app_type = 'console';
|
||||||
|
} else {
|
||||||
|
$app_type = 'ui';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $app_type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ return [
|
|||||||
// @see: https://docs.sentry.io/platforms/php/configuration/options/#send-default-pii
|
// @see: https://docs.sentry.io/platforms/php/configuration/options/#send-default-pii
|
||||||
'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', true),
|
'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', true),
|
||||||
|
|
||||||
'traces_sample_rate' => (float)(env('SENTRY_TRACES_SAMPLE_RATE', 1.0)),
|
'traces_sample_rate' => (float)(env('SENTRY_TRACES_SAMPLE_RATE', 0.0)),
|
||||||
|
|
||||||
'controllers_base_namespace' => env('SENTRY_CONTROLLERS_BASE_NAMESPACE', 'App\\Http\\Controllers'),
|
'controllers_base_namespace' => env('SENTRY_CONTROLLERS_BASE_NAMESPACE', 'App\\Http\\Controllers'),
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user