- 基础环境:Docker 部署配置,源码挂载实时同步 - 修复:super_admin 权限补全、登录重定向循环 - 开发:店铺营销账户账单 - 抖音账户(15字段汇总账单) - 开发:店铺营销账户账单 - 淘系支付宝账户(8字段流水账单) - 开发:店铺营销账户账单 - 拼多多账户(7字段流水账单) - 业务页面导航集成:config/business_navigation.php + Business\Pages 控制器 - 各平台独立表结构和视图,互不影响
67 lines
1.4 KiB
PHP
67 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Exceptions\Trackers;
|
|
|
|
use Akaunting\Version\Version;
|
|
use App\Traits\Trackers as Base;
|
|
use Illuminate\Support\Str;
|
|
use Sentry\Event;
|
|
use Sentry\EventHint;
|
|
use Sentry\Logs\Log;
|
|
use Sentry\Tracing\SamplingContext;
|
|
|
|
class Sentry
|
|
{
|
|
use Base;
|
|
|
|
public static function beforeSend(Event $event, ?EventHint $hint): ?Event
|
|
{
|
|
$event->setRelease(Version::short());
|
|
|
|
$tags = static::getTrackerTags();
|
|
|
|
$event->setTags($tags);
|
|
|
|
return $event;
|
|
}
|
|
|
|
public static function beforeSendLog(Log $log): ?Log
|
|
{
|
|
$log->setAttribute('release', Version::short());
|
|
|
|
$tags = static::getTrackerTags();
|
|
|
|
foreach ($tags as $key => $value) {
|
|
$log->setAttribute($key, $value);
|
|
}
|
|
|
|
return $log;
|
|
}
|
|
|
|
public static function tracesSampler(SamplingContext $context): float
|
|
{
|
|
if (static::shouldFilterAgent()) {
|
|
return 0.0;
|
|
}
|
|
|
|
return config('sentry.traces_sample_rate');
|
|
}
|
|
|
|
public static function shouldFilterAgent(): bool
|
|
{
|
|
$user_agent = request()->userAgent();
|
|
|
|
$filter_agents = explode(',', env('SENTRY_TRACES_FILTER_AGENTS'));
|
|
|
|
foreach ($filter_agents as $filter_agent) {
|
|
if (! Str::contains($user_agent, $filter_agent)) {
|
|
continue;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|