diff --git a/src/sentry/src/Aspect/SingletonAspect.php b/src/sentry/src/Aspect/SingletonAspect.php index 089e2a86c..d64e5c2c8 100644 --- a/src/sentry/src/Aspect/SingletonAspect.php +++ b/src/sentry/src/Aspect/SingletonAspect.php @@ -22,6 +22,7 @@ class SingletonAspect extends AbstractAspect // Singleton Classes \Sentry\State\HubAdapter::class . '::getInstance', \Sentry\Integration\IntegrationRegistry::class . '::getInstance', + \Sentry\Logs\Logs::class . '::getInstance', \Sentry\Metrics\TraceMetrics::class . '::getInstance', // Enums // \Sentry\CheckInStatus::class . '::getInstance', @@ -46,7 +47,8 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) return match ($className) { // Singleton Classes \Sentry\State\HubAdapter::class, - \Sentry\Integration\IntegrationRegistry::class => Context::getOrSet($key, function () use ($className) { + \Sentry\Integration\IntegrationRegistry::class, + \Sentry\Logs\Logs::class => Context::getOrSet($key, function () use ($className) { return Closure::bind(fn () => new $className(), null, $className)(); }), \Sentry\Metrics\TraceMetrics::class => Context::getOrSet($key, function () use ($className) { diff --git a/src/sentry/src/Integration.php b/src/sentry/src/Integration.php index e26f0e80e..4dff02b2e 100644 --- a/src/sentry/src/Integration.php +++ b/src/sentry/src/Integration.php @@ -106,14 +106,9 @@ public static function setTransaction(?string $transaction): void */ public static function flushEvents(): void { - $client = SentrySdk::getCurrentHub()->getClient(); - - if ($client !== null) { - $client->flush(); - - Logs::getInstance()->flush(); - TraceMetrics::getInstance()->flush(); - } + SentrySdk::getCurrentHub()->getClient()?->flush(); + Logs::getInstance()->flush(); + TraceMetrics::getInstance()->flush(); } /**