diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/README.md b/plugins/node/opentelemetry-instrumentation-aws-sdk/README.md index 82e877d03b..52a23efcc1 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/README.md +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/README.md @@ -65,7 +65,7 @@ The instrumentations are collecting the following attributes: | `rpc.system` | string | Always equals "aws-api" | | | `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` | | `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` | -| `aws.region` | string | Region name for the request | "eu-west-1" | +| `cloud.region` | string | Region name for the request | "eu-west-1" | ### Custom User Attributes @@ -112,6 +112,7 @@ Attributes collected: | `rpc.method` | The name of the (logical) method being called. | | | `rpc.service` | The full (logical) name of the service being called. | | | `rpc.system` | A string identifying the remoting system. | | +| `cloud.region` | The AWS Region where the requested service is being accessed. | | | `aws.dynamodb.attribute_definitions` | The JSON-serialized value of each item in the `AttributeDefinitions` request field. | dynamodb | | `aws.dynamodb.consistent_read` | The value of the `ConsistentRead` request parameter. | dynamodb | | `aws.dynamodb.consumed_capacity` | The JSON-serialized value of each item in the `ConsumedCapacity` response field. | dynamodb | diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts index 353667a8d4..450c5c2f93 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts @@ -350,7 +350,7 @@ export class AwsInstrumentation extends InstrumentationBase { normalizedRequest.region = resolvedRegion; - span.setAttribute(AttributeNames.AWS_REGION, resolvedRegion); + span.setAttribute(AttributeNames.CLOUD_REGION, resolvedRegion); }) .catch(e => { // there is nothing much we can do in this case. diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/enums.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/enums.ts index 764bd173c7..c9a39c9f09 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/enums.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/enums.ts @@ -15,7 +15,7 @@ */ export enum AttributeNames { AWS_OPERATION = 'aws.operation', - AWS_REGION = 'aws.region', + CLOUD_REGION = 'cloud.region', AWS_SERVICE_API = 'aws.service.api', AWS_SERVICE_NAME = 'aws.service.name', AWS_SERVICE_IDENTIFIER = 'aws.service.identifier', diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/utils.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/utils.ts index 99295f0a06..d212dbc5ae 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/utils.ts @@ -56,7 +56,7 @@ export const extractAttributesFromNormalizedRequest = ( [SEMATTRS_RPC_SYSTEM]: 'aws-api', [SEMATTRS_RPC_METHOD]: normalizedRequest.commandName, [SEMATTRS_RPC_SERVICE]: normalizedRequest.serviceName, - [AttributeNames.AWS_REGION]: normalizedRequest.region, + [AttributeNames.CLOUD_REGION]: normalizedRequest.region, }; }; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-s3.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-s3.test.ts index 51371c46e3..20ca3f0846 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-s3.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-s3.test.ts @@ -73,7 +73,7 @@ describe('instrumentation-aws-sdk-v3 (client-s3)', () => { expect(span.attributes[AttributeNames.AWS_S3_BUCKET]).toEqual( 'ot-demo-test' ); - expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region); + expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region); expect(span.name).toEqual('S3.PutObject'); expect(span.kind).toEqual(SpanKind.CLIENT); expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(200); @@ -100,7 +100,7 @@ describe('instrumentation-aws-sdk-v3 (client-s3)', () => { expect(span.attributes[AttributeNames.AWS_S3_BUCKET]).toEqual( 'ot-demo-test' ); - expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region); + expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region); expect(span.name).toEqual('S3.PutObject'); expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(200); done(); @@ -129,7 +129,7 @@ describe('instrumentation-aws-sdk-v3 (client-s3)', () => { expect(span.attributes[AttributeNames.AWS_S3_BUCKET]).toEqual( 'ot-demo-test' ); - expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region); + expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region); expect(span.name).toEqual('S3.PutObject'); expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(200); }); @@ -166,7 +166,7 @@ describe('instrumentation-aws-sdk-v3 (client-s3)', () => { 'invalid-bucket-name' ); expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(403); - expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region); + expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region); expect(span.attributes[AttributeNames.AWS_REQUEST_ID]).toEqual( 'MS95GTS7KXQ34X2S' ); diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-sqs.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-sqs.test.ts index e4a41c89aa..128b7f6985 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-sqs.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/aws-sdk-v3-sqs.test.ts @@ -84,7 +84,7 @@ describe('instrumentation-aws-sdk-v3 (client-sqs)', () => { expect(span.attributes[SEMATTRS_RPC_SYSTEM]).toEqual('aws-api'); expect(span.attributes[SEMATTRS_RPC_METHOD]).toEqual('SendMessage'); expect(span.attributes[SEMATTRS_RPC_SERVICE]).toEqual('SQS'); - expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region); + expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region); // custom messaging attributes expect(span.attributes[SEMATTRS_MESSAGING_SYSTEM]).toEqual('aws.sqs'); @@ -140,7 +140,7 @@ describe('instrumentation-aws-sdk-v3 (client-sqs)', () => { expect(span.attributes[SEMATTRS_RPC_SYSTEM]).toEqual('aws-api'); expect(span.attributes[SEMATTRS_RPC_METHOD]).toEqual('SendMessageBatch'); expect(span.attributes[SEMATTRS_RPC_SERVICE]).toEqual('SQS'); - expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region); + expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region); // messaging semantic attributes expect(span.attributes[SEMATTRS_MESSAGING_SYSTEM]).toEqual('aws.sqs'); @@ -183,7 +183,7 @@ describe('instrumentation-aws-sdk-v3 (client-sqs)', () => { expect(span.attributes[SEMATTRS_RPC_SYSTEM]).toEqual('aws-api'); expect(span.attributes[SEMATTRS_RPC_METHOD]).toEqual('ReceiveMessage'); expect(span.attributes[SEMATTRS_RPC_SERVICE]).toEqual('SQS'); - expect(span.attributes[AttributeNames.AWS_REGION]).toEqual(region); + expect(span.attributes[AttributeNames.CLOUD_REGION]).toEqual(region); expect(span.attributes[SEMATTRS_HTTP_STATUS_CODE]).toEqual(200); done(); });