Skip to content

Commit

Permalink
Merge branch 'main' into kafkajs-auto-instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir authored Jul 23, 2024
2 parents 7222355 + 9a06381 commit 4a08f51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,15 @@ export class AwsInstrumentation extends InstrumentationBase {
if (requestId) {
span.setAttribute(AttributeNames.AWS_REQUEST_ID, requestId);
}

const httpStatusCode = err?.$metadata?.httpStatusCode;
if (httpStatusCode) {
span.setAttribute(
SEMATTRS_HTTP_STATUS_CODE,
httpStatusCode
);
}

const extendedRequestId = err?.extendedRequestId;
if (extendedRequestId) {
span.setAttribute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ describe('instrumentation-aws-sdk-v3', () => {
expect(span.attributes[SEMATTRS_RPC_SYSTEM]).toEqual('aws-api');
expect(span.attributes[SEMATTRS_RPC_METHOD]).toEqual('PutObject');
expect(span.attributes[SEMATTRS_RPC_SERVICE]).toEqual('S3');
expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(403);
expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region);
expect(span.attributes[AttributeNames.AWS_REQUEST_ID]).toEqual(
'MS95GTS7KXQ34X2S'
Expand Down

0 comments on commit 4a08f51

Please sign in to comment.