diff --git a/src/sentry/src/Constants.php b/src/sentry/src/Constants.php index cfa1d7469..28fb71007 100644 --- a/src/sentry/src/Constants.php +++ b/src/sentry/src/Constants.php @@ -15,22 +15,49 @@ class Constants { public const TRACE_CARRIER = 'sentry.tracing.trace_carrier'; + /** + * @deprecated since v3.1, will be removed in v3.2. + */ public const TRACE_DB_SERVER_ADDRESS = 'sentry.tracing.db.server.address'; + /** + * @deprecated since v3.1, will be removed in v3.2. + */ public const TRACE_DB_SERVER_PORT = 'sentry.tracing.db.server.port'; + /** + * @deprecated since v3.1, will be removed in v3.2. + */ public const TRACE_REDIS_SERVER_ADDRESS = 'sentry.tracing.redis.server.address'; + /** + * @deprecated since v3.1, will be removed in v3.2. + */ public const TRACE_REDIS_SERVER_PORT = 'sentry.tracing.redis.server.port'; + /** + * @deprecated since v3.1, will be removed in v3.2. + */ public const TRACE_RPC_SERVER_ADDRESS = 'sentry.tracing.rpc.server.address'; + /** + * @deprecated since v3.1, will be removed in v3.2. + */ public const TRACE_RPC_SERVER_PORT = 'sentry.tracing.rpc.server.port'; + /** + * @deprecated since v3.1, will be removed in v3.2. + */ public const TRACE_ELASTICSEARCH_REQUEST_DATA = 'sentry.tracing.elasticsearch.request.data'; + /** + * @deprecated since v3.1, will be removed in v3.2. + */ public const CRON_CHECKIN_ID = 'sentry.crons.checkin_id'; + /** + * @deprecated since v3.1, will be removed in v3.2. + */ public const DISABLE_COROUTINE_TRACING = 'sentry.tracing.coroutine.disabled'; public const SENTRY_TRACE = 'sentry-trace'; diff --git a/src/sentry/src/Crons/Listener/EventHandleListener.php b/src/sentry/src/Crons/Listener/EventHandleListener.php index a35f69150..c083e8d96 100644 --- a/src/sentry/src/Crons/Listener/EventHandleListener.php +++ b/src/sentry/src/Crons/Listener/EventHandleListener.php @@ -11,9 +11,8 @@ namespace FriendsOfHyperf\Sentry\Crons\Listener; -use FriendsOfHyperf\Sentry\Constants; use FriendsOfHyperf\Sentry\Feature; -use Hyperf\Context\Context; +use FriendsOfHyperf\Sentry\SentryContext; use Hyperf\Contract\ConfigInterface; use Hyperf\Contract\StdoutLoggerInterface; use Hyperf\Crontab\Event; @@ -90,13 +89,13 @@ protected function handleCrontabTaskStarting(Event\BeforeExecute $event, array $ monitorConfig: $monitorConfig, ); - Context::set(Constants::CRON_CHECKIN_ID, $checkInId); + SentryContext::setCronCheckInId($checkInId); } protected function handleCrontabTaskFinished(Event\AfterExecute $event): void { - /** @var null|string $checkInId */ - $checkInId = Context::get(Constants::CRON_CHECKIN_ID); + $checkInId = SentryContext::getCronCheckInId(); + if (! $checkInId) { return; } @@ -113,8 +112,8 @@ protected function handleCrontabTaskFinished(Event\AfterExecute $event): void protected function handleCrontabTaskFailed(Event\FailToExecute $event): void { - /** @var null|string $checkInId */ - $checkInId = Context::get(Constants::CRON_CHECKIN_ID); + $checkInId = SentryContext::getCronCheckInId(); + if (! $checkInId) { return; } diff --git a/src/sentry/src/Feature.php b/src/sentry/src/Feature.php index fa89298f1..c9e071fab 100644 --- a/src/sentry/src/Feature.php +++ b/src/sentry/src/Feature.php @@ -97,11 +97,17 @@ public function isCronsEnabled(): bool return (bool) $this->config->get('sentry.crons.enable', true); } + /** + * @deprecated since v3.1, will be removed in v3.2, use `\FriendsOfHyperf\Sentry\Context::disableTracing()` instead. + */ public static function disableCoroutineTracing(): void { Context::set(Constants::DISABLE_COROUTINE_TRACING, true); } + /** + * @deprecated since v3.1, will be removed in v3.2, use `\FriendsOfHyperf\Sentry\Context::isTracingDisabled()` instead. + */ public static function isDisableCoroutineTracing(): bool { return (bool) Context::get(Constants::DISABLE_COROUTINE_TRACING); diff --git a/src/sentry/src/SentryContext.php b/src/sentry/src/SentryContext.php new file mode 100644 index 000000000..0be693ade --- /dev/null +++ b/src/sentry/src/SentryContext.php @@ -0,0 +1,161 @@ +getInstance(); - $messageId = method_exists($job, 'getId') ? $job->getId() : SentryUid::generate(); + $messageId = method_exists($job, 'getId') ? call_user_func([$job, 'getId']) : SentryUid::generate(); $destinationName = Context::get('sentry.messaging.destination.name', 'default'); $bodySize = (fn ($job) => strlen($this->packer->pack($job)))->call($driver, $job); $data = [ @@ -106,7 +107,7 @@ function (Scope $scope) use ($proceedingJoinPoint, $messageId, $destinationName, $carrier = Carrier::fromArray([])->with($extra); } - Context::set(Constants::TRACE_CARRIER, $carrier); + SentryContext::setCarrier($carrier); return $proceedingJoinPoint->process(); }, @@ -140,7 +141,7 @@ protected function buildSpanDataOfRedisDriver(RedisDriver $driver): array protected function handleSerialize(ProceedingJoinPoint $proceedingJoinPoint) { return with($proceedingJoinPoint->process(), function ($result) { - if (is_array($result) && $carrier = Context::get(Constants::TRACE_CARRIER)) { + if (is_array($result) && $carrier = SentryContext::getCarrier()) { if (array_is_list($result)) { $result[] = $carrier->toJson(); } elseif (isset($result['job'])) { @@ -164,7 +165,7 @@ protected function handleUnserialize(ProceedingJoinPoint $proceedingJoinPoint) /** @var null|string $carrier */ if ($carrier) { - Context::set(Constants::TRACE_CARRIER, Carrier::fromJson($carrier)); + SentryContext::setCarrier(Carrier::fromJson($carrier)); } return $proceedingJoinPoint->process(); diff --git a/src/sentry/src/Tracing/Aspect/CoroutineAspect.php b/src/sentry/src/Tracing/Aspect/CoroutineAspect.php index 0d08c224e..bc0170170 100644 --- a/src/sentry/src/Tracing/Aspect/CoroutineAspect.php +++ b/src/sentry/src/Tracing/Aspect/CoroutineAspect.php @@ -13,6 +13,7 @@ use FriendsOfHyperf\Sentry\Feature; use FriendsOfHyperf\Sentry\Integration; +use FriendsOfHyperf\Sentry\SentryContext; use FriendsOfHyperf\Sentry\Util\CoroutineBacktraceHelper; use Hyperf\Context\Context; use Hyperf\Di\Aop\AbstractAspect; @@ -46,7 +47,7 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) { if ( ! $this->feature->isTracingSpanEnabled('coroutine') - || Feature::isDisableCoroutineTracing() + || SentryContext::isTracingDisabled() ) { return $proceedingJoinPoint->process(); } diff --git a/src/sentry/src/Tracing/Aspect/DbAspect.php b/src/sentry/src/Tracing/Aspect/DbAspect.php index a0e149272..94edd63ba 100644 --- a/src/sentry/src/Tracing/Aspect/DbAspect.php +++ b/src/sentry/src/Tracing/Aspect/DbAspect.php @@ -11,10 +11,9 @@ namespace FriendsOfHyperf\Sentry\Tracing\Aspect; -use FriendsOfHyperf\Sentry\Constants; use FriendsOfHyperf\Sentry\Feature; +use FriendsOfHyperf\Sentry\SentryContext; use FriendsOfHyperf\Sentry\Util\SqlParser; -use Hyperf\Context\Context; use Hyperf\DB\Pool\PoolFactory; use Hyperf\Di\Aop\AbstractAspect; use Hyperf\Di\Aop\ProceedingJoinPoint; @@ -71,8 +70,8 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) /** @var \Hyperf\DB\AbstractConnection $connection */ $server = $this->serverCache[$connection] ?? null; if ($server !== null) { - Context::set(Constants::TRACE_DB_SERVER_ADDRESS, $server['host'] ?? 'localhost'); - Context::set(Constants::TRACE_DB_SERVER_PORT, $server['port'] ?? 3306); + SentryContext::setDbServerAddress($server['host'] ?? 'localhost'); + SentryContext::setDbServerPort((int) ($server['port'] ?? 3306)); } }); } @@ -108,8 +107,8 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) 'db.pool.max_idle_time' => $pool->getOption()->getMaxIdleTime(), 'db.pool.idle' => $pool->getConnectionsInChannel(), 'db.pool.using' => $pool->getCurrentConnections(), - 'server.host' => Context::get(Constants::TRACE_DB_SERVER_ADDRESS, 'localhost'), - 'server.port' => Context::get(Constants::TRACE_DB_SERVER_PORT, 3306), + 'server.host' => SentryContext::getDbServerAddress() ?? 'localhost', + 'server.port' => SentryContext::getDbServerPort() ?? 3306, ]; if ($this->feature->isTracingTagEnabled('db.sql.bindings', true)) { diff --git a/src/sentry/src/Tracing/Aspect/DbConnectionAspect.php b/src/sentry/src/Tracing/Aspect/DbConnectionAspect.php index 18bf171aa..a7e5623b4 100644 --- a/src/sentry/src/Tracing/Aspect/DbConnectionAspect.php +++ b/src/sentry/src/Tracing/Aspect/DbConnectionAspect.php @@ -11,8 +11,8 @@ namespace FriendsOfHyperf\Sentry\Tracing\Aspect; -use FriendsOfHyperf\Sentry\Constants; use FriendsOfHyperf\Sentry\Feature; +use FriendsOfHyperf\Sentry\SentryContext; use Hyperf\Context\Context; use Hyperf\Di\Aop\AbstractAspect; use Hyperf\Di\Aop\ProceedingJoinPoint; @@ -57,8 +57,8 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) $server = $this->serverCache[$pdo] ?? null; if (is_array($server)) { - Context::set(Constants::TRACE_DB_SERVER_ADDRESS, $server['host']); - Context::set(Constants::TRACE_DB_SERVER_PORT, $server['port']); + SentryContext::setDbServerAddress($server['host']); + SentryContext::setDbServerPort((int) $server['port']); } return true; diff --git a/src/sentry/src/Tracing/Aspect/ElasticsearchAspect.php b/src/sentry/src/Tracing/Aspect/ElasticsearchAspect.php index c5154e504..791ce7cc2 100644 --- a/src/sentry/src/Tracing/Aspect/ElasticsearchAspect.php +++ b/src/sentry/src/Tracing/Aspect/ElasticsearchAspect.php @@ -11,9 +11,8 @@ namespace FriendsOfHyperf\Sentry\Tracing\Aspect; -use FriendsOfHyperf\Sentry\Constants; use FriendsOfHyperf\Sentry\Feature; -use Hyperf\Context\Context; +use FriendsOfHyperf\Sentry\SentryContext; use Hyperf\Di\Aop\AbstractAspect; use Hyperf\Di\Aop\ProceedingJoinPoint; use Sentry\State\Scope; @@ -72,8 +71,8 @@ function (Scope $scope) use ($proceedingJoinPoint) { ]); } - $data = (array) Context::get(Constants::TRACE_ELASTICSEARCH_REQUEST_DATA, []); - $scope->getSpan()?->setData($data); + $data = SentryContext::getElasticsearchSpanData(); + $data && $scope->getSpan()?->setData($data); }); }, SpanContext::make() diff --git a/src/sentry/src/Tracing/Aspect/ElasticsearchRequestAspect.php b/src/sentry/src/Tracing/Aspect/ElasticsearchRequestAspect.php index 844de3b76..0573ba498 100644 --- a/src/sentry/src/Tracing/Aspect/ElasticsearchRequestAspect.php +++ b/src/sentry/src/Tracing/Aspect/ElasticsearchRequestAspect.php @@ -11,9 +11,8 @@ namespace FriendsOfHyperf\Sentry\Tracing\Aspect; -use FriendsOfHyperf\Sentry\Constants; use FriendsOfHyperf\Sentry\Feature; -use Hyperf\Context\Context; +use FriendsOfHyperf\Sentry\SentryContext; use Hyperf\Di\Aop\AbstractAspect; use Hyperf\Di\Aop\ProceedingJoinPoint; use Psr\Http\Message\RequestInterface; @@ -46,7 +45,7 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) 'http.request.method' => $request->getMethod(), 'url.full' => $this->getFullUrl($request), ]; - Context::set(Constants::TRACE_ELASTICSEARCH_REQUEST_DATA, $data); + SentryContext::setElasticsearchSpanData($data); } } @@ -60,7 +59,7 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) 'http.request.method' => $lastConnection->getLastRequestInfo()['request']['http_method'] ?? 'GET', 'url.full' => $lastConnection->getLastRequestInfo()['response']['effective_url'] ?? '', ]; - Context::set(Constants::TRACE_ELASTICSEARCH_REQUEST_DATA, $data); + SentryContext::setElasticsearchSpanData($data); } }); } diff --git a/src/sentry/src/Tracing/Aspect/GrpcAspect.php b/src/sentry/src/Tracing/Aspect/GrpcAspect.php index 0af72956c..0dcd896c7 100644 --- a/src/sentry/src/Tracing/Aspect/GrpcAspect.php +++ b/src/sentry/src/Tracing/Aspect/GrpcAspect.php @@ -52,7 +52,7 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) 'rpc.system' => 'grpc', 'rpc.method' => $method, 'rpc.options' => $options, - 'server.address' => $serverAddress, + 'server.address' => (string) ($serverAddress ?? 'unknown'), 'server.port' => $serverPort, ]; diff --git a/src/sentry/src/Tracing/Aspect/RedisConnectionAspect.php b/src/sentry/src/Tracing/Aspect/RedisConnectionAspect.php index 23b1a5e7e..9af76674c 100644 --- a/src/sentry/src/Tracing/Aspect/RedisConnectionAspect.php +++ b/src/sentry/src/Tracing/Aspect/RedisConnectionAspect.php @@ -11,10 +11,9 @@ namespace FriendsOfHyperf\Sentry\Tracing\Aspect; -use FriendsOfHyperf\Sentry\Constants; use FriendsOfHyperf\Sentry\Feature; +use FriendsOfHyperf\Sentry\SentryContext; use FriendsOfHyperf\Sentry\Util\RedisClusterKeySlot; -use Hyperf\Context\Context; use Hyperf\Di\Aop\AbstractAspect; use Hyperf\Di\Aop\ProceedingJoinPoint; use Redis; @@ -47,8 +46,8 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) $connection = (fn () => $this->connection ?? null)->call($redisConnection); if ($connection instanceof Redis) { // Redis or RedisSentinel - Context::set(Constants::TRACE_REDIS_SERVER_ADDRESS, $connection->getHost()); - Context::set(Constants::TRACE_REDIS_SERVER_PORT, $connection->getPort()); + SentryContext::setRedisServerAddress($connection->getHost()); + SentryContext::setRedisServerPort($connection->getPort()); } if ($connection instanceof RedisCluster) { // RedisCluster @@ -57,8 +56,8 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) if (is_string($key)) { $node = $this->getClusterNodeBySlot($connection, $key); if ($node !== null) { - Context::set(Constants::TRACE_REDIS_SERVER_ADDRESS, $node['host']); - Context::set(Constants::TRACE_REDIS_SERVER_PORT, $node['port']); + SentryContext::setRedisServerAddress($node['host']); + SentryContext::setRedisServerPort((int) $node['port']); } } } diff --git a/src/sentry/src/Tracing/Aspect/RpcAspect.php b/src/sentry/src/Tracing/Aspect/RpcAspect.php index 51aa90a0e..573324eef 100644 --- a/src/sentry/src/Tracing/Aspect/RpcAspect.php +++ b/src/sentry/src/Tracing/Aspect/RpcAspect.php @@ -13,6 +13,7 @@ use FriendsOfHyperf\Sentry\Constants; use FriendsOfHyperf\Sentry\Feature; +use FriendsOfHyperf\Sentry\SentryContext; use FriendsOfHyperf\Sentry\Util\Carrier; use Hyperf\Context\Context; use Hyperf\Contract\ConfigInterface; @@ -76,7 +77,7 @@ private function handleGenerateRpcPath(ProceedingJoinPoint $proceedingJoinPoint) }; // https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-spans.md - Context::set(static::SPAN_CONTEXT, SpanContext::make() + SentryContext::setRpcSpanContext(SpanContext::make() ->setOp('rpc.client') ->setDescription($path) ->setOrigin('auto.rpc') @@ -91,8 +92,7 @@ private function handleGenerateRpcPath(ProceedingJoinPoint $proceedingJoinPoint) private function handleSend(ProceedingJoinPoint $proceedingJoinPoint) { - /** @var null|SpanContext $spanContext */ - $spanContext = Context::get(static::SPAN_CONTEXT); + $spanContext = SentryContext::getRpcSpanContext(); if (! $spanContext) { return $proceedingJoinPoint->process(); @@ -116,18 +116,16 @@ function (Scope $scope) use ($proceedingJoinPoint) { if ($this->feature->isTracingTagEnabled('rpc.result')) { $span?->setData(['rpc.result' => $result]); } - if (Context::has(Constants::TRACE_RPC_SERVER_ADDRESS)) { - $span?->setData([ - 'server.address' => Context::get(Constants::TRACE_RPC_SERVER_ADDRESS), - 'server.port' => Context::get(Constants::TRACE_RPC_SERVER_PORT), - ]); - } + $span?->setData([ + 'server.address' => SentryContext::getRpcServerAddress() ?? 'unknown', + 'server.port' => SentryContext::getRpcServerPort() ?? 0, + ]); }); }, $spanContext ); } finally { - Context::destroy(static::SPAN_CONTEXT); + SentryContext::destroyRpcSpanContext(); } } } diff --git a/src/sentry/src/Tracing/Aspect/RpcEndpointAspect.php b/src/sentry/src/Tracing/Aspect/RpcEndpointAspect.php index 9388ed283..8300be1e9 100644 --- a/src/sentry/src/Tracing/Aspect/RpcEndpointAspect.php +++ b/src/sentry/src/Tracing/Aspect/RpcEndpointAspect.php @@ -11,9 +11,8 @@ namespace FriendsOfHyperf\Sentry\Tracing\Aspect; -use FriendsOfHyperf\Sentry\Constants; use FriendsOfHyperf\Sentry\Feature; -use Hyperf\Context\Context; +use FriendsOfHyperf\Sentry\SentryContext; use Hyperf\Di\Aop\AbstractAspect; use Hyperf\Di\Aop\ProceedingJoinPoint; @@ -40,13 +39,13 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) // RpcMultiplex if ($result instanceof \Hyperf\RpcMultiplex\Socket) { - Context::set(Constants::TRACE_RPC_SERVER_ADDRESS, $result->getName()); - Context::set(Constants::TRACE_RPC_SERVER_PORT, $result->getPort()); + SentryContext::setRpcServerAddress($result->getName()); + SentryContext::setRpcServerPort($result->getPort()); } // JsonRpcHttpTransporter if ($result instanceof \Hyperf\LoadBalancer\Node) { - Context::set(Constants::TRACE_RPC_SERVER_ADDRESS, $result->host); - Context::set(Constants::TRACE_RPC_SERVER_PORT, $result->port); + SentryContext::setRpcServerAddress($result->host); + SentryContext::setRpcServerPort($result->port); } // JsonRpcPoolTransporter if ($result instanceof \Hyperf\JsonRpc\Pool\RpcConnection) { @@ -56,8 +55,8 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint) /** @var null|\Hyperf\Engine\Contract\Socket\SocketOptionInterface $option */ $option = $socket->getSocketOption(); if ($option instanceof \Hyperf\Engine\Contract\Socket\SocketOptionInterface) { - Context::set(Constants::TRACE_RPC_SERVER_ADDRESS, $option->getHost()); - Context::set(Constants::TRACE_RPC_SERVER_PORT, $option->getPort()); + SentryContext::setRpcServerAddress($option->getHost()); + SentryContext::setRpcServerPort($option->getPort()); } } } diff --git a/src/sentry/src/Tracing/Listener/EventHandleListener.php b/src/sentry/src/Tracing/Listener/EventHandleListener.php index 71e3ac35a..8d0df8b08 100644 --- a/src/sentry/src/Tracing/Listener/EventHandleListener.php +++ b/src/sentry/src/Tracing/Listener/EventHandleListener.php @@ -15,6 +15,7 @@ use FriendsOfHyperf\Sentry\Constants; use FriendsOfHyperf\Sentry\Feature; use FriendsOfHyperf\Sentry\Integration; +use FriendsOfHyperf\Sentry\SentryContext; use FriendsOfHyperf\Sentry\Util\Carrier; use FriendsOfHyperf\Sentry\Util\CoContainer; use FriendsOfHyperf\Sentry\Util\SqlParser; @@ -23,7 +24,6 @@ use Hyperf\Amqp\Message\ConsumerMessage; use Hyperf\AsyncQueue\Event as AsyncQueueEvent; use Hyperf\Command\Event as CommandEvent; -use Hyperf\Context\Context; use Hyperf\Contract\ConfigInterface; use Hyperf\Coroutine\Coroutine; use Hyperf\Crontab\Event as CrontabEvent; @@ -193,8 +193,8 @@ protected function handleDbQueryExecuted(DbEvent\QueryExecuted $event): void 'db.pool.max_idle_time' => $pool->getOption()->getMaxIdleTime(), 'db.pool.idle' => $pool->getConnectionsInChannel(), 'db.pool.using' => $pool->getCurrentConnections(), - 'server.address' => (string) Context::get(Constants::TRACE_DB_SERVER_ADDRESS, 'localhost'), - 'server.port' => (int) Context::get(Constants::TRACE_DB_SERVER_PORT, 3306), + 'server.address' => SentryContext::getDbServerAddress() ?? 'localhost', + 'server.port' => SentryContext::getDbServerPort() ?? 3306, ]; if ($this->feature->isTracingTagEnabled('db.sql.bindings', true)) { @@ -499,8 +499,8 @@ function (Scope $scope) use ($event) { 'db.redis.pool.idle' => $pool->getConnectionsInChannel(), 'db.redis.pool.using' => $pool->getCurrentConnections(), 'duration' => $event->time * 1000, - 'server.address' => (string) Context::get(Constants::TRACE_REDIS_SERVER_ADDRESS, 'localhost'), - 'server.port' => (int) Context::get(Constants::TRACE_REDIS_SERVER_PORT, 6379), + 'server.address' => SentryContext::getRedisServerAddress() ?? 'localhost', + 'server.port' => SentryContext::getRedisServerPort() ?? 6379, ]) ->setStartTimestamp(microtime(true) - $event->time / 1000) ); @@ -573,7 +573,7 @@ protected function handleAmqpMessageProcessing(AmqpEvent\BeforeConsume $event): $applicationHeaders = $amqpMessage->has('application_headers') ? $amqpMessage->get('application_headers') : null; if ($applicationHeaders && isset($applicationHeaders[Constants::TRACE_CARRIER])) { $carrier = Carrier::fromJson($applicationHeaders[Constants::TRACE_CARRIER]); - Context::set(Constants::TRACE_CARRIER, $carrier); + SentryContext::setCarrier($carrier); } } @@ -643,7 +643,7 @@ protected function handleKafkaMessageProcessing(KafkaEvent\BeforeConsume $event) foreach ($message->getHeaders() as $header) { if ($header->getHeaderKey() === Constants::TRACE_CARRIER) { $carrier = Carrier::fromJson($header->getValue()); - Context::set(Constants::TRACE_CARRIER, $carrier); + SentryContext::setCarrier($carrier); break; } } @@ -699,8 +699,7 @@ protected function handleAsyncQueueJobProcessing(AsyncQueueEvent\BeforeHandle $e return; } - /** @var null|Carrier $carrier */ - $carrier = Context::get(Constants::TRACE_CARRIER, null, Coroutine::parentId()); + $carrier = SentryContext::getCarrier(Coroutine::parentId()); $job = $event->getMessage()->job(); $transaction = startTransaction( diff --git a/types/Sentry/Sentry.php b/types/Sentry/Sentry.php index 57d1adae7..4c5597387 100644 --- a/types/Sentry/Sentry.php +++ b/types/Sentry/Sentry.php @@ -139,9 +139,6 @@ public function close(?int $timeout = null): Result assertType('bool', $feature->isTracingTagEnabled('foo')); assertType('bool', $feature->isCronsEnabled()); -Feature::disableCoroutineTracing(); -assertType('bool', Feature::isDisableCoroutineTracing()); - $switcher = new Switcher($config); assertType('bool', $switcher->isEnable('foo')); assertType('bool', $switcher->isExceptionIgnored(RuntimeException::class));