diff --git a/.github/workflows/java-ec2-asg-test.yml b/.github/workflows/java-ec2-asg-test.yml index 127eb3248..267d050b8 100644 --- a/.github/workflows/java-ec2-asg-test.yml +++ b/.github/workflows/java-ec2-asg-test.yml @@ -14,6 +14,11 @@ on: caller-workflow-name: required: true type: string + cpu-architecture: + description: "Permitted values: x86_64 or arm64" + required: false + type: string + default: "x86_64" outputs: job-started: value: ${{ jobs.java-ec2-asg.outputs.job-started }} @@ -27,6 +32,7 @@ permissions: env: E2E_TEST_AWS_REGION: ${{ inputs.aws-region }} CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} + CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/main-service.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/remote-service.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} @@ -48,7 +54,7 @@ jobs: run: echo "job-started=true" >> $GITHUB_OUTPUT - name: Generate testing id - run: echo TESTING_ID="${{ github.job }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV + run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}-${RANDOM}" >> $GITHUB_ENV - uses: actions/checkout@v4 with: @@ -103,7 +109,11 @@ jobs: # Reusing the adot-main-build-staging-jar bucket to store the python wheel file echo GET_CW_AGENT_RPM_COMMAND= "aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ github.sha }}/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm ./cw-agent.rpm" >> $GITHUB_ENV else - echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ env.E2E_TEST_AWS_REGION }}.s3.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV + if [ "${{ env.CPU_ARCHITECTURE }}" = "x86_64" ]; then + echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV + elif [ "${{ env.CPU_ARCHITECTURE }}" = "arm64" ]; then + echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/arm64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV + fi fi - name: Set up terraform @@ -141,6 +151,7 @@ jobs: -var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \ -var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \ -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \ + -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index 0818ae15c..4ce2f4fcb 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -29,6 +29,7 @@ jobs: with: aws-region: ${{ matrix.aws-region }} caller-workflow-name: 'appsignals-e2e-ec2-canary-test' + cpu-architecture: 'x86_64' maven: uses: ./.github/workflows/java-ec2-default-retry.yml @@ -37,3 +38,4 @@ jobs: aws-region: 'us-east-1' caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' otel-source: 'maven' + cpu-architecture: 'x86_64' diff --git a/.github/workflows/java-ec2-default-retry.yml b/.github/workflows/java-ec2-default-retry.yml index ceb9eb31d..f0f5e85c4 100644 --- a/.github/workflows/java-ec2-default-retry.yml +++ b/.github/workflows/java-ec2-default-retry.yml @@ -14,6 +14,10 @@ on: caller-workflow-name: required: true type: string + cpu-architecture: + required: false + type: string + default: "x86_64" otel-source: required: false type: string @@ -31,6 +35,7 @@ jobs: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} otel-source: ${{ inputs.otel-source }} + cpu-architecture: ${{ inputs.cpu-architecture }} java-ec2-default-attempt-2: needs: [ java-ec2-default-attempt-1 ] @@ -41,6 +46,7 @@ jobs: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} otel-source: ${{ inputs.otel-source }} + cpu-architecture: ${{ inputs.cpu-architecture }} publish-metric-attempt-1: needs: [ java-ec2-default-attempt-1, java-ec2-default-attempt-2 ] diff --git a/.github/workflows/java-ec2-default-test.yml b/.github/workflows/java-ec2-default-test.yml index db3e16d6c..811b1a3bf 100644 --- a/.github/workflows/java-ec2-default-test.yml +++ b/.github/workflows/java-ec2-default-test.yml @@ -14,6 +14,11 @@ on: caller-workflow-name: required: true type: string + cpu-architecture: + description: "Permitted values: x86_64 or arm64" + required: false + type: string + default: "x86_64" otel-source: required: false type: string @@ -32,6 +37,7 @@ env: E2E_TEST_AWS_REGION: ${{ inputs.aws-region }} CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} OTEL_SOURCE: ${{ inputs.otel-source }} + CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/main-service.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/remote-service.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} @@ -112,7 +118,11 @@ jobs: # Reusing the adot-main-build-staging-jar bucket to store the python wheel file echo GET_CW_AGENT_RPM_COMMAND= "aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ github.sha }}/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm ./cw-agent.rpm" >> $GITHUB_ENV else - echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV + if [ "${{ env.CPU_ARCHITECTURE }}" = "x86_64" ]; then + echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV + elif [ "${{ env.CPU_ARCHITECTURE }}" = "arm64" ]; then + echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/arm64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV + fi fi - name: Set up terraform @@ -150,6 +160,7 @@ jobs: -var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \ -var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \ -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \ + -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then diff --git a/terraform/java/ec2/asg/main.tf b/terraform/java/ec2/asg/main.tf index d7559fcec..b930d51b4 100644 --- a/terraform/java/ec2/asg/main.tf +++ b/terraform/java/ec2/asg/main.tf @@ -53,7 +53,7 @@ data "aws_ami" "ami" { most_recent = true filter { name = "name" - values = ["al20*-ami-minimal-*-x86_64"] + values = ["al20*-ami-minimal-*-${var.cpu_architecture}"] } filter { name = "state" @@ -61,7 +61,7 @@ data "aws_ami" "ami" { } filter { name = "architecture" - values = ["x86_64"] + values = [var.cpu_architecture] } filter { name = "image-type" @@ -86,7 +86,7 @@ data "aws_ami" "ami" { resource "aws_launch_configuration" "launch_configuration" { image_id = data.aws_ami.ami.id - instance_type = "t3.micro" + instance_type = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro" key_name = local.ssh_key_name associate_public_ip_address = true iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE" @@ -158,7 +158,7 @@ resource "aws_autoscaling_group" "asg" { resource "aws_instance" "remote_service_instance" { ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) - instance_type = "t3.micro" + instance_type = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro" key_name = local.ssh_key_name iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE" vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id] diff --git a/terraform/java/ec2/asg/variables.tf b/terraform/java/ec2/asg/variables.tf index 65efa382c..72b70243d 100644 --- a/terraform/java/ec2/asg/variables.tf +++ b/terraform/java/ec2/asg/variables.tf @@ -43,4 +43,8 @@ variable "get_adot_jar_command" { variable "canary_type" { default = "java-ec2-asg" +} + +variable "cpu_architecture" { + default = "x86_64" } \ No newline at end of file diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index ba667e631..f432b8154 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -46,7 +46,7 @@ data "aws_ami" "ami" { most_recent = true filter { name = "name" - values = ["al20*-ami-minimal-*-x86_64"] + values = ["al20*-ami-minimal-*-${var.cpu_architecture}"] } filter { name = "state" @@ -54,7 +54,7 @@ data "aws_ami" "ami" { } filter { name = "architecture" - values = ["x86_64"] + values = [var.cpu_architecture] } filter { name = "image-type" @@ -79,7 +79,7 @@ data "aws_ami" "ami" { resource "aws_instance" "main_service_instance" { ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) - instance_type = "t3.micro" + instance_type = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro" key_name = local.ssh_key_name iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE" vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id] @@ -162,7 +162,7 @@ resource "null_resource" "main_service_setup" { resource "aws_instance" "remote_service_instance" { ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) - instance_type = "t3.micro" + instance_type = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro" key_name = local.ssh_key_name iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE" vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id] diff --git a/terraform/java/ec2/default/variables.tf b/terraform/java/ec2/default/variables.tf index 8b2750bb3..89c446c19 100644 --- a/terraform/java/ec2/default/variables.tf +++ b/terraform/java/ec2/default/variables.tf @@ -43,4 +43,8 @@ variable "get_adot_jar_command" { variable "canary_type" { default = "java-ec2-default" +} + +variable "cpu_architecture" { + default = "x86_64" } \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-trace.mustache index e04b35461..a4153fef4 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-trace.mustache @@ -24,7 +24,7 @@ "otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$", "otel.resource.host.id": "^{{instanceId}}$", "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "aws.span.kind": "^LOCAL_ROOT$", "otel.resource.host.name": "^{{privateDnsName}}$" } diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-trace.mustache index 50ea3ad85..22bb4a955 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-trace.mustache @@ -10,7 +10,7 @@ "otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$", "otel.resource.host.id": "^{{instanceId}}$", "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "otel.resource.host.name": "^{{privateDnsName}}$" } }, diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-trace.mustache index 628775049..245f07920 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-trace.mustache @@ -24,7 +24,7 @@ "otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$", "otel.resource.host.id": "^{{instanceId}}$", "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "otel.resource.host.name": "^{{privateDnsName}}$", "aws.span.kind": "^LOCAL_ROOT$" } diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-trace.mustache index 94207355e..d79ff91ca 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-trace.mustache @@ -25,7 +25,7 @@ "otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$", "otel.resource.host.id": "^{{instanceId}}$", "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "otel.resource.host.name": "^{{privateDnsName}}$", "aws.span.kind": "^LOCAL_ROOT$" } @@ -80,7 +80,7 @@ "EC2.InstanceId": "^i-[A-Za-z0-9]{17}$", "PlatformType": "^AWS::EC2$", "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "aws.span.kind": "^LOCAL_ROOT$" } }, diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-trace.mustache index 7f142b484..b91731e9a 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-trace.mustache @@ -22,7 +22,7 @@ "EC2.InstanceId": "^{{instanceId}}$", "PlatformType": "^AWS::EC2$", "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "aws.span.kind": "^LOCAL_ROOT$" } }, diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-trace.mustache index 2c6e8894e..5a7774e4b 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-trace.mustache @@ -8,7 +8,7 @@ "metadata": { "default": { "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$" + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" } }, "subsegments": [ diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-trace.mustache index 6134f0b81..503d48ab4 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-trace.mustache @@ -22,7 +22,7 @@ "EC2.InstanceId": "^{{instanceId}}$", "PlatformType": "^AWS::EC2$", "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "aws.span.kind": "^LOCAL_ROOT$" } }, diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-trace.mustache index 5dcbda9cd..7c171516c 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-trace.mustache @@ -22,7 +22,7 @@ "EC2.InstanceId": "^{{instanceId}}$", "PlatformType": "^AWS::EC2$", "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "aws.span.kind": "^LOCAL_ROOT$" } }, @@ -75,7 +75,7 @@ "EC2.InstanceId": "^i-[A-Za-z0-9]{17}$", "PlatformType": "^AWS::EC2$", "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t3.micro$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "aws.span.kind": "^LOCAL_ROOT$" } },