diff --git a/aws-distro-opentelemetry-node-autoinstrumentation/package.json b/aws-distro-opentelemetry-node-autoinstrumentation/package.json index c63a62b..154ed2a 100644 --- a/aws-distro-opentelemetry-node-autoinstrumentation/package.json +++ b/aws-distro-opentelemetry-node-autoinstrumentation/package.json @@ -65,7 +65,6 @@ "@aws-sdk/client-bedrock-runtime": "3.632.0", "@aws-sdk/client-kinesis": "3.632.0", "@aws-sdk/client-s3": "3.632.0", - "@aws-sdk/client-sqs": "3.632.0", "@opentelemetry/contrib-test-utils": "0.41.0", "@types/mocha": "7.0.2", "@types/node": "18.6.5", diff --git a/aws-distro-opentelemetry-node-autoinstrumentation/test/register.patch.test.ts b/aws-distro-opentelemetry-node-autoinstrumentation/test/register.patch.test.ts deleted file mode 100644 index acf4f31..0000000 --- a/aws-distro-opentelemetry-node-autoinstrumentation/test/register.patch.test.ts +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Modifications Copyright The OpenTelemetry Authors. Licensed under the Apache License 2.0 License. - -import * as assert from 'assert'; -import { spawnSync, SpawnSyncReturns } from 'child_process'; - -// The OpenTelemetry Authors code -describe('RegisterPatch', function () { - it('Correctly applies AWS SDK Patches and generates expected attributes for S3, Kinesis, and SQS Client calls', () => { - const proc: SpawnSyncReturns = spawnSync( - process.execPath, - ['--require', '../build/src/register.js', './test-app/app-aws-sdk-client-calls.js'], - { - cwd: __dirname, - timeout: 10000, - killSignal: 'SIGKILL', // SIGTERM is not sufficient to terminate some hangs - env: Object.assign({}, process.env, { - OTEL_NODE_RESOURCE_DETECTORS: 'none', - OTEL_TRACES_EXPORTER: 'console', - // nx (used by lerna run) defaults `FORCE_COLOR=true`, which in - // node v18.17.0, v20.3.0 and later results in ANSI color escapes - // in the ConsoleSpanExporter output that is checked below. - FORCE_COLOR: '0', - - OTEL_LOG_LEVEL: 'ALL', - OTEL_TRACES_SAMPLER: 'always_on', - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: 'http://localhost:4316/v1/traces', - OTEL_RESOURCE_ATTRIBUTES: 'service.name=test-adot-sdk-ec2-service-name', - OTEL_AWS_APPLICATION_SIGNALS_ENABLED: 'true', - OTEL_NODE_DISABLED_INSTRUMENTATIONS: 'fs', - }), - } - ); - assert.ifError(proc.error); - assert.equal(proc.status, 0, `proc.status (${proc.status})`); - assert.equal(proc.signal, null, `proc.signal (${proc.signal})`); - - assert.ok(proc.stdout.includes('AWS Distro of OpenTelemetry automatic instrumentation started successfully')); - assert.ok(proc.stdout.includes("Environment variable OTEL_EXPORTER_OTLP_PROTOCOL is set to 'http/protobuf'")); - assert.ok(proc.stdout.includes("Environment variable OTEL_PROPAGATORS is set to 'xray,tracecontext,b3,b3multi'")); - - assert.ok( - proc.stdout.includes("'service.name': 'test-adot-sdk-ec2-service-name'"), - 'console span output in stdout - validate service.name' - ); - - assert.ok( - proc.stdout.includes("'aws.s3.bucket': 'test-bucket-not-exists'"), - 'console span output in stdout - validate aws.s3.bucket' - ); - assert.ok( - proc.stdout.includes("'aws.remote.resource.type': 'AWS::S3::Bucket'"), - 'console span output in stdout - validate aws.remote.resource.type' - ); - assert.ok( - proc.stdout.includes("'aws.remote.resource.identifier': 'test-bucket-not-exists'"), - 'console span output in stdout - validate aws.remote.resource.identifier' - ); - - assert.ok( - proc.stdout.includes("'aws.kinesis.stream.name': 'my-kinesis-stream'"), - 'console span output in stdout - validate aws.kinesis.stream.name' - ); - assert.ok( - proc.stdout.includes("'aws.remote.resource.type': 'AWS::Kinesis::Stream'"), - 'console span output in stdout - validate aws.remote.resource.type' - ); - assert.ok( - proc.stdout.includes("'aws.remote.resource.identifier': 'my-kinesis-stream'"), - 'console span output in stdout - validate aws.remote.resource.identifier' - ); - - assert.ok( - proc.stdout.includes("'aws.sqs.queue.url': 'https://sqs.us-east-1.amazonaws.com/012345678910/sqs-queue-name'"), - 'console span output in stdout - validate aws.sqs.queue.url' - ); - assert.ok( - proc.stdout.includes("'aws.remote.resource.type': 'AWS::SQS::Queue'"), - 'console span output in stdout - validate aws.remote.resource.type' - ); - assert.ok( - proc.stdout.includes("'aws.remote.resource.identifier': 'sqs-queue-name'"), - 'console span output in stdout - validate aws.remote.resource.identifier' - ); - }); -}); -// END The OpenTelemetry Authors code diff --git a/aws-distro-opentelemetry-node-autoinstrumentation/test/test-app/app-aws-sdk-client-calls.js b/aws-distro-opentelemetry-node-autoinstrumentation/test/test-app/app-aws-sdk-client-calls.js deleted file mode 100644 index c9d06c8..0000000 --- a/aws-distro-opentelemetry-node-autoinstrumentation/test/test-app/app-aws-sdk-client-calls.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -// Used in register.patch.test.ts to mimic a JS app using SQS client of AWS SDK for JS (v3). -const { S3Client, ListObjectsCommand } = require("@aws-sdk/client-s3"); -const { KinesisClient, ListStreamsCommand } = require('@aws-sdk/client-kinesis'); -const { SQSClient, GetQueueAttributesCommand } = require("@aws-sdk/client-sqs"); - -const s3Client = new S3Client({}); -const bucketName = "test-bucket-not-exists"; - -const kinesisClient = new KinesisClient({}); -const streamName = "my-kinesis-stream"; - -const sqsClient = new SQSClient({}); -const queueUrl = "https://sqs.us-east-1.amazonaws.com/012345678910/sqs-queue-name"; - -const awsSdkClientSendPromises = [ - s3Client.send( - new ListObjectsCommand({ - Bucket: bucketName - }) - ), - kinesisClient.send( - new ListStreamsCommand({ - StreamName: streamName, - }) - ), - sqsClient.send( - new GetQueueAttributesCommand({ - QueueUrl: queueUrl - }) - ), -] - -Promise.all(awsSdkClientSendPromises).catch(e => { - console.error("Exception thrown", e.message); -}); diff --git a/package-lock.json b/package-lock.json index 768355f..1696bd2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,7 +63,6 @@ "@aws-sdk/client-bedrock-runtime": "3.632.0", "@aws-sdk/client-kinesis": "3.632.0", "@aws-sdk/client-s3": "3.632.0", - "@aws-sdk/client-sqs": "3.632.0", "@opentelemetry/contrib-test-utils": "0.41.0", "@types/mocha": "7.0.2", "@types/node": "18.6.5", @@ -684,61 +683,6 @@ "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/client-sqs": { - "version": "3.632.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sqs/-/client-sqs-3.632.0.tgz", - "integrity": "sha512-UK4JQ6nF6qDtc2rLdrYTgyZWTdUgfVHbVHQdHkrni2TNac3kEksgiDFxsm6zQjy1NoOg4YdPDeMOeHRvWImlPQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/client-sso-oidc": "3.632.0", - "@aws-sdk/client-sts": "3.632.0", - "@aws-sdk/core": "3.629.0", - "@aws-sdk/credential-provider-node": "3.632.0", - "@aws-sdk/middleware-host-header": "3.620.0", - "@aws-sdk/middleware-logger": "3.609.0", - "@aws-sdk/middleware-recursion-detection": "3.620.0", - "@aws-sdk/middleware-sdk-sqs": "3.622.0", - "@aws-sdk/middleware-user-agent": "3.632.0", - "@aws-sdk/region-config-resolver": "3.614.0", - "@aws-sdk/types": "3.609.0", - "@aws-sdk/util-endpoints": "3.632.0", - "@aws-sdk/util-user-agent-browser": "3.609.0", - "@aws-sdk/util-user-agent-node": "3.614.0", - "@smithy/config-resolver": "^3.0.5", - "@smithy/core": "^2.3.2", - "@smithy/fetch-http-handler": "^3.2.4", - "@smithy/hash-node": "^3.0.3", - "@smithy/invalid-dependency": "^3.0.3", - "@smithy/md5-js": "^3.0.3", - "@smithy/middleware-content-length": "^3.0.5", - "@smithy/middleware-endpoint": "^3.1.0", - "@smithy/middleware-retry": "^3.0.14", - "@smithy/middleware-serde": "^3.0.3", - "@smithy/middleware-stack": "^3.0.3", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/node-http-handler": "^3.1.4", - "@smithy/protocol-http": "^4.1.0", - "@smithy/smithy-client": "^3.1.12", - "@smithy/types": "^3.3.0", - "@smithy/url-parser": "^3.0.3", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.14", - "@smithy/util-defaults-mode-node": "^3.0.14", - "@smithy/util-endpoints": "^2.0.5", - "@smithy/util-middleware": "^3.0.3", - "@smithy/util-retry": "^3.0.3", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, "node_modules/@aws-sdk/client-sso": { "version": "3.632.0", "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.632.0.tgz", @@ -1202,24 +1146,6 @@ "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/middleware-sdk-sqs": { - "version": "3.622.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-sqs/-/middleware-sdk-sqs-3.622.0.tgz", - "integrity": "sha512-kOPX94jlVcvH7Wutzag99L+BSjT6LjXxW7Ntc02/oywYX6Gft4YdbeUYdcGYYHWDy/IT6jJ2wMJfFUEEh8U/9A==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/smithy-client": "^3.1.12", - "@smithy/types": "^3.3.0", - "@smithy/util-hex-encoding": "^3.0.0", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, "node_modules/@aws-sdk/middleware-ssec": { "version": "3.609.0", "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-ssec/-/middleware-ssec-3.609.0.tgz",