From 01a0cd22fe4f8d611d79df419ade149856e404e2 Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Thu, 27 Nov 2025 17:12:33 +0100 Subject: [PATCH 1/3] Flush Metrics --- composer.json | 2 +- src/Sentry/Laravel/Integration.php | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 592bbd4c..d24769f4 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require": { "php": "^7.2 | ^8.0", "illuminate/support": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0 | ^12.0", - "sentry/sentry": "^4.18.0", + "sentry/sentry": "^4.19.0", "symfony/psr-http-message-bridge": "^1.0 | ^2.0 | ^6.0 | ^7.0", "nyholm/psr7": "^1.0" }, diff --git a/src/Sentry/Laravel/Integration.php b/src/Sentry/Laravel/Integration.php index cae1cc2d..d2e71e46 100644 --- a/src/Sentry/Laravel/Integration.php +++ b/src/Sentry/Laravel/Integration.php @@ -9,6 +9,7 @@ use Sentry\ExceptionMechanism; use Sentry\Laravel\Integration\ModelViolations as ModelViolationReports; use Sentry\Logs\Logs; +use Sentry\Metrics\TraceMetrics; use Sentry\SentrySdk; use Sentry\Tracing\TransactionSource; use Throwable; @@ -123,6 +124,7 @@ public static function flushEvents(): void $client->flush(); Logs::getInstance()->flush(); + TraceMetrics::getInstance()->flush(); } } @@ -197,8 +199,8 @@ public static function sentryTracingMeta(): string /** * Retrieve the `traceparent` meta tag with tracing information to link this request to front-end requests. * - * @deprecated since version 4.14. To be removed in version 5.0. * @return string + * @deprecated since version 4.14. To be removed in version 5.0. */ public static function sentryW3CTracingMeta(): string { @@ -242,9 +244,9 @@ public static function captureUnhandledException(Throwable $throwable): ?EventId /** * Returns a callback that can be passed to `Model::handleMissingAttributeViolationUsing` to report missing attribute violations to Sentry. * - * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. - * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. - * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. + * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. + * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. + * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. * * @return callable */ @@ -256,9 +258,9 @@ public static function missingAttributeViolationReporter(?callable $callback = n /** * Returns a callback that can be passed to `Model::handleLazyLoadingViolationUsing` to report lazy loading violations to Sentry. * - * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. - * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. - * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. + * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. + * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. + * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. * * @return callable */ @@ -270,9 +272,9 @@ public static function lazyLoadingViolationReporter(?callable $callback = null, /** * Returns a callback that can be passed to `Model::handleDiscardedAttributeViolationUsing` to report discarded attribute violations to Sentry. * - * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. - * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. - * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. + * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. + * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. + * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. * * @return callable */ From 6aa97e71013ae849a4c9e5213c9ac20350ad5e87 Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Tue, 2 Dec 2025 10:52:38 +0100 Subject: [PATCH 2/3] Revert "Flush Metrics" This reverts commit 01a0cd22fe4f8d611d79df419ade149856e404e2. --- composer.json | 2 +- src/Sentry/Laravel/Integration.php | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index d24769f4..592bbd4c 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require": { "php": "^7.2 | ^8.0", "illuminate/support": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0 | ^12.0", - "sentry/sentry": "^4.19.0", + "sentry/sentry": "^4.18.0", "symfony/psr-http-message-bridge": "^1.0 | ^2.0 | ^6.0 | ^7.0", "nyholm/psr7": "^1.0" }, diff --git a/src/Sentry/Laravel/Integration.php b/src/Sentry/Laravel/Integration.php index d2e71e46..cae1cc2d 100644 --- a/src/Sentry/Laravel/Integration.php +++ b/src/Sentry/Laravel/Integration.php @@ -9,7 +9,6 @@ use Sentry\ExceptionMechanism; use Sentry\Laravel\Integration\ModelViolations as ModelViolationReports; use Sentry\Logs\Logs; -use Sentry\Metrics\TraceMetrics; use Sentry\SentrySdk; use Sentry\Tracing\TransactionSource; use Throwable; @@ -124,7 +123,6 @@ public static function flushEvents(): void $client->flush(); Logs::getInstance()->flush(); - TraceMetrics::getInstance()->flush(); } } @@ -199,8 +197,8 @@ public static function sentryTracingMeta(): string /** * Retrieve the `traceparent` meta tag with tracing information to link this request to front-end requests. * - * @return string * @deprecated since version 4.14. To be removed in version 5.0. + * @return string */ public static function sentryW3CTracingMeta(): string { @@ -244,9 +242,9 @@ public static function captureUnhandledException(Throwable $throwable): ?EventId /** * Returns a callback that can be passed to `Model::handleMissingAttributeViolationUsing` to report missing attribute violations to Sentry. * - * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. - * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. - * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. + * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. + * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. + * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. * * @return callable */ @@ -258,9 +256,9 @@ public static function missingAttributeViolationReporter(?callable $callback = n /** * Returns a callback that can be passed to `Model::handleLazyLoadingViolationUsing` to report lazy loading violations to Sentry. * - * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. - * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. - * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. + * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. + * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. + * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. * * @return callable */ @@ -272,9 +270,9 @@ public static function lazyLoadingViolationReporter(?callable $callback = null, /** * Returns a callback that can be passed to `Model::handleDiscardedAttributeViolationUsing` to report discarded attribute violations to Sentry. * - * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. - * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. - * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. + * @param callable|null $callback Optional callback to be called after the violation is reported to Sentry. + * @param bool $suppressDuplicateReports Whether to suppress duplicate reports of the same violation. + * @param bool $reportAfterResponse Whether to delay sending the report to after the response has been sent. * * @return callable */ From ac1ddc4a6e172547cad96ba37164368a9cbc0079 Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Tue, 2 Dec 2025 10:53:09 +0100 Subject: [PATCH 3/3] Reapply "Flush Metrics" This reverts commit 6aa97e71013ae849a4c9e5213c9ac20350ad5e87. --- composer.json | 2 +- src/Sentry/Laravel/Integration.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 592bbd4c..d24769f4 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require": { "php": "^7.2 | ^8.0", "illuminate/support": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0 | ^12.0", - "sentry/sentry": "^4.18.0", + "sentry/sentry": "^4.19.0", "symfony/psr-http-message-bridge": "^1.0 | ^2.0 | ^6.0 | ^7.0", "nyholm/psr7": "^1.0" }, diff --git a/src/Sentry/Laravel/Integration.php b/src/Sentry/Laravel/Integration.php index cae1cc2d..6b3dde65 100644 --- a/src/Sentry/Laravel/Integration.php +++ b/src/Sentry/Laravel/Integration.php @@ -9,6 +9,7 @@ use Sentry\ExceptionMechanism; use Sentry\Laravel\Integration\ModelViolations as ModelViolationReports; use Sentry\Logs\Logs; +use Sentry\Metrics\TraceMetrics; use Sentry\SentrySdk; use Sentry\Tracing\TransactionSource; use Throwable; @@ -123,6 +124,7 @@ public static function flushEvents(): void $client->flush(); Logs::getInstance()->flush(); + TraceMetrics::getInstance()->flush(); } }