Skip to content

Commit 149d9e7

Browse files
committed
fix: 修复在处理事件时防止重复度量的逻辑
1 parent e7f9077 commit 149d9e7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/sentry/src/Metrics/Listener/OnBeforeHandle.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use FriendsOfHyperf\Sentry\Constants;
1515
use FriendsOfHyperf\Sentry\Feature;
1616
use FriendsOfHyperf\Sentry\Metrics\Traits\MetricSetter;
17+
use FriendsOfHyperf\Sentry\SentryContext;
1718
use Hyperf\Command\Event\BeforeHandle;
1819
use Hyperf\Coordinator\CoordinatorManager;
1920
use Hyperf\Coordinator\Timer;
@@ -48,6 +49,7 @@ public function process(object $event): void
4849
{
4950
if (
5051
! $event instanceof BeforeHandle
52+
|| SentryContext::getCronCheckInId() // Prevent duplicate metrics in cron job.
5153
|| ! $event->getCommand()->getApplication()->isAutoExitEnabled() // Only enable in the command with auto exit.
5254
|| ! $this->feature->isCommandMetricsEnabled()
5355
) {

0 commit comments

Comments
 (0)