From a006b999a6245ca16fa4ced726c0c6e2a43cb00c Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Mon, 20 Nov 2023 10:39:06 +0100 Subject: [PATCH] Normalize response status --- src/Tracing/Span.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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);