Skip to content

Commit 6f65523

Browse files
fix(opentelemetry-instrumentation-aws-sdk)!: rename aws.region to cloud.region (#2842)
1 parent 33337d4 commit 6f65523

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

plugins/node/opentelemetry-instrumentation-aws-sdk/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ The instrumentations are collecting the following attributes:
6565
| `rpc.system` | string | Always equals "aws-api" | |
6666
| `rpc.method` | string | he name of the operation corresponding to the request, as returned by the AWS SDK. If the SDK does not provide a way to retrieve a name, the name of the command SHOULD be used, removing the suffix `Command` if present, resulting in a PascalCase name with no spaces. | `PutObject` |
6767
| `rpc.service` | string | The name of the service to which a request is made, as returned by the AWS SDK. If the SDK does not provide a away to retrieve a name, the name of the SDK's client interface for a service SHOULD be used, removing the suffix `Client` if present, resulting in a PascalCase name with no spaces. | `S3`, `DynamoDB`, `Route53` |
68-
| `aws.region` | string | Region name for the request | "eu-west-1" |
68+
| `cloud.region` | string | Region name for the request | "eu-west-1" |
6969

7070
### Custom User Attributes
7171

@@ -112,6 +112,7 @@ Attributes collected:
112112
| `rpc.method` | The name of the (logical) method being called. | |
113113
| `rpc.service` | The full (logical) name of the service being called. | |
114114
| `rpc.system` | A string identifying the remoting system. | |
115+
| `cloud.region` | The AWS Region where the requested service is being accessed. | |
115116
| `aws.dynamodb.attribute_definitions` | The JSON-serialized value of each item in the `AttributeDefinitions` request field. | dynamodb |
116117
| `aws.dynamodb.consistent_read` | The value of the `ConsistentRead` request parameter. | dynamodb |
117118
| `aws.dynamodb.consumed_capacity` | The JSON-serialized value of each item in the `ConsumedCapacity` response field. | dynamodb |

plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentatio
350350
Promise.resolve(regionPromise)
351351
.then(resolvedRegion => {
352352
normalizedRequest.region = resolvedRegion;
353-
span.setAttribute(AttributeNames.AWS_REGION, resolvedRegion);
353+
span.setAttribute(AttributeNames.CLOUD_REGION, resolvedRegion);
354354
})
355355
.catch(e => {
356356
// there is nothing much we can do in this case.

plugins/node/opentelemetry-instrumentation-aws-sdk/src/enums.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
export enum AttributeNames {
1717
AWS_OPERATION = 'aws.operation',
18-
AWS_REGION = 'aws.region',
18+
CLOUD_REGION = 'cloud.region',
1919
AWS_SERVICE_API = 'aws.service.api',
2020
AWS_SERVICE_NAME = 'aws.service.name',
2121
AWS_SERVICE_IDENTIFIER = 'aws.service.identifier',

plugins/node/opentelemetry-instrumentation-aws-sdk/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const extractAttributesFromNormalizedRequest = (
5656
[SEMATTRS_RPC_SYSTEM]: 'aws-api',
5757
[SEMATTRS_RPC_METHOD]: normalizedRequest.commandName,
5858
[SEMATTRS_RPC_SERVICE]: normalizedRequest.serviceName,
59-
[AttributeNames.AWS_REGION]: normalizedRequest.region,
59+
[AttributeNames.CLOUD_REGION]: normalizedRequest.region,
6060
};
6161
};
6262

plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-s3.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('instrumentation-aws-sdk-v3 (client-s3)', () => {
7373
expect(span.attributes[AttributeNames.AWS_S3_BUCKET]).toEqual(
7474
'ot-demo-test'
7575
);
76-
expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region);
76+
expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region);
7777
expect(span.name).toEqual('S3.PutObject');
7878
expect(span.kind).toEqual(SpanKind.CLIENT);
7979
expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(200);
@@ -100,7 +100,7 @@ describe('instrumentation-aws-sdk-v3 (client-s3)', () => {
100100
expect(span.attributes[AttributeNames.AWS_S3_BUCKET]).toEqual(
101101
'ot-demo-test'
102102
);
103-
expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region);
103+
expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region);
104104
expect(span.name).toEqual('S3.PutObject');
105105
expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(200);
106106
done();
@@ -129,7 +129,7 @@ describe('instrumentation-aws-sdk-v3 (client-s3)', () => {
129129
expect(span.attributes[AttributeNames.AWS_S3_BUCKET]).toEqual(
130130
'ot-demo-test'
131131
);
132-
expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region);
132+
expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region);
133133
expect(span.name).toEqual('S3.PutObject');
134134
expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(200);
135135
});
@@ -166,7 +166,7 @@ describe('instrumentation-aws-sdk-v3 (client-s3)', () => {
166166
'invalid-bucket-name'
167167
);
168168
expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(403);
169-
expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region);
169+
expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region);
170170
expect(span.attributes[AttributeNames.AWS_REQUEST_ID]).toEqual(
171171
'MS95GTS7KXQ34X2S'
172172
);

plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-sqs.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('instrumentation-aws-sdk-v3 (client-sqs)', () => {
8484
expect(span.attributes[SEMATTRS_RPC_SYSTEM]).toEqual('aws-api');
8585
expect(span.attributes[SEMATTRS_RPC_METHOD]).toEqual('SendMessage');
8686
expect(span.attributes[SEMATTRS_RPC_SERVICE]).toEqual('SQS');
87-
expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region);
87+
expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region);
8888

8989
// custom messaging attributes
9090
expect(span.attributes[SEMATTRS_MESSAGING_SYSTEM]).toEqual('aws.sqs');
@@ -140,7 +140,7 @@ describe('instrumentation-aws-sdk-v3 (client-sqs)', () => {
140140
expect(span.attributes[SEMATTRS_RPC_SYSTEM]).toEqual('aws-api');
141141
expect(span.attributes[SEMATTRS_RPC_METHOD]).toEqual('SendMessageBatch');
142142
expect(span.attributes[SEMATTRS_RPC_SERVICE]).toEqual('SQS');
143-
expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region);
143+
expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region);
144144

145145
// messaging semantic attributes
146146
expect(span.attributes[SEMATTRS_MESSAGING_SYSTEM]).toEqual('aws.sqs');
@@ -183,7 +183,7 @@ describe('instrumentation-aws-sdk-v3 (client-sqs)', () => {
183183
expect(span.attributes[SEMATTRS_RPC_SYSTEM]).toEqual('aws-api');
184184
expect(span.attributes[SEMATTRS_RPC_METHOD]).toEqual('ReceiveMessage');
185185
expect(span.attributes[SEMATTRS_RPC_SERVICE]).toEqual('SQS');
186-
expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region);
186+
expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region);
187187
expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(200);
188188
done();
189189
});

0 commit comments

Comments
 (0)