Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/sentry/publish/sentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#enable_logs
'enable_logs' => env('SENTRY_ENABLE_LOGS', true),

// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#log_flush_threshold
'log_flush_threshold' => env('SENTRY_LOG_FLUSH_THRESHOLD') === null ? null : (int) env('SENTRY_LOG_FLUSH_THRESHOLD'),

// @see: https://docs.sentry.io/platforms/php/configuration/options/#before_send_log
// 'before_send_log' => function (Sentry\Logs\Log $log): Sentry\Logs\Log {
// return $log;
Expand Down
9 changes: 3 additions & 6 deletions src/sentry/src/Crons/Listener/EventHandleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public function process(object $event): void

protected function handleCrontabTaskStarting(Event\BeforeExecute $event, array $options): void
{
$hub = SentrySdk::getCurrentHub();
$slug = $event->crontab->getName();
$rule = $event->crontab->getRule();
$rules = explode(' ', $rule);
Expand All @@ -83,7 +82,7 @@ protected function handleCrontabTaskStarting(Event\BeforeExecute $event, array $
$monitorConfig = $this->createMonitorConfig($event, $options, $rule);
}

$checkInId = $hub->captureCheckIn(
$checkInId = SentrySdk::getCurrentHub()->captureCheckIn(
slug: $slug,
status: CheckInStatus::inProgress(),
monitorConfig: $monitorConfig,
Expand All @@ -100,10 +99,9 @@ protected function handleCrontabTaskFinished(Event\AfterExecute $event): void
return;
}

$hub = SentrySdk::getCurrentHub();
$slug = $event->crontab->getName();

$hub->captureCheckIn(
SentrySdk::getCurrentHub()->captureCheckIn(
slug: $slug,
status: CheckInStatus::ok(),
checkInId: $checkInId,
Expand All @@ -118,10 +116,9 @@ protected function handleCrontabTaskFailed(Event\FailToExecute $event): void
return;
}

$hub = SentrySdk::getCurrentHub();
$slug = $event->crontab->getName();

$hub->captureCheckIn(
SentrySdk::getCurrentHub()->captureCheckIn(
slug: $slug,
status: CheckInStatus::error(),
checkInId: $checkInId,
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/src/Metrics/Listener/OnBeforeHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ function () use ($metrics) {
['worker' => '0'],
Unit::megabyte()
);

metrics()->flush();
}
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/src/Metrics/Listener/OnCoroutineServerStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ function () use ($metrics) {
['worker' => '0'],
Unit::megabyte()
);

metrics()->flush();
}
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/src/Metrics/Listener/OnMetricFactoryReady.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ function () use ($metrics, $serverStatsFactory, $workerId) {
['worker' => (string) $workerId],
Unit::megabyte()
);

metrics()->flush();
}
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/src/Metrics/Listener/OnWorkerStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ function () use ($metrics, $event) {
['worker' => (string) ($event->workerId ?? 0)],
Unit::megabyte()
);

metrics()->flush();
}
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/src/Metrics/Listener/PoolWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ function () use ($pool, $workerId, $poolName) {
'worker' => (string) $workerId,
]
);

metrics()->flush();
}
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/src/Metrics/Listener/QueueWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ function () {
['queue' => $name]
);
}

metrics()->flush();
}
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/src/Metrics/Listener/RequestWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public function process(object $event): void
--$this->stats->connection_num;

$timer->end(true);

unset($timer);
});
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/sentry/src/Tracing/Aspect/CoroutineAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
use function Hyperf\Coroutine\defer;
use function Sentry\continueTrace;

/**
* Run after FriendsOfHyperf\Sentry\Aspect\CoroutineAspect.
*/
class CoroutineAspect extends AbstractAspect
{
public const CONTEXT_KEYS = [
Expand Down Expand Up @@ -88,6 +85,7 @@ function (Scope $scope) use ($proceedingJoinPoint, $callingOnFunction) {
defer(function () use ($transaction) {
$transaction->finish();
SentrySdk::endContext();
unset($transaction);
});

return trace(
Expand Down
10 changes: 10 additions & 0 deletions src/sentry/src/Tracing/Listener/EventHandleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ protected function handleRequestReceived(HttpEvent\RequestReceived|RpcEvent\Requ

// Finish transaction
$transaction->finish();

unset($transaction, $span);
});
}

Expand Down Expand Up @@ -532,6 +534,8 @@ protected function handleCrontabTaskStarting(CrontabEvent\BeforeExecute $event):

// Finish transaction
$transaction->finish();

unset($transaction);
});
}

Expand Down Expand Up @@ -598,6 +602,8 @@ protected function handleAmqpMessageProcessing(AmqpEvent\BeforeConsume $event):

// Finish transaction
$transaction->finish();

unset($transaction);
});
}

Expand Down Expand Up @@ -663,6 +669,8 @@ protected function handleKafkaMessageProcessing(KafkaEvent\BeforeConsume $event)

// Finish transaction
$transaction->finish();

unset($transaction);
});
}

Expand Down Expand Up @@ -710,6 +718,8 @@ protected function handleAsyncQueueJobProcessing(AsyncQueueEvent\BeforeHandle $e

// Finish transaction
$transaction->finish();

unset($transaction);
});
}

Expand Down
Loading