我做了中间件设置登录用户的自定义标记,我想自定义事件ID中的标记用于性能监控。但这是不工作的,我我错过了什么??需要帮助...
<?php
namespace App\Http\Middleware;
use Auth;
use Closure;
use Sentry\State\Scope;
class SentryUser
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if(Auth::check() && app()->bound('sentry'))
{
\Sentry\configureScope(function (Scope $scope): void {
$scope->setTag([
'id' => Auth::user()->id,
'email' => Auth::user()->email,
'name' => Auth::user()->name,
]);
});
}
return $next($request);
}
}
1条答案
按热度按时间v1uwarro1#
您是否尝试过setTags而不是setTag?