From c3d907d8fcb96a41cc935eb386ae8fabc658dacf Mon Sep 17 00:00:00 2001 From: kamyarz-aws <120507168+kamyarz-aws@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:20:07 -0500 Subject: [PATCH] Update to Version v3.3.3 (#221) --- CHANGELOG.md | 15 +++++++++ VERSION.txt | 2 +- .../Dockerfile | 4 +-- .../jar_updater.py | 4 +-- .../load-test.sh | 21 ++++++++++++ source/api-services/index.js | 33 ++++++++++++------- source/api-services/package-lock.json | 13 ++++---- source/api-services/package.json | 2 +- source/console/package-lock.json | 10 +++--- source/console/package.json | 2 +- source/custom-resource/package-lock.json | 13 ++++---- source/custom-resource/package.json | 2 +- .../lib/back-end/step-functions.ts | 11 +++++++ source/infrastructure/package-lock.json | 11 ++++--- source/infrastructure/package.json | 2 +- ...ted-load-testing-on-aws-stack.test.ts.snap | 2 +- .../__snapshots__/step-functions.test.ts.snap | 2 +- source/integration-tests/package-lock.json | 13 ++++---- source/metrics-utils/package-lock.json | 22 +++++++++---- source/metrics-utils/package.json | 2 +- source/package-lock.json | 11 ++++--- source/package.json | 2 +- .../package-lock.json | 13 ++++---- source/real-time-data-publisher/package.json | 2 +- source/results-parser/index.js | 25 +++++++++++--- source/results-parser/lib/index.spec.js | 17 +++++++--- source/results-parser/lib/parser/index.js | 5 +++ .../results-parser/lib/parser/index.spec.js | 24 ++++++++++++++ source/results-parser/package-lock.json | 13 ++++---- source/results-parser/package.json | 2 +- source/solution-utils/package-lock.json | 11 ++++--- source/solution-utils/package.json | 2 +- source/task-canceler/package-lock.json | 13 ++++---- source/task-canceler/package.json | 2 +- source/task-runner/package-lock.json | 13 ++++---- source/task-runner/package.json | 2 +- source/task-status-checker/package-lock.json | 13 ++++---- source/task-status-checker/package.json | 2 +- 38 files changed, 244 insertions(+), 114 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc8fa91..a3e8194 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.3.3] - 2024-11-22 + +### Security + +- Update `cross-spawn` to mitigate [CVE-2024-21538] +- Update `Werzeug` to mitigate [CVE-2024-49767] + +### Fixed + +- Update tika-core to v3.0.0 to resolve [https://github.com/aws-solutions/distributed-load-testing-on-aws/issues/214] + +### Updated + +- Updates on metrics collection process + ## [3.3.2] - 2024-11-01 ### Security diff --git a/VERSION.txt b/VERSION.txt index 5436ea0..3f09e91 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.2 \ No newline at end of file +3.3.3 \ No newline at end of file diff --git a/deployment/ecr/distributed-load-testing-on-aws-load-tester/Dockerfile b/deployment/ecr/distributed-load-testing-on-aws-load-tester/Dockerfile index 0c2af2b..3aec68b 100644 --- a/deployment/ecr/distributed-load-testing-on-aws-load-tester/Dockerfile +++ b/deployment/ecr/distributed-load-testing-on-aws-load-tester/Dockerfile @@ -2,7 +2,7 @@ FROM blazemeter/taurus:1.16.34 # taurus includes python and pip RUN /usr/bin/python3 -m pip install --upgrade pip RUN pip install --no-cache-dir awscli -RUN apt-get -y install --no-install-recommends xmlstarlet bc procps +RUN apt-get -y install --no-install-recommends xmlstarlet bc procps jq # Removing selenium and gatling from our image as they are not supported in DLT RUN rm -rf /root/.bzt/selenium-taurus @@ -32,7 +32,7 @@ RUN rm -rf /root/.bzt/python-packages/3.10.12/urllib3* RUN cp -r /usr/local/lib/python3.10/dist-packages/urllib3* /root/.bzt/python-packages/3.10.12/ # Replacing Werkzeug with more stable version to resolve vulnerabilities -RUN pip install Werkzeug==3.0.3 +RUN pip install Werkzeug==3.0.6 RUN rm -rf /root/.bzt/python-packages/3.10.12/werkzeug* RUN cp -r /usr/local/lib/python3.10/dist-packages/werkzeug* /root/.bzt/python-packages/3.10.12/ diff --git a/deployment/ecr/distributed-load-testing-on-aws-load-tester/jar_updater.py b/deployment/ecr/distributed-load-testing-on-aws-load-tester/jar_updater.py index 913f733..e7fe09c 100644 --- a/deployment/ecr/distributed-load-testing-on-aws-load-tester/jar_updater.py +++ b/deployment/ecr/distributed-load-testing-on-aws-load-tester/jar_updater.py @@ -17,7 +17,7 @@ * batik-transcoder v1.14 will be replaced with v1.17 * lets-plot-batik v2.2.1 will be replaced with 4.2.0 * commons-net v3.8.0 will be replaced with v3.9.0 - * tika-core v1.28.3 will be replaced with v2.9.2 + * tika-core v1.28.3 will be replaced with v3.0.0 * json-path v2.7.0 will be replaced with v2.9.0 * dnsjava v2.1.9 will be replaced with v3.6.1 @@ -35,7 +35,7 @@ "batik-transcoder": "org/apache/xmlgraphics/batik-transcoder/1.17/batik-transcoder-1.17.jar", "lets-plot-batik": "org/jetbrains/lets-plot/lets-plot-batik/4.2.0/lets-plot-batik-4.2.0.jar", "commons-net": "commons-net/commons-net/3.9.0/commons-net-3.9.0.jar", - "tika-core": "org/apache/tika/tika-core/2.9.2/tika-core-2.9.2.jar", + "tika-core": "org/apache/tika/tika-core/3.0.0/tika-core-3.0.0.jar", "json-path": "com/jayway/jsonpath/json-path/2.9.0/json-path-2.9.0.jar", "dnsjava": "dnsjava/dnsjava/3.6.1/dnsjava-3.6.1.jar" } diff --git a/deployment/ecr/distributed-load-testing-on-aws-load-tester/load-test.sh b/deployment/ecr/distributed-load-testing-on-aws-load-tester/load-test.sh index 1fd95cf..f7a016c 100644 --- a/deployment/ecr/distributed-load-testing-on-aws-load-tester/load-test.sh +++ b/deployment/ecr/distributed-load-testing-on-aws-load-tester/load-test.sh @@ -12,6 +12,10 @@ echo "UUID:: ${UUID}" echo "LIVE_DATA_ENABLED:: ${LIVE_DATA_ENABLED}" echo "MAIN_STACK_REGION:: ${MAIN_STACK_REGION}" +cat /proc/self/cgroup +TASK_ID=$(cat /proc/self/cgroup | grep -oE '[a-f0-9]{32}' | head -n 1) +echo $TASK_ID + sigterm_handler() { if [ $pypid -ne 0 ]; then echo "container received SIGTERM." @@ -146,6 +150,23 @@ if [ "$TEST_TYPE" != "simple" ]; then fi if [ -f /tmp/artifacts/results.xml ]; then + + # Insert the Task ID at the same level as + curl -s $ECS_CONTAINER_METADATA_URI_V4/task + Task_CPU=$(curl -s $ECS_CONTAINER_METADATA_URI_V4/task | jq '.Limits.CPU') + Task_Memory=$(curl -s $ECS_CONTAINER_METADATA_URI_V4/task | jq '.Limits.Memory') + START_TIME=$(curl -s "$ECS_CONTAINER_METADATA_URI_V4/task" | jq -r '.Containers[0].StartedAt') + # Convert start time to seconds since epoch + START_TIME_EPOCH=$(date -d "$START_TIME" +%s) + # Calculate elapsed time in seconds + CURRENT_TIME_EPOCH=$(date +%s) + ECS_DURATION=$((CURRENT_TIME_EPOCH - START_TIME_EPOCH)) + + xmlstarlet ed -P -L -s "/FinalStatus" -t elem -n "TaskId" -v "$TASK_ID" /tmp/artifacts/results.xml + xmlstarlet ed -P -L -s "/FinalStatus" -t elem -n "TaskCPU" -v "$Task_CPU" /tmp/artifacts/results.xml + xmlstarlet ed -P -L -s "/FinalStatus" -t elem -n "TaskMemory" -v "$Task_Memory" /tmp/artifacts/results.xml + xmlstarlet ed -P -L -s "/FinalStatus" -t elem -n "ECSDuration" -v "$ECS_DURATION" /tmp/artifacts/results.xml + echo "Validating Test Duration" TEST_DURATION=`xmlstarlet sel -t -v "/FinalStatus/TestDuration" /tmp/artifacts/results.xml` diff --git a/source/api-services/index.js b/source/api-services/index.js index b2e7f1c..f122340 100644 --- a/source/api-services/index.js +++ b/source/api-services/index.js @@ -28,6 +28,26 @@ class APIHandler { throw this.errorMsg; } + async sendMetrics(config, data) { + if (process.env.SEND_METRIC === "Yes") { + let taskCountObj = {}; + for (const testTaskConfig of config.testTaskConfigs) { + taskCountObj[testTaskConfig.region] = testTaskConfig.taskCount; + } + await utils.sendMetric({ + Type: "TestCreate", + TestType: config.testType, + FileType: config.fileType || (config.testType === "simple" ? "none" : "script"), + TaskCountPerRegion: taskCountObj, + TestId: data.testId, + TestScheduleStep: config.scheduleStep, + HoldFor: config.testScenario.execution[0]["hold-for"], + RampUp: config.testScenario.execution[0]["ramp-up"], + CronValue: config.cronValue, + TestEventBridgeScheduled: config.eventBridge, + }); + } + } // Handle the /scenarios endpoint async handleScenarios(config, queryParams, body, functionName, functionArn) { let data; @@ -53,18 +73,7 @@ class APIHandler { } // Handle creating test else data = await scenarios.createTest(config, functionName); - if (process.env.SEND_METRIC === "Yes") { - await utils.sendMetric({ - Type: "TaskCreate", - TestType: config.testType, - FileType: config.fileType || (config.testType === "simple" ? "none" : "script"), - TaskCount: config.taskCount, - TestId: data.testId, - TestScheduleStep: config.scheduleStep, - CronValue: config.cronValue, - TestEventBridgeScheduled: config.eventBridge, - }); - } + await this.sendMetrics(config, data); return data; default: throw this.errorMsg; diff --git a/source/api-services/package-lock.json b/source/api-services/package-lock.json index dbc257e..2bbdd6b 100644 --- a/source/api-services/package-lock.json +++ b/source/api-services/package-lock.json @@ -1,12 +1,12 @@ { "name": "api-services", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "api-services", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "aws-sdk": "^2.1001.0", @@ -23,7 +23,7 @@ } }, "../solution-utils": { - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "axios": "^1.6.0", @@ -1687,10 +1687,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/api-services/package.json b/source/api-services/package.json index 683ab8d..04146d1 100644 --- a/source/api-services/package.json +++ b/source/api-services/package.json @@ -1,6 +1,6 @@ { "name": "api-services", - "version": "3.3.2", + "version": "3.3.3", "description": "REST API micro services", "repository": { "type": "git", diff --git a/source/console/package-lock.json b/source/console/package-lock.json index c85ca5d..375f262 100644 --- a/source/console/package-lock.json +++ b/source/console/package-lock.json @@ -1,12 +1,12 @@ { "name": "distributed-load-testing-on-aws-ui", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "distributed-load-testing-on-aws-ui", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "@aws-amplify/pubsub": "^6.0.16", @@ -39,7 +39,7 @@ } }, "../solution-utils": { - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "axios": "^1.6.0", @@ -9068,7 +9068,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "license": "MIT", "dependencies": { "path-key": "^3.1.0", diff --git a/source/console/package.json b/source/console/package.json index 5a126a1..c346a1e 100644 --- a/source/console/package.json +++ b/source/console/package.json @@ -1,6 +1,6 @@ { "name": "distributed-load-testing-on-aws-ui", - "version": "3.3.2", + "version": "3.3.3", "private": true, "license": "Apache-2.0", "author": { diff --git a/source/custom-resource/package-lock.json b/source/custom-resource/package-lock.json index 11f267f..e45f7f0 100644 --- a/source/custom-resource/package-lock.json +++ b/source/custom-resource/package-lock.json @@ -1,12 +1,12 @@ { "name": "custom-resource", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "custom-resource", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "aws-sdk": "^2.1001.0", @@ -24,7 +24,7 @@ } }, "../solution-utils": { - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "axios": "^1.6.0", @@ -1703,10 +1703,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/custom-resource/package.json b/source/custom-resource/package.json index b0b234f..d1eca8a 100644 --- a/source/custom-resource/package.json +++ b/source/custom-resource/package.json @@ -1,6 +1,6 @@ { "name": "custom-resource", - "version": "3.3.2", + "version": "3.3.3", "description": "cfn custom resources for distributed load testing on AWS workflow", "repository": { "type": "git", diff --git a/source/infrastructure/lib/back-end/step-functions.ts b/source/infrastructure/lib/back-end/step-functions.ts index c986078..aff8e1a 100644 --- a/source/infrastructure/lib/back-end/step-functions.ts +++ b/source/infrastructure/lib/back-end/step-functions.ts @@ -15,6 +15,7 @@ import { WaitTime, JsonPath, DefinitionBody, + TaskInput, } from "aws-cdk-lib/aws-stepfunctions"; import { LambdaInvoke } from "aws-cdk-lib/aws-stepfunctions-tasks"; import { Aws, CfnResource, Duration } from "aws-cdk-lib"; @@ -61,6 +62,16 @@ export class TaskRunnerStepFunctionConstruct extends Construct { const mapEnd = new Pass(this, "Map End"); const parseResult = new LambdaInvoke(this, "Parse result", { lambdaFunction: props.resultsParser, + payload: TaskInput.fromObject({ + "testTaskConfig.$": "$.testTaskConfig", + "testId.$": "$.testId", + "testType.$": "$.testType", + "fileType.$": "$.fileType", + "showLive.$": "$.showLive", + "testDuration.$": "$.testDuration", + "prefix.$": "$.prefix", + "executionStart.$": "$$.Execution.StartTime", + }), }); parseResult.next(done); diff --git a/source/infrastructure/package-lock.json b/source/infrastructure/package-lock.json index a0b437f..db6a867 100644 --- a/source/infrastructure/package-lock.json +++ b/source/infrastructure/package-lock.json @@ -1,12 +1,12 @@ { "name": "distributed-load-testing-on-aws-infrastructure", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "distributed-load-testing-on-aws-infrastructure", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "source-map-support": "^0.5.16" @@ -2403,10 +2403,11 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/infrastructure/package.json b/source/infrastructure/package.json index 7a048d4..2f3e6d5 100644 --- a/source/infrastructure/package.json +++ b/source/infrastructure/package.json @@ -1,6 +1,6 @@ { "name": "distributed-load-testing-on-aws-infrastructure", - "version": "3.3.2", + "version": "3.3.3", "author": { "name": "Amazon Web Services", "url": "https://aws.amazon.com/solutions" diff --git a/source/infrastructure/test/__snapshots__/distributed-load-testing-on-aws-stack.test.ts.snap b/source/infrastructure/test/__snapshots__/distributed-load-testing-on-aws-stack.test.ts.snap index 18da958..5235bdf 100644 --- a/source/infrastructure/test/__snapshots__/distributed-load-testing-on-aws-stack.test.ts.snap +++ b/source/infrastructure/test/__snapshots__/distributed-load-testing-on-aws-stack.test.ts.snap @@ -4600,7 +4600,7 @@ exports[`Distributed Load Testing stack test 1`] = ` "Arn", ], }, - "","Payload.$":"$"}},"Done":{"Type":"Succeed"}}}", + "","Payload":{"testTaskConfig.$":"$.testTaskConfig","testId.$":"$.testId","testType.$":"$.testType","fileType.$":"$.fileType","showLive.$":"$.showLive","testDuration.$":"$.testDuration","prefix.$":"$.prefix","executionStart.$":"$$.Execution.StartTime"}}},"Done":{"Type":"Succeed"}}}", ], ], }, diff --git a/source/infrastructure/test/__snapshots__/step-functions.test.ts.snap b/source/infrastructure/test/__snapshots__/step-functions.test.ts.snap index e5a021a..d823699 100644 --- a/source/infrastructure/test/__snapshots__/step-functions.test.ts.snap +++ b/source/infrastructure/test/__snapshots__/step-functions.test.ts.snap @@ -121,7 +121,7 @@ exports[`DLT API Test 1`] = ` "Arn", ], }, - "","Payload.$":"$"}},"Done":{"Type":"Succeed"}}}", + "","Payload":{"testTaskConfig.$":"$.testTaskConfig","testId.$":"$.testId","testType.$":"$.testType","fileType.$":"$.fileType","showLive.$":"$.showLive","testDuration.$":"$.testDuration","prefix.$":"$.prefix","executionStart.$":"$$.Execution.StartTime"}}},"Done":{"Type":"Succeed"}}}", ], ], }, diff --git a/source/integration-tests/package-lock.json b/source/integration-tests/package-lock.json index 3321583..147425d 100644 --- a/source/integration-tests/package-lock.json +++ b/source/integration-tests/package-lock.json @@ -4212,9 +4212,10 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -12778,9 +12779,9 @@ "dev": true }, "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/metrics-utils/package-lock.json b/source/metrics-utils/package-lock.json index b8619e0..0d4233d 100644 --- a/source/metrics-utils/package-lock.json +++ b/source/metrics-utils/package-lock.json @@ -1,12 +1,13 @@ { "name": "metrics-utils", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "metrics-utils", - "version": "3.3.2", + "version": "3.3.3", + "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-cloudwatch": "^3.637.0", "@aws-sdk/client-cloudwatch-logs": "^3.637.0", @@ -3307,7 +3308,8 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "node_modules/bowser": { "version": "2.11.0", @@ -3318,6 +3320,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3540,7 +3543,8 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/constructs": { "version": "10.3.0", @@ -3578,10 +3582,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -3626,6 +3631,7 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -5056,6 +5062,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -5399,6 +5406,7 @@ "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, "bin": { "semver": "bin/semver.js" } diff --git a/source/metrics-utils/package.json b/source/metrics-utils/package.json index 5be5679..cebd4b1 100644 --- a/source/metrics-utils/package.json +++ b/source/metrics-utils/package.json @@ -1,6 +1,6 @@ { "name": "metrics-utils", - "version": "3.3.2", + "version": "3.3.3", "main": "index.ts", "license": "Apache-2.0", "description": "Distributed Load Testing on AWS Ops Metrics", diff --git a/source/package-lock.json b/source/package-lock.json index 94d0812..fe01d65 100644 --- a/source/package-lock.json +++ b/source/package-lock.json @@ -1,12 +1,12 @@ { "name": "source", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "source", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "devDependencies": { "@types/node": "^18.8.0", @@ -756,10 +756,11 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/package.json b/source/package.json index 0791e8a..78951ae 100644 --- a/source/package.json +++ b/source/package.json @@ -1,6 +1,6 @@ { "name": "source", - "version": "3.3.2", + "version": "3.3.3", "private": true, "description": "ESLint and prettier dependencies to be used within the solution", "license": "Apache-2.0", diff --git a/source/real-time-data-publisher/package-lock.json b/source/real-time-data-publisher/package-lock.json index aa87dab..135afad 100644 --- a/source/real-time-data-publisher/package-lock.json +++ b/source/real-time-data-publisher/package-lock.json @@ -1,12 +1,12 @@ { "name": "real-time-data-publisher", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "real-time-data-publisher", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "aws-sdk": "^2.1001.0", @@ -20,7 +20,7 @@ } }, "../solution-utils": { - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "axios": "^1.6.0", @@ -1634,10 +1634,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/real-time-data-publisher/package.json b/source/real-time-data-publisher/package.json index 30d530d..e2d8df6 100644 --- a/source/real-time-data-publisher/package.json +++ b/source/real-time-data-publisher/package.json @@ -1,6 +1,6 @@ { "name": "real-time-data-publisher", - "version": "3.3.2", + "version": "3.3.3", "description": "Publishes real time test data to an IoT endpoint", "repository": { "type": "git", diff --git a/source/results-parser/index.js b/source/results-parser/index.js index ae347d0..e663035 100644 --- a/source/results-parser/index.js +++ b/source/results-parser/index.js @@ -6,6 +6,7 @@ const AWS = require("aws-sdk"); const utils = require("solution-utils"); let options = utils.getOptions({}); const s3 = new AWS.S3(options); + const dynamoDb = new AWS.DynamoDB.DocumentClient(options); const parseResults = async (eventConfigs, testId, endTime, startTime, totalDuration, resultList) => { @@ -26,6 +27,17 @@ const parseResults = async (eventConfigs, testId, endTime, startTime, totalDurat let duration = parseInt(parsedResult.duration); totalDuration += isNaN(duration) ? 0 : duration; data.push(parsedResult); + + // Send anonymized metrics + if (process.env.SEND_METRIC === "Yes") + await utils.sendMetric({ + Type: "TaskCompletion", + TaskVCPU: parsedResult.taskCPU, + TaskMemory: parsedResult.taskMemory, + ECSCalculatedDuration: parsedResult.ecsDuration, + TaskId: parsedResult.taskId, + TestId: testId, + }); } //record regional data @@ -191,7 +203,7 @@ const getFilesByRegion = async (resultList) => { exports.handler = async (event) => { console.log(JSON.stringify(event, null, 2)); - const { testId, fileType, prefix, testTaskConfig: eventConfigs } = event; + const { testId, fileType, prefix, testTaskConfig: eventConfigs, executionStart: testStartTime } = event; const endTime = new Date() .toISOString() .replace("T", " ") @@ -225,15 +237,20 @@ exports.handler = async (event) => { } // Send anonymized metrics - if (process.env.SEND_METRIC === "Yes") + if (process.env.SEND_METRIC === "Yes") { + const currentTime = new Date(); + const durationMilliseconds = currentTime - new Date(testStartTime); + const durationSeconds = durationMilliseconds / 1000; + await utils.sendMetric({ - Type: "TaskCompletion", + Type: "TestCompletion", TestType: testType, FileType: fileType || (testType === "simple" ? "none" : "script"), TestResult: testResult, - Duration: totalDuration, + Duration: durationSeconds, TestId: testId, }); + } return "success"; } catch (error) { console.error(error); diff --git a/source/results-parser/lib/index.spec.js b/source/results-parser/lib/index.spec.js index ea5bad0..cc4574b 100644 --- a/source/results-parser/lib/index.spec.js +++ b/source/results-parser/lib/index.spec.js @@ -97,11 +97,18 @@ describe("Handler", () => { await handler(mockResultParserEvent); // Assert - expect(mockSolutionUtils.sendMetric.mock.calls).toHaveLength(1); + expect(mockSolutionUtils.sendMetric.mock.calls).toHaveLength(2); + expect(mockSolutionUtils.sendMetric.mock.calls[0][0]).toHaveProperty("Type", "TaskCompletion"); - expect(mockSolutionUtils.sendMetric.mock.calls[0][0]).toHaveProperty("FileType"); - expect(mockSolutionUtils.sendMetric.mock.calls[0][0]).toHaveProperty("TestType"); - expect(mockSolutionUtils.sendMetric.mock.calls[0][0]).toHaveProperty("Duration"); - expect(mockSolutionUtils.sendMetric.mock.calls[0][0]).toHaveProperty("TestResult"); + expect(mockSolutionUtils.sendMetric.mock.calls[0][0]).toHaveProperty("TaskVCPU"); + expect(mockSolutionUtils.sendMetric.mock.calls[0][0]).toHaveProperty("TaskMemory"); + expect(mockSolutionUtils.sendMetric.mock.calls[0][0]).toHaveProperty("ECSCalculatedDuration"); + expect(mockSolutionUtils.sendMetric.mock.calls[0][0]).toHaveProperty("TaskId"); + + expect(mockSolutionUtils.sendMetric.mock.calls[1][0]).toHaveProperty("Type", "TestCompletion"); + expect(mockSolutionUtils.sendMetric.mock.calls[1][0]).toHaveProperty("FileType"); + expect(mockSolutionUtils.sendMetric.mock.calls[1][0]).toHaveProperty("TestType"); + expect(mockSolutionUtils.sendMetric.mock.calls[1][0]).toHaveProperty("Duration"); + expect(mockSolutionUtils.sendMetric.mock.calls[1][0]).toHaveProperty("TestResult"); }); }); diff --git a/source/results-parser/lib/parser/index.js b/source/results-parser/lib/parser/index.js index 1cf816c..586c98e 100644 --- a/source/results-parser/lib/parser/index.js +++ b/source/results-parser/lib/parser/index.js @@ -101,10 +101,15 @@ function results(content, testId) { } } result.testDuration = jsonData.TestDuration._text; + return { stats: result, labels, duration: jsonData.TestDuration._text, + taskId: jsonData.TaskId._text, + taskCPU: jsonData.TaskCPU._text, + taskMemory: jsonData.TaskMemory._text, + ecsDuration: jsonData.ECSDuration._text, }; } catch (error) { console.error("results function error", error); diff --git a/source/results-parser/lib/parser/index.spec.js b/source/results-parser/lib/parser/index.spec.js index 721641e..2f11dd2 100644 --- a/source/results-parser/lib/parser/index.spec.js +++ b/source/results-parser/lib/parser/index.spec.js @@ -40,6 +40,18 @@ describe("#RESULTS PARSER::", () => { TestDuration: { _text: 123, }, + TaskId: { + _text: "abcd", + }, + TaskCPU: { + _text: "2", + }, + TaskMemory: { + _text: "2048", + }, + ECSDuration: { + _text: 123, + }, Group: [ { _attributes: { @@ -133,6 +145,18 @@ describe("#RESULTS PARSER::", () => { TestDuration: { _text: 120, }, + TaskId: { + _text: "abcd", + }, + TaskCPU: { + _text: "2", + }, + TaskMemory: { + _text: "2048", + }, + ECSDuration: { + _text: 123, + }, Group: [ { _attributes: { diff --git a/source/results-parser/package-lock.json b/source/results-parser/package-lock.json index 025c66e..2e3dc5b 100644 --- a/source/results-parser/package-lock.json +++ b/source/results-parser/package-lock.json @@ -1,12 +1,12 @@ { "name": "results-parser", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "results-parser", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "aws-sdk": "^2.1001.0", @@ -23,7 +23,7 @@ } }, "../solution-utils": { - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "axios": "^1.6.0", @@ -1676,10 +1676,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/results-parser/package.json b/source/results-parser/package.json index 233f89c..7bc531e 100644 --- a/source/results-parser/package.json +++ b/source/results-parser/package.json @@ -1,6 +1,6 @@ { "name": "results-parser", - "version": "3.3.2", + "version": "3.3.3", "description": "result parser for indexing xml test results to DynamoDB", "repository": { "type": "git", diff --git a/source/solution-utils/package-lock.json b/source/solution-utils/package-lock.json index 7d3e716..7114c34 100644 --- a/source/solution-utils/package-lock.json +++ b/source/solution-utils/package-lock.json @@ -1,12 +1,12 @@ { "name": "solution-utils", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "solution-utils", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "axios": "^1.6.0", @@ -1582,10 +1582,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/solution-utils/package.json b/source/solution-utils/package.json index 7d95b40..a5396de 100644 --- a/source/solution-utils/package.json +++ b/source/solution-utils/package.json @@ -1,6 +1,6 @@ { "name": "solution-utils", - "version": "3.3.2", + "version": "3.3.3", "description": "Utilities package for Distributed Load Testing on AWS", "license": "Apache-2.0", "author": { diff --git a/source/task-canceler/package-lock.json b/source/task-canceler/package-lock.json index 6b5560a..97303c0 100644 --- a/source/task-canceler/package-lock.json +++ b/source/task-canceler/package-lock.json @@ -1,12 +1,12 @@ { "name": "task-canceler", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "task-canceler", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "aws-sdk": "^2.1001.0", @@ -20,7 +20,7 @@ } }, "../solution-utils": { - "version": "3.3.0", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "axios": "^1.6.0", @@ -1634,10 +1634,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/task-canceler/package.json b/source/task-canceler/package.json index 5158825..cda5f17 100644 --- a/source/task-canceler/package.json +++ b/source/task-canceler/package.json @@ -1,6 +1,6 @@ { "name": "task-canceler", - "version": "3.3.2", + "version": "3.3.3", "description": "Triggered by api-services lambda function, cancels ecs tasks", "repository": { "type": "git", diff --git a/source/task-runner/package-lock.json b/source/task-runner/package-lock.json index 533c3b0..3076c0f 100644 --- a/source/task-runner/package-lock.json +++ b/source/task-runner/package-lock.json @@ -1,12 +1,12 @@ { "name": "task-runner", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "task-runner", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "aws-sdk": "^2.1001.0", @@ -21,7 +21,7 @@ } }, "../solution-utils": { - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "axios": "^1.6.0", @@ -1635,10 +1635,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/task-runner/package.json b/source/task-runner/package.json index d74237d..d673539 100644 --- a/source/task-runner/package.json +++ b/source/task-runner/package.json @@ -1,6 +1,6 @@ { "name": "task-runner", - "version": "3.3.2", + "version": "3.3.3", "description": "Triggered by Step Functions, runs ecs task Definitions", "repository": { "type": "git", diff --git a/source/task-status-checker/package-lock.json b/source/task-status-checker/package-lock.json index 9a17ea4..7c18c61 100644 --- a/source/task-status-checker/package-lock.json +++ b/source/task-status-checker/package-lock.json @@ -1,12 +1,12 @@ { "name": "task-status-checker", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "task-status-checker", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "aws-sdk": "^2.1001.0", @@ -20,7 +20,7 @@ } }, "../solution-utils": { - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "dependencies": { "axios": "^1.6.0", @@ -1634,10 +1634,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/source/task-status-checker/package.json b/source/task-status-checker/package.json index 721633d..9bfac14 100644 --- a/source/task-status-checker/package.json +++ b/source/task-status-checker/package.json @@ -1,6 +1,6 @@ { "name": "task-status-checker", - "version": "3.3.2", + "version": "3.3.3", "description": "checks if tasks are running or not", "repository": { "type": "git",