diff --git a/.github/workflows/node-lambda-layer-perf-test.yml b/.github/workflows/node-lambda-layer-perf-test.yml new file mode 100644 index 000000000..3955ae20e --- /dev/null +++ b/.github/workflows/node-lambda-layer-perf-test.yml @@ -0,0 +1,119 @@ +## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +## SPDX-License-Identifier: Apache-2.0 +name: Node Lambda Layer Performance Test +on: + workflow_dispatch: + inputs: + test_runs: + description: 'Number of test runs to perform' + required: true + default: 20 + type: number + + node_version: + description: 'The Node.js version to run the test' + required: true + default: '22' + type: string + +jobs: + node-lambda-layer-performance-test: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + + env: + NUM_TEST_RUNS: ${{ github.event.inputs.test_runs }} + + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}:role/${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} + aws-region: us-east-1 + + - name: Checkout aws-otel-js-instrumentation + uses: actions/checkout@v4 + with: + repository: aws-observability/aws-otel-js-instrumentation + path: aws-otel-js-instrumentation + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ github.event.inputs.node_version }} + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + + - name: Build Lambda Layer + run: | + cd aws-otel-js-instrumentation/lambda-layer + chmod +x build.sh + ./build.sh + + - name: Deploy Node.js Sample App and Lambda Layer + run: | + cd aws-otel-js-instrumentation/lambda-layer/sample-apps/aws-sdk + npm install + + cd ../../terraform/lambda + terraform init + terraform apply -auto-approve + + - name: Checkout current repository + uses: actions/checkout@v4 + with: + path: current-repo + + - name: Run Cold Start Iterations for Base Lambda + Lambda Layer + run: | + cd current-repo + chmod +x lambda-layer-perf-test/lambda-layer-run.sh + ./lambda-layer-perf-test/lambda-layer-run.sh false aws-opentelemetry-distro-nodejs + + - name: Remove Application Signals Lambda Layer + run: | + echo "Removing Lambda layer..." + + OUTPUT=$(aws lambda update-function-configuration \ + --function-name aws-opentelemetry-distro-nodejs \ + --layers []) + + echo "Lambda configuration:" + echo "$OUTPUT" + + LAYERS=$(echo "$OUTPUT" | jq -r '.Layers | length') + + if [ "$LAYERS" -ne 0 ]; then + echo "::error::Found $LAYERS layer(s) still attached to the function" + echo "::error::Layer details:" + echo "$OUTPUT" | jq -r '.Layers' + exit 1 + else + echo "✅ Layers successfully removed" + fi + + - name: Run Cold Start Iterations for Base Lambda + run: | + cd current-repo + chmod +x lambda-layer-perf-test/lambda-layer-run.sh + ./lambda-layer-perf-test/lambda-layer-run.sh true aws-opentelemetry-distro-nodejs + + - name: Upload test results + uses: actions/upload-artifact@v4 + with: + name: performance-test-results + path: | + no_layer_results.txt + layer_results.txt + retention-days: 90 + + - name: Cleanup Terraform Resources + if: success() || failure() || cancelled() + run: | + cd aws-otel-js-instrumentation/lambda-layer/terraform/lambda + echo "Starting Terraform cleanup..." + terraform init + terraform destroy -auto-approve \ No newline at end of file diff --git a/.github/workflows/python-lambda-layer-perf-test.yml b/.github/workflows/python-lambda-layer-perf-test.yml index 9288ce610..38d1c259e 100644 --- a/.github/workflows/python-lambda-layer-perf-test.yml +++ b/.github/workflows/python-lambda-layer-perf-test.yml @@ -9,6 +9,13 @@ on: required: true default: 20 type: number + + python_version: + description: 'The Python version to run the test' + required: true + default: '3.13' + type: string + jobs: python-lambda-layer-performance-test: runs-on: ubuntu-latest @@ -35,7 +42,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.13' + python-version: ${{ github.event.inputs.python_version }} - name: Setup Terraform uses: hashicorp/setup-terraform@v2