mercredi 9 décembre 2020

Allow Only Api's performance Transaction in sentry.io laravel

Allow only API's performance transaction in sentry.io

SentryContext.php

public function handle($request, Closure $next)
    {
        if (auth()->check() && app()->bound('sentry')) {
            \Sentry\configureScope(function (Scope $scope)use ($request): void {
                $scope->setUser([
                    'id' => auth()->user()->id,
                    'email' => auth()->user()->email,
                ]);
            });
        }        
        return $next($request);
    }

Kernal.php

protected $middlewareGroups = [
        'api' => [
             \App\Http\Middleware\SentryContext::class,
        ]
    ];

Using this Code unable to API performance transaction, only need API's Transaction in sentry.io



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire