Skip to content
Merged
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
14 changes: 11 additions & 3 deletions src/Aws/src/AwsSdkInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,17 @@ public function activate(): bool

/** @psalm-suppress PossiblyInvalidArgument */
$end_middleware = Middleware::mapResult(function (ResultInterface $result) {
$this->span->setAttributes([
'http.status_code' => $result['@metadata']['statusCode'], //@phan-suppress-current-line PhanTypeMismatchDimFetch
]);
/**
* Some AWS SDK Funtions, such as S3Client->getObjectUrl() do not actually perform on the wire comms
* with AWS Servers, and therefore do not return with a populated AWS\Result object with valid @metadata
* Check for the presence of @metadata before extracting status code as these calls are still
* instrumented.
*/
if (isset($result['@metadata'])) {
$this->span->setAttributes([
'http.status_code' => $result['@metadata']['statusCode'], //@phan-suppress-current-line PhanTypeMismatchDimFetch
]);
}

$this->span->end();
$this->scope->detach();
Expand Down
Loading