Skip to content

Commit

Permalink
Normalize response status (#1644)
Browse files Browse the repository at this point in the history
  • Loading branch information
cleptric authored Nov 20, 2023
1 parent be51e60 commit 0ac1dbe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Tracing/Span.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 0ac1dbe

Please sign in to comment.