feat(monitoring): integrate sentry with tenant context and gitea actions
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 48s

This commit is contained in:
Cauê Faleiros
2026-02-18 09:55:41 -03:00
parent 4a59246398
commit 79ee93d48c
7 changed files with 664 additions and 435 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Sentry\Laravel\Integration;
use Throwable;
class Handler extends ExceptionHandler
@@ -24,7 +25,7 @@ class Handler extends ExceptionHandler
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
Integration::captureUnhandledException($e);
});
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Sentry\State\Scope;
class AppServiceProvider extends ServiceProvider
{
@@ -26,6 +27,18 @@ class AppServiceProvider extends ServiceProvider
{
Schema::defaultStringLength(191);
if (function_exists('tenant')) {
\Sentry\configureScope(function (Scope $scope): void {
if (tenant('id')) {
$scope->setTag('tenant_id', tenant('id'));
$scope->setContext('tenant', [
'id' => tenant('id'),
'data' => tenant()->toArray(),
]);
}
});
}
$this->overrideCoreConfigDefaults();
}