diff --git a/src/Tracing/Span.php b/src/Tracing/Span.php index 3db829d3a..d8d1859ca 100644 --- a/src/Tracing/Span.php +++ b/src/Tracing/Span.php @@ -5,6 +5,8 @@ namespace Sentry\Tracing; use Sentry\EventId; +use Sentry\SentrySdk; +use Sentry\State\Scope; /** * This class stores all the information about a span. @@ -269,7 +271,11 @@ public function setStatus(?SpanStatus $status) */ public function setHttpStatus(int $statusCode) { - $this->tags['http.status_code'] = (string) $statusCode; + SentrySdk::getCurrentHub()->configureScope(function (Scope $scope) use ($statusCode) { + $scope->setContext('response', [ + 'status_code' => $statusCode, + ]); + }); $status = SpanStatus::createFromHttpStatusCode($statusCode);