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
1 change: 0 additions & 1 deletion src/sentry/publish/sentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
'view' => env('SENTRY_TRACING_SPANS_VIEW', true),
],
'extra_tags' => [
'exception.stack_trace' => true,
'amqp.result' => false,
'annotation.result' => false,
'db.sql.bindings' => true,
Expand Down
8 changes: 0 additions & 8 deletions src/sentry/src/Tracing/Aspect/CoroutineAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,7 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint)
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($this->feature->isTracingExtraTagEnabled('exception.stack_trace')) {
$coTransaction->setData([
'exception.stack_trace' => (string) $exception,
]);
}

throw $exception;
}
Expand Down
8 changes: 0 additions & 8 deletions src/sentry/src/Tracing/Aspect/GuzzleHttpClientAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,7 @@ function (Scope $scope) use ($proceedingJoinPoint, $options, $guzzleConfig) {
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($this->feature->isTracingExtraTagEnabled('exception.stack_trace')) {
$span->setData([
'exception.stack_trace' => (string) $exception,
]);
}
}

if (is_callable($onStats)) {
Expand Down
46 changes: 0 additions & 46 deletions src/sentry/src/Tracing/Listener/EventHandleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,7 @@ protected function handleRequestHandled(HttpEvent\RequestHandled|RpcEvent\Reques
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($this->feature->isTracingExtraTagEnabled('exception.stack_trace')) {
$span->setData([
'exception.stack_trace' => (string) $exception,
]);
}
}
}

Expand Down Expand Up @@ -429,15 +421,7 @@ protected function handleCommandFinished(CommandEvent\AfterExecute $event): void
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($this->feature->isTracingExtraTagEnabled('exception.stack_trace')) {
$transaction->setData([
'exception.stack_trace' => (string) $exception,
]);
}
}

$transaction->setStatus(
Expand Down Expand Up @@ -478,13 +462,7 @@ function (Scope $scope) use ($event) {
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($this->feature->isTracingExtraTagEnabled('exception.stack_trace')) {
$span->setData(['exception.stack_trace' => (string) $exception]);
}
}
},
SpanContext::make()
Expand Down Expand Up @@ -555,13 +533,7 @@ protected function handleCrontabTaskFinished(CrontabEvent\FailToExecute|CrontabE
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($this->feature->isTracingExtraTagEnabled('exception.stack_trace')) {
$transaction->setData(['exception.stack_trace' => (string) $exception]);
}
}
}

Expand Down Expand Up @@ -635,13 +607,7 @@ protected function handleAmqpMessageProcessed(AmqpEvent\AfterConsume|AmqpEvent\F
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($this->feature->isTracingExtraTagEnabled('exception.stack_trace')) {
$transaction->setData(['exception.stack_trace' => (string) $exception]);
}
}
}

Expand Down Expand Up @@ -707,13 +673,7 @@ protected function handleKafkaMessageProcessed(KafkaEvent\AfterConsume|KafkaEven
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($this->feature->isTracingExtraTagEnabled('exception.stack_trace')) {
$transaction->setData(['exception.stack_trace' => (string) $exception]);
}
}
}

Expand Down Expand Up @@ -766,13 +726,7 @@ protected function handleAsyncQueueJobProcessed(AsyncQueueEvent\AfterHandle|Asyn
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($this->feature->isTracingExtraTagEnabled('exception.stack_trace')) {
$transaction->setData(['exception.stack_trace' => (string) $exception]);
}
}
}

Expand Down
17 changes: 1 addition & 16 deletions src/sentry/src/Tracing/Tracer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace FriendsOfHyperf\Sentry\Tracing;

use FriendsOfHyperf\Sentry\Feature;
use Hyperf\Engine\Coroutine;
use Sentry\SentrySdk;
use Sentry\State\Scope;
Expand All @@ -27,10 +26,6 @@

class Tracer
{
public function __construct(protected Feature $feature)
{
}

/**
* Starts a new Transaction and returns it. This is the entry point to manual tracing instrumentation.
*/
Expand Down Expand Up @@ -74,8 +69,6 @@ public function startTransaction(TransactionContext $transactionContext, array $
*/
public function trace(callable $trace, SpanContext $context)
{
$isTracingExtraTagEnabled = $this->feature->isTracingExtraTagEnabled('exception.stack_trace');

if ($context->getStatus() === null) {
$context->setStatus(SpanStatus::ok());
}
Expand All @@ -87,7 +80,7 @@ public function trace(callable $trace, SpanContext $context)
$context->setData(['coroutine.id' => Coroutine::id()] + $context->getData());

return trace(
function (Scope $scope) use ($trace, $isTracingExtraTagEnabled) {
function (Scope $scope) use ($trace) {
try {
return $trace($scope);
} catch (Throwable $exception) {
Expand All @@ -98,15 +91,7 @@ function (Scope $scope) use ($trace, $isTracingExtraTagEnabled) {
'error' => 'true',
'exception.class' => $exception::class,
'exception.code' => (string) $exception->getCode(),
])
->setData([
'exception.message' => $exception->getMessage(),
]);
if ($isTracingExtraTagEnabled) {
$span->setData([
'exception.stack_trace' => (string) $exception,
]);
}
}
throw $exception;
}
Expand Down