From 4245e9fae20a111305bea3d08c18bacbd6b0f4f5 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Thu, 9 Jan 2025 13:18:34 -0800 Subject: [PATCH 01/18] Generating unique test ids for different version tests --- .github/workflows/dotnet-ec2-default-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-ec2-default-test.yml b/.github/workflows/dotnet-ec2-default-test.yml index ef1f5ceb4..6351daa92 100644 --- a/.github/workflows/dotnet-ec2-default-test.yml +++ b/.github/workflows/dotnet-ec2-default-test.yml @@ -73,7 +73,7 @@ jobs: sleep_time: 60 - 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 - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 From 2a0a3e2ed0cc29a332bab5cda3c5dc05637ac2a7 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Wed, 22 Jan 2025 14:15:48 -0800 Subject: [PATCH 02/18] Adding ubuntu test --- .github/workflows/java-ec2-canary.yml | 11 +-- .github/workflows/java-ec2-default-retry.yml | 6 ++ .github/workflows/java-ec2-default-test.yml | 14 ++- .../traffic-generator-image-build.yml | 12 +-- terraform/java/ec2/default/main.tf | 94 +++++++++++++------ terraform/java/ec2/default/variables.tf | 4 + 6 files changed, 95 insertions(+), 46 deletions(-) diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index 79a7555d2..fbd46a845 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -7,8 +7,9 @@ ## including logs, metrics, and traces. name: Java EC2 Enablement Canary Testing on: - schedule: - - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour + # schedule: + # - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour + push: workflow_dispatch: # be able to run the workflow on demand permissions: @@ -20,10 +21,7 @@ jobs: strategy: fail-fast: false matrix: - aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', - 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', - 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', - 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] + aws-region: ['us-east-1'] uses: ./.github/workflows/java-ec2-default-retry.yml secrets: inherit with: @@ -31,6 +29,7 @@ jobs: caller-workflow-name: 'appsignals-e2e-ec2-canary-test' java-version: '11' cpu-architecture: 'x86_64' + operating-system: 'al2' maven: uses: ./.github/workflows/java-ec2-default-retry.yml diff --git a/.github/workflows/java-ec2-default-retry.yml b/.github/workflows/java-ec2-default-retry.yml index 77edc7aca..8c6ce4314 100644 --- a/.github/workflows/java-ec2-default-retry.yml +++ b/.github/workflows/java-ec2-default-retry.yml @@ -25,6 +25,10 @@ on: required: false type: string default: 'github' + operating-system: + required: false + type: string + default: 'al2' permissions: id-token: write @@ -40,6 +44,7 @@ jobs: java-version: ${{ inputs.java-version }} otel-source: ${{ inputs.otel-source }} cpu-architecture: ${{ inputs.cpu-architecture }} + operating-system: ${{ inputs.operating-system }} java-ec2-default-attempt-2: needs: [ java-ec2-default-attempt-1 ] @@ -52,6 +57,7 @@ jobs: java-version: ${{ inputs.java-version }} otel-source: ${{ inputs.otel-source }} cpu-architecture: ${{ inputs.cpu-architecture }} + operating-system: ${{ inputs.operating-system }} 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 5d288b8cc..97204d731 100644 --- a/.github/workflows/java-ec2-default-test.yml +++ b/.github/workflows/java-ec2-default-test.yml @@ -28,6 +28,10 @@ on: required: false type: string default: 'github' + operating-system: + required: false + type: string + default: 'al2' outputs: job-started: value: ${{ jobs.java-ec2-default.outputs.job-started }} @@ -44,8 +48,9 @@ env: JAVA_VERSION: ${{ inputs.java-version }} OTEL_SOURCE: ${{ inputs.otel-source }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v${{ inputs.java-version }}.jar - SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v${{ inputs.java-version }}.jar + OPERATING_SYSTEM: ${{ inputs.operating-system }} + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-main-service-v${{ inputs.java-version }}.jar + SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-remote-service-v${{ inputs.java-version }}.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -69,7 +74,7 @@ jobs: - uses: actions/checkout@v4 with: - repository: 'aws-observability/aws-application-signals-test-framework' + repository: 'Jeel-mehta/aws-application-signals-test-framework' ref: ${{ env.CALLER_WORKFLOW_NAME == 'main-build' && 'main' || github.ref }} fetch-depth: 0 @@ -123,6 +128,8 @@ jobs: if [ "${{ github.event.repository.name }}" = "amazon-cloudwatch-agent" ]; then # 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 + elif [ "${{ env.OPERATING_SYSTEM }}" = "ubuntu" ]; then + echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.deb https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb" >> $GITHUB_ENV else 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 @@ -168,6 +175,7 @@ jobs: -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \ -var="language_version=${{ env.JAVA_VERSION }}" \ -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ + -var="operating_system=${{ env.OPERATING_SYSTEM }}" \ || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then diff --git a/.github/workflows/traffic-generator-image-build.yml b/.github/workflows/traffic-generator-image-build.yml index ad8808050..17ddb973f 100644 --- a/.github/workflows/traffic-generator-image-build.yml +++ b/.github/workflows/traffic-generator-image-build.yml @@ -23,10 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', - 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', - 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', - 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] + aws-region: ['us-east-1'] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -67,10 +64,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', - 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', - 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', - 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] + aws-region: ['us-east-1'] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -97,4 +91,4 @@ jobs: working-directory: sample-apps/traffic-generator run: | zip traffic-generator.zip ./index.js ./package.json - aws s3 cp traffic-generator.zip s3://aws-appsignals-sample-app-prod-${{ matrix.aws-region }}/traffic-generator.zip \ No newline at end of file + aws s3 cp traffic-generator.zip s3://aws-appsignals-sample-app-prod-jeel/traffic-generator.zip \ No newline at end of file diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 8dfb6905a..4b414293d 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -39,6 +39,10 @@ resource "aws_key_pair" "aws_ssh_key" { locals { ssh_key_name = aws_key_pair.aws_ssh_key.key_name private_key_content = tls_private_key.ssh_key.private_key_pem + os_configs={ + "ubuntu" = "ubuntu/images/hvm-ssd/ubuntu-22.04-*-${var.cpu_architecture}-server-*" + "al2" = "al20*-ami-minimal-*-${var.cpu_architecture}" + } } data "aws_ami" "ami" { @@ -46,7 +50,7 @@ data "aws_ami" "ami" { most_recent = true filter { name = "name" - values = ["al20*-ami-minimal-*-${var.cpu_architecture}"] + values = [local.os_configs[var.operating_system]] } filter { name = "state" @@ -102,7 +106,7 @@ resource "aws_instance" "main_service_instance" { resource "null_resource" "main_service_setup" { connection { type = "ssh" - user = var.user + user = var.operating_system=="ubuntu"?"ubuntu":var.user private_key = local.private_key_content host = aws_instance.main_service_instance.public_ip } @@ -112,23 +116,37 @@ resource "null_resource" "main_service_setup" { <<-EOF # Make the Terraform fail if any step throws an error set -o errexit - # Install wget - sudo yum install wget -y - # Install Java - echo - if [[ "${var.language_version}" == "8" ]]; then - sudo yum install java-1.8.0-amazon-corretto -y + # Install wget and Java based on OS + if [ "${var.operating_system}" == "ubuntu" ]; then + # Ubuntu commands + sudo apt-get update + sudo apt-get install wget -y + if [[ "${var.language_version}" == "8" ]]; then + sudo apt-get install openjdk-8-jdk -y + else + sudo apt-get install openjdk-${var.language_version}-jdk -y + fi else - sudo yum install java-${var.language_version}-amazon-corretto -y + # Amazon Linux 2 commands + sudo yum install wget -y + if [[ "${var.language_version}" == "8" ]]; then + sudo yum install java-1.8.0-amazon-corretto -y + else + sudo yum install java-${var.language_version}-amazon-corretto -y + fi fi # Copy in CW Agent configuration agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' echo $agent_config > amazon-cloudwatch-agent.json - # Get and run CW agent rpm + # Get and run CW agent rpm/ubuntu ${var.get_cw_agent_rpm_command} - sudo rpm -U ./cw-agent.rpm + if [ "${var.operating_system}" == "ubuntu" ]; then + sudo dpkg -i -E ./cw-agent.deb + else + sudo rpm -U ./cw-agent.rpm + fi sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:./amazon-cloudwatch-agent.json # Get ADOT @@ -137,7 +155,7 @@ resource "null_resource" "main_service_setup" { # Get and run the sample application with configuration aws s3 cp ${var.sample_app_jar} ./main-service.jar - JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ + JAVA_TOOL_OPTIONS=' -javaagent:/home/${var.operating_system == "ubuntu" ? "ubuntu" : "ec2-user"}/adot.jar' \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ @@ -198,7 +216,7 @@ resource "aws_instance" "remote_service_instance" { resource "null_resource" "remote_service_setup" { connection { type = "ssh" - user = var.user + user = var.operating_system=="ubuntu"?"ubuntu":var.user private_key = local.private_key_content host = aws_instance.remote_service_instance.public_ip } @@ -208,25 +226,41 @@ resource "null_resource" "remote_service_setup" { <<-EOF # Make the Terraform fail if any step throws an error set -o errexit - # Install wget - sudo yum install wget -y - # Install Java - if [[ "${var.language_version}" == "8" ]]; then - sudo yum install java-1.8.0-amazon-corretto -y + # Install wget and Java based on OS + if [ "${var.operating_system}" == "ubuntu" ]; then + # Ubuntu commands + sudo apt-get update + sudo apt-get install wget -y + if [[ "${var.language_version}" == "8" ]]; then + sudo apt-get install openjdk-8-jdk -y + else + sudo apt-get install openjdk-${var.language_version}-jdk -y + fi + sudo apt-get update + sudo apt-get install ec2-instance-connect -y else - sudo yum install java-${var.language_version}-amazon-corretto -y + # Amazon Linux 2 commands + sudo yum install wget -y + if [[ "${var.language_version}" == "8" ]]; then + sudo yum install java-1.8.0-amazon-corretto -y + else + sudo yum install java-${var.language_version}-amazon-corretto -y + fi + # enable ec2 instance connect for debug + sudo yum install ec2-instance-connect -y fi - # enable ec2 instance connect for debug - sudo yum install ec2-instance-connect -y - # Copy in CW Agent configuration agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' echo $agent_config > amazon-cloudwatch-agent.json - # Get and run CW agent rpm + # Get and run CW agent rpm/ubuntu ${var.get_cw_agent_rpm_command} - sudo rpm -U ./cw-agent.rpm + if [ "${var.operating_system}" == "ubuntu" ]; then + sudo dpkg -i -E ./cw-agent.deb + else + sudo rpm -U ./cw-agent.rpm + fi sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:./amazon-cloudwatch-agent.json # Get ADOT @@ -235,7 +269,7 @@ resource "null_resource" "remote_service_setup" { # Get and run the sample application with configuration aws s3 cp ${var.sample_remote_app_jar} ./remote-service.jar - JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ + JAVA_TOOL_OPTIONS=' -javaagent:/home/${var.operating_system == "ubuntu" ? "ubuntu" : "ec2-user"}/adot.jar' \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ @@ -274,7 +308,7 @@ resource "null_resource" "remote_service_setup" { resource "null_resource" "traffic_generator_setup" { connection { type = "ssh" - user = var.user + user = var.operating_system=="ubuntu"?"ubuntu":var.user private_key = local.private_key_content host = aws_instance.main_service_instance.public_ip } @@ -282,10 +316,14 @@ resource "null_resource" "traffic_generator_setup" { provisioner "remote-exec" { inline = [ <<-EOF - sudo yum install nodejs aws-cli unzip tmux -y + if [ "${var.operating_system}" == "ubuntu" ]; then + sudo apt update && sudo apt install -y nodejs awscli unzip tmux + else + sudo yum install nodejs aws-cli unzip tmux -y + fi # Bring in the traffic generator files to EC2 Instance - aws s3 cp s3://aws-appsignals-sample-app-prod-${var.aws_region}/traffic-generator.zip ./traffic-generator.zip + aws s3 cp s3://aws-appsignals-sample-app-prod-jeel/traffic-generator.zip ./traffic-generator.zip unzip ./traffic-generator.zip -d ./ # Install the traffic generator dependencies diff --git a/terraform/java/ec2/default/variables.tf b/terraform/java/ec2/default/variables.tf index e8b0ef066..0f76ed435 100644 --- a/terraform/java/ec2/default/variables.tf +++ b/terraform/java/ec2/default/variables.tf @@ -51,4 +51,8 @@ variable "language_version" { variable "cpu_architecture" { default = "x86_64" +} + +variable "operating_system" { + default = "al2" } \ No newline at end of file From ccee09d6c8f31c9f9aa48e1ab84eabc02d1e05e6 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Wed, 22 Jan 2025 15:47:48 -0800 Subject: [PATCH 03/18] Deploying sample app to my bucket for testing --- .github/workflows/java-ec2-canary.yml | 1 - .github/workflows/java-ec2-default-test.yml | 8 +++--- .../workflows/java-sample-app-s3-deploy.yml | 25 ++++++------------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index fbd46a845..2e185d02f 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -9,7 +9,6 @@ name: Java EC2 Enablement Canary Testing on: # schedule: # - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour - push: workflow_dispatch: # be able to run the workflow on demand permissions: diff --git a/.github/workflows/java-ec2-default-test.yml b/.github/workflows/java-ec2-default-test.yml index 97204d731..b3be57a74 100644 --- a/.github/workflows/java-ec2-default-test.yml +++ b/.github/workflows/java-ec2-default-test.yml @@ -128,11 +128,13 @@ jobs: if [ "${{ github.event.repository.name }}" = "amazon-cloudwatch-agent" ]; then # 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 - elif [ "${{ env.OPERATING_SYSTEM }}" = "ubuntu" ]; then - echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.deb https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb" >> $GITHUB_ENV else 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 + if [ "${{ env.OPERATING_SYSTEM }}" = "ubuntu" ]; then + echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.deb https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb" >> $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 + fi 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 diff --git a/.github/workflows/java-sample-app-s3-deploy.yml b/.github/workflows/java-sample-app-s3-deploy.yml index ba5a52137..fd6e64919 100644 --- a/.github/workflows/java-sample-app-s3-deploy.yml +++ b/.github/workflows/java-sample-app-s3-deploy.yml @@ -20,10 +20,7 @@ jobs: strategy: fail-fast: false matrix: - aws-region: [ 'af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', - 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', - 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', - 'us-east-1','us-east-2','us-west-1','us-west-2' ] + aws-region: [ 'us-east-1' ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -52,16 +49,13 @@ jobs: working-directory: sample-apps/java/springboot-main-service run: | gradle build -P javaVersion=11 - aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./build/libs/springboot-*-SNAPSHOT.jar --key java-main-service-v11.jar + aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body ./build/libs/springboot-*-SNAPSHOT.jar --key java-main-service-v11.jar java-v11-remote: strategy: fail-fast: false matrix: - aws-region: [ 'af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', - 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', - 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', - 'us-east-1','us-east-2','us-west-1','us-west-2' ] + aws-region: [ 'us-east-1' ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -90,7 +84,7 @@ jobs: working-directory: sample-apps/java/springboot-remote-service run: | gradle build -P javaVersion=11 - aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body build/libs/springboot-remote-service-*-SNAPSHOT.jar --key java-remote-service-v11.jar + aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body build/libs/springboot-remote-service-*-SNAPSHOT.jar --key java-remote-service-v11.jar java-main: strategy: @@ -124,7 +118,7 @@ jobs: fi gradle build -P javaVersion=${{ matrix.java-version }} - aws s3api put-object --bucket aws-appsignals-sample-app-prod-us-east-1 --body ./build/libs/springboot-*-SNAPSHOT.jar --key java-main-service-v${{ matrix.java-version }}.jar + aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body ./build/libs/springboot-*-SNAPSHOT.jar --key java-main-service-v${{ matrix.java-version }}.jar java-remote: strategy: @@ -158,16 +152,13 @@ jobs: fi gradle build -P javaVersion=${{ matrix.java-version }} - aws s3api put-object --bucket aws-appsignals-sample-app-prod-us-east-1 --body ./build/libs/springboot-remote-service-*-SNAPSHOT.jar --key java-remote-service-v${{ matrix.java-version }}.jar + aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body ./build/libs/springboot-remote-service-*-SNAPSHOT.jar --key java-remote-service-v${{ matrix.java-version }}.jar java-lambda: strategy: fail-fast: false matrix: - aws-region: [ 'af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', - 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', - 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', - 'us-east-1','us-east-2','us-west-1','us-west-2' ] + aws-region: [ 'us-east-1' ] runs-on: ubuntu-latest steps: - name: Check out ADOT Java repo @@ -205,4 +196,4 @@ jobs: run: | gradle build gradle createLambdaZip - aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./build/distributions/lambda-function.zip --key java-lambda-function.zip + aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body ./build/distributions/lambda-function.zip --key java-lambda-function.zip From 86ec595b0e601d849d18ea68dcd5f6185703d371 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Wed, 22 Jan 2025 16:00:42 -0800 Subject: [PATCH 04/18] Testing Java EC2 with OS - Ubuntu --- .github/workflows/java-ec2-canary.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index 2e185d02f..d5b9898fb 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -28,7 +28,7 @@ jobs: caller-workflow-name: 'appsignals-e2e-ec2-canary-test' java-version: '11' cpu-architecture: 'x86_64' - operating-system: 'al2' + operating-system: 'ubuntu' maven: uses: ./.github/workflows/java-ec2-default-retry.yml From 0a71d32dec7ce73176ba1c512950600790ddadd9 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Thu, 23 Jan 2025 09:44:33 -0800 Subject: [PATCH 05/18] Updating ubuntu image name --- terraform/java/ec2/default/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 4b414293d..2a3dac987 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -40,7 +40,7 @@ locals { ssh_key_name = aws_key_pair.aws_ssh_key.key_name private_key_content = tls_private_key.ssh_key.private_key_pem os_configs={ - "ubuntu" = "ubuntu/images/hvm-ssd/ubuntu-22.04-*-${var.cpu_architecture}-server-*" + "ubuntu" = "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20250112" "al2" = "al20*-ami-minimal-*-${var.cpu_architecture}" } } From 255d7e658b0c65afbc123031b0e3920a468975ce Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Thu, 23 Jan 2025 11:24:26 -0800 Subject: [PATCH 06/18] Readjusting root device name in accordance to OS --- terraform/java/ec2/default/main.tf | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 2a3dac987..e8834697c 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -39,9 +39,15 @@ resource "aws_key_pair" "aws_ssh_key" { locals { ssh_key_name = aws_key_pair.aws_ssh_key.key_name private_key_content = tls_private_key.ssh_key.private_key_pem - os_configs={ - "ubuntu" = "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20250112" - "al2" = "al20*-ami-minimal-*-${var.cpu_architecture}" + os_configs = { + "ubuntu" = { + name_pattern = "ubuntu-minimal/images/hvm-ssd/ubuntu-jammy-22.04-amd64-minimal-*" + root_device = "/dev/sda1" + } + "al2" = { + name_pattern = "al20*-ami-minimal-*-${var.cpu_architecture}" + root_device = "/dev/xvda" + } } } @@ -50,7 +56,7 @@ data "aws_ami" "ami" { most_recent = true filter { name = "name" - values = [local.os_configs[var.operating_system]] + values = [local.os_configs[var.operating_system].name_pattern] } filter { name = "state" @@ -67,7 +73,7 @@ data "aws_ami" "ami" { filter { name = "root-device-name" - values = ["/dev/xvda"] + values = [local.os_configs[var.operating_system].root_device] } filter { From 50cfd3d3fdee8b7aca7b6d2bb751f9a2a2afe957 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Thu, 23 Jan 2025 13:10:44 -0800 Subject: [PATCH 07/18] Updating volume size to 8 to handle ubuntu image --- terraform/java/ec2/default/main.tf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index e8834697c..718259a2a 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -41,7 +41,7 @@ locals { private_key_content = tls_private_key.ssh_key.private_key_pem os_configs = { "ubuntu" = { - name_pattern = "ubuntu-minimal/images/hvm-ssd/ubuntu-jammy-22.04-amd64-minimal-*" + name_pattern = "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*" root_device = "/dev/sda1" } "al2" = { @@ -101,7 +101,7 @@ resource "aws_instance" "main_service_instance" { } root_block_device { - volume_size = 5 + volume_size = 8 } tags = { @@ -123,7 +123,7 @@ resource "null_resource" "main_service_setup" { # Make the Terraform fail if any step throws an error set -o errexit # Install wget and Java based on OS - if [ "${var.operating_system}" == "ubuntu" ]; then + if [[ "${var.operating_system}" == "ubuntu" ]]; then # Ubuntu commands sudo apt-get update sudo apt-get install wget -y @@ -148,7 +148,7 @@ resource "null_resource" "main_service_setup" { # Get and run CW agent rpm/ubuntu ${var.get_cw_agent_rpm_command} - if [ "${var.operating_system}" == "ubuntu" ]; then + if [[ "${var.operating_system}" == "ubuntu" ]]; then sudo dpkg -i -E ./cw-agent.deb else sudo rpm -U ./cw-agent.rpm @@ -211,7 +211,7 @@ resource "aws_instance" "remote_service_instance" { } root_block_device { - volume_size = 5 + volume_size = 8 } tags = { @@ -233,7 +233,7 @@ resource "null_resource" "remote_service_setup" { # Make the Terraform fail if any step throws an error set -o errexit # Install wget and Java based on OS - if [ "${var.operating_system}" == "ubuntu" ]; then + if [[ "${var.operating_system}" == "ubuntu" ]]; then # Ubuntu commands sudo apt-get update sudo apt-get install wget -y @@ -262,7 +262,7 @@ resource "null_resource" "remote_service_setup" { # Get and run CW agent rpm/ubuntu ${var.get_cw_agent_rpm_command} - if [ "${var.operating_system}" == "ubuntu" ]; then + if [[ "${var.operating_system}" == "ubuntu" ]]; then sudo dpkg -i -E ./cw-agent.deb else sudo rpm -U ./cw-agent.rpm From de56282ebfbb2ab838baa21b7cc0f34932465a1e Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Thu, 23 Jan 2025 14:12:45 -0800 Subject: [PATCH 08/18] Adding the bash shebang --- terraform/java/ec2/default/main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 718259a2a..9d50949aa 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -120,6 +120,7 @@ resource "null_resource" "main_service_setup" { provisioner "remote-exec" { inline = [ <<-EOF + #!/bin/bash # Make the Terraform fail if any step throws an error set -o errexit # Install wget and Java based on OS @@ -230,6 +231,7 @@ resource "null_resource" "remote_service_setup" { provisioner "remote-exec" { inline = [ <<-EOF + #!/bin/bash # Make the Terraform fail if any step throws an error set -o errexit # Install wget and Java based on OS From c7fd4011d925b27a507dd219c3f3fd93a86c8413 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Thu, 23 Jan 2025 14:39:03 -0800 Subject: [PATCH 09/18] Trying to fix broken java packages --- terraform/java/ec2/default/main.tf | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 9d50949aa..215d9a7e5 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -127,11 +127,19 @@ resource "null_resource" "main_service_setup" { if [[ "${var.operating_system}" == "ubuntu" ]]; then # Ubuntu commands sudo apt-get update + sudo apt-get install -y software-properties-common + sudo add-apt-repository -y ppa:openjdk-r/ppa + sudo apt-get update sudo apt-get install wget -y + # Try to fix broken packages if any + sudo apt-get install -y -f + # Clean apt cache + sudo apt-get clean + sudo apt-get autoremove -y if [[ "${var.language_version}" == "8" ]]; then - sudo apt-get install openjdk-8-jdk -y + sudo apt-get install -y openjdk-8-jdk else - sudo apt-get install openjdk-${var.language_version}-jdk -y + sudo apt-get install -y openjdk-${var.language_version}-jdk fi else # Amazon Linux 2 commands @@ -238,11 +246,19 @@ resource "null_resource" "remote_service_setup" { if [[ "${var.operating_system}" == "ubuntu" ]]; then # Ubuntu commands sudo apt-get update + sudo apt-get install -y software-properties-common + sudo add-apt-repository -y ppa:openjdk-r/ppa + sudo apt-get update sudo apt-get install wget -y + # Try to fix broken packages if any + sudo apt-get install -y -f + # Clean apt cache + sudo apt-get clean + sudo apt-get autoremove -y if [[ "${var.language_version}" == "8" ]]; then - sudo apt-get install openjdk-8-jdk -y + sudo apt-get install -y openjdk-8-jdk else - sudo apt-get install openjdk-${var.language_version}-jdk -y + sudo apt-get install -y openjdk-${var.language_version}-jdk fi sudo apt-get update sudo apt-get install ec2-instance-connect -y From 43d88515adf8e9a2120ab82f9b313595c340957a Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Thu, 23 Jan 2025 14:57:43 -0800 Subject: [PATCH 10/18] Trying to install aws cli on ubuntu --- terraform/java/ec2/default/main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 215d9a7e5..57cef2797 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -141,6 +141,7 @@ resource "null_resource" "main_service_setup" { else sudo apt-get install -y openjdk-${var.language_version}-jdk fi + sudo apt-get install -y awscli else # Amazon Linux 2 commands sudo yum install wget -y @@ -260,6 +261,7 @@ resource "null_resource" "remote_service_setup" { else sudo apt-get install -y openjdk-${var.language_version}-jdk fi + sudo apt-get install -y awscli sudo apt-get update sudo apt-get install ec2-instance-connect -y else From 2d428c09b3aeb09dfda5586c8d34246cb1b0118e Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Thu, 23 Jan 2025 15:06:02 -0800 Subject: [PATCH 11/18] Updating the traffic generator script --- terraform/java/ec2/default/main.tf | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 57cef2797..f83d8d092 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -342,8 +342,17 @@ resource "null_resource" "traffic_generator_setup" { provisioner "remote-exec" { inline = [ <<-EOF - if [ "${var.operating_system}" == "ubuntu" ]; then - sudo apt update && sudo apt install -y nodejs awscli unzip tmux + #!/bin/bash + if [[ "${var.operating_system}" == "ubuntu" ]]; then + # Ubuntu commands + sudo apt-get update + # Install curl first if not already installed + sudo apt-get install -y curl + # Install Node.js and npm using NodeSource + curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - + sudo apt-get install -y nodejs + # Install other required packages + sudo apt-get install -y awscli unzip tmux else sudo yum install nodejs aws-cli unzip tmux -y fi From 201abc2d9a90e7f5cb852a3d6b924efc0b1d4e19 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Fri, 24 Jan 2025 13:28:19 -0800 Subject: [PATCH 12/18] Adding new Java EC2 ubuntu test file along with terraform and validator files --- .github/workflows/java-ec2-canary.yml | 12 +- .github/workflows/java-ec2-default-retry.yml | 6 - .github/workflows/java-ec2-default-test.yml | 18 +- .github/workflows/java-ec2-ubuntu-test.yml | 293 +++++++++++++++ .../workflows/java-sample-app-s3-deploy.yml | 25 +- .../traffic-generator-image-build.yml | 12 +- terraform/java/ec2/default/main.tf | 133 ++----- terraform/java/ec2/default/variables.tf | 4 - .../ec2/ubuntu/amazon-cloudwatch-agent.json | 16 + terraform/java/ec2/ubuntu/main.tf | 334 ++++++++++++++++++ terraform/java/ec2/ubuntu/output.tf | 26 ++ terraform/java/ec2/ubuntu/variables.tf | 54 +++ .../java/ec2/ubuntu/log-validation.yml | 28 ++ .../java/ec2/ubuntu/metric-validation.yml | 28 ++ .../java/ec2/ubuntu/trace-validation.yml | 24 ++ 15 files changed, 872 insertions(+), 141 deletions(-) create mode 100644 .github/workflows/java-ec2-ubuntu-test.yml create mode 100644 terraform/java/ec2/ubuntu/amazon-cloudwatch-agent.json create mode 100644 terraform/java/ec2/ubuntu/main.tf create mode 100644 terraform/java/ec2/ubuntu/output.tf create mode 100644 terraform/java/ec2/ubuntu/variables.tf create mode 100644 validator/src/main/resources/validations/java/ec2/ubuntu/log-validation.yml create mode 100644 validator/src/main/resources/validations/java/ec2/ubuntu/metric-validation.yml create mode 100644 validator/src/main/resources/validations/java/ec2/ubuntu/trace-validation.yml diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index d5b9898fb..3a52bec42 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -7,8 +7,8 @@ ## including logs, metrics, and traces. name: Java EC2 Enablement Canary Testing on: - # schedule: - # - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour + schedule: + - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour workflow_dispatch: # be able to run the workflow on demand permissions: @@ -20,7 +20,10 @@ jobs: strategy: fail-fast: false matrix: - aws-region: ['us-east-1'] + aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', + 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', + 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', + 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] uses: ./.github/workflows/java-ec2-default-retry.yml secrets: inherit with: @@ -28,7 +31,6 @@ jobs: caller-workflow-name: 'appsignals-e2e-ec2-canary-test' java-version: '11' cpu-architecture: 'x86_64' - operating-system: 'ubuntu' maven: uses: ./.github/workflows/java-ec2-default-retry.yml @@ -38,4 +40,4 @@ jobs: caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' otel-source: 'maven' java-version: '11' - cpu-architecture: 'x86_64' + cpu-architecture: 'x86_64' \ No newline at end of file diff --git a/.github/workflows/java-ec2-default-retry.yml b/.github/workflows/java-ec2-default-retry.yml index 8c6ce4314..77edc7aca 100644 --- a/.github/workflows/java-ec2-default-retry.yml +++ b/.github/workflows/java-ec2-default-retry.yml @@ -25,10 +25,6 @@ on: required: false type: string default: 'github' - operating-system: - required: false - type: string - default: 'al2' permissions: id-token: write @@ -44,7 +40,6 @@ jobs: java-version: ${{ inputs.java-version }} otel-source: ${{ inputs.otel-source }} cpu-architecture: ${{ inputs.cpu-architecture }} - operating-system: ${{ inputs.operating-system }} java-ec2-default-attempt-2: needs: [ java-ec2-default-attempt-1 ] @@ -57,7 +52,6 @@ jobs: java-version: ${{ inputs.java-version }} otel-source: ${{ inputs.otel-source }} cpu-architecture: ${{ inputs.cpu-architecture }} - operating-system: ${{ inputs.operating-system }} 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 b3be57a74..5d288b8cc 100644 --- a/.github/workflows/java-ec2-default-test.yml +++ b/.github/workflows/java-ec2-default-test.yml @@ -28,10 +28,6 @@ on: required: false type: string default: 'github' - operating-system: - required: false - type: string - default: 'al2' outputs: job-started: value: ${{ jobs.java-ec2-default.outputs.job-started }} @@ -48,9 +44,8 @@ env: JAVA_VERSION: ${{ inputs.java-version }} OTEL_SOURCE: ${{ inputs.otel-source }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} - OPERATING_SYSTEM: ${{ inputs.operating-system }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-main-service-v${{ inputs.java-version }}.jar - SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-remote-service-v${{ inputs.java-version }}.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v${{ inputs.java-version }}.jar + SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v${{ inputs.java-version }}.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -74,7 +69,7 @@ jobs: - uses: actions/checkout@v4 with: - repository: 'Jeel-mehta/aws-application-signals-test-framework' + repository: 'aws-observability/aws-application-signals-test-framework' ref: ${{ env.CALLER_WORKFLOW_NAME == 'main-build' && 'main' || github.ref }} fetch-depth: 0 @@ -130,11 +125,7 @@ jobs: 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 if [ "${{ env.CPU_ARCHITECTURE }}" = "x86_64" ]; then - if [ "${{ env.OPERATING_SYSTEM }}" = "ubuntu" ]; then - echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.deb https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb" >> $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 - fi + 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 @@ -177,7 +168,6 @@ jobs: -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \ -var="language_version=${{ env.JAVA_VERSION }}" \ -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ - -var="operating_system=${{ env.OPERATING_SYSTEM }}" \ || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then diff --git a/.github/workflows/java-ec2-ubuntu-test.yml b/.github/workflows/java-ec2-ubuntu-test.yml new file mode 100644 index 000000000..ac6a669e9 --- /dev/null +++ b/.github/workflows/java-ec2-ubuntu-test.yml @@ -0,0 +1,293 @@ +## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +## SPDX-License-Identifier: Apache-2.0 + +# This is a reusable workflow for running the Enablement test for App Signals. +# It is meant to be called from another workflow. +# Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview +name: Java EC2 Default Use Case +on: + workflow_call: + inputs: + aws-region: + required: true + type: string + caller-workflow-name: + required: true + type: string + java-version: + description: "Currently support version 8, 11, 17, 21, 22" + required: false + type: string + default: '11' + cpu-architecture: + description: "Permitted values: x86_64 or arm64" + required: false + type: string + default: "x86_64" + otel-source: + required: false + type: string + default: 'github' + + outputs: + job-started: + value: ${{ jobs.java-ec2-default.outputs.job-started }} + validation-result: + value: ${{ jobs.java-ec2-default.outputs.validation-result }} + +permissions: + id-token: write + contents: read + +env: + E2E_TEST_AWS_REGION: ${{ inputs.aws-region }} + CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} + JAVA_VERSION: ${{ inputs.java-version }} + OTEL_SOURCE: ${{ inputs.otel-source }} + CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}//java-main-service-v${{ inputs.java-version }}.jar + SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}//java-remote-service-v${{ inputs.java-version }}.jar + E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} + E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} + METRIC_NAMESPACE: ApplicationSignals + LOG_GROUP_NAME: /aws/application-signals/data + TEST_RESOURCES_FOLDER: ${GITHUB_WORKSPACE} + +jobs: + java-ec2-ubuntu: + runs-on: ubuntu-latest + timeout-minutes: 30 + outputs: + job-started: ${{ steps.job-started.outputs.job-started }} + validation-result: ${{ steps.validation-result.outputs.validation-result }} + steps: + - name: Check if the job started + id: job-started + run: echo "job-started=true" >> $GITHUB_OUTPUT + + - name: Generate testing id + run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}-${RANDOM}" >> $GITHUB_ENV + + - uses: actions/checkout@v4 + with: + repository: 'aws-observability/aws-application-signals-test-framework' + ref: ${{ env.CALLER_WORKFLOW_NAME == 'main-build' && 'main' || github.ref }} + fetch-depth: 0 + + # We initialize Gradlew Daemon early on during the workflow because sometimes initialization + # fails due to transient issues. If it fails here, then we will try again later before the validators + - name: Initiate Gradlew Daemon + id: initiate-gradlew + uses: ./.github/workflows/actions/execute_and_retry + continue-on-error: true + with: + command: "./gradlew :validator:build" + cleanup: "./gradlew clean" + max_retry: 3 + sleep_time: 60 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ env.E2E_TEST_ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }} + aws-region: us-east-1 + + - name: Retrieve account + uses: aws-actions/aws-secretsmanager-get-secrets@v1 + with: + secret-ids: | + ACCOUNT_ID, region-account/${{ env.E2E_TEST_AWS_REGION }} + + # If the workflow is running as a canary, then we want to log in to the aws account in the appropriate region + - name: Configure AWS Credentials + if: ${{ github.event.repository.name == 'aws-application-signals-test-framework' }} + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }} + aws-region: ${{ env.E2E_TEST_AWS_REGION }} + +# TODO: Use Latest version from Maven by latest_version=$(curl -s "https://search.maven.org/solrsearch/select?q=g:software.amazon.opentelemetry+a:aws-opentelemetry-agent&core=gav&rows=1&wt=json" | jq -r '.response.docs[0].v') + - name: Set Get ADOT Wheel command environment variable + run: | + if [ "${{ github.event.repository.name }}" = "aws-otel-java-instrumentation" ]; then + # Reusing the adot-main-build-staging-jar bucket to store the python wheel file + echo GET_ADOT_JAR_COMMAND="aws s3 cp s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar ./adot.jar" >> $GITHUB_ENV + elif [ "${{ env.OTEL_SOURCE }}" == "maven" ]; then + echo "Latest version for Maven is: 1.32.5" + echo GET_ADOT_JAR_COMMAND="wget -O adot.jar https://repo1.maven.org/maven2/software/amazon/opentelemetry/aws-opentelemetry-agent/1.32.5/aws-opentelemetry-agent-1.32.5.jar" >> $GITHUB_ENV + else + echo GET_ADOT_JAR_COMMAND="wget -O adot.jar https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest/download/aws-opentelemetry-agent.jar" >> $GITHUB_ENV + fi + + - name: Set Get CW Agent command environment variable + run: | + if [ "${{ github.event.repository.name }}" = "amazon-cloudwatch-agent" ]; then + # Reusing the adot-main-build-staging-jar bucket to store the python wheel file + echo GET_CW_AGENT_DEB_COMMAND= "aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ github.sha }}/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb ./cw-agent.deb" >> $GITHUB_ENV + else + echo GET_CW_AGENT_DEB_COMMAND="wget -O cw-agent.deb https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb" >> $GITHUB_ENV + fi + + - name: Set up terraform + uses: ./.github/workflows/actions/execute_and_retry + with: + command: "wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg" + post-command: 'echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list + && sudo apt update && sudo apt install terraform' + sleep_time: 60 + + - name: Initiate Terraform + uses: ./.github/workflows/actions/execute_and_retry + with: + command: "cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/java/ec2/default && terraform init && terraform validate" + cleanup: "rm -rf .terraform && rm -rf .terraform.lock.hcl" + max_retry: 6 + sleep_time: 60 + + - name: Deploy sample app via terraform and wait for endpoint to come online + working-directory: terraform/java/ec2/ubuntu + run: | + # Attempt to deploy the sample app on an EC2 instance and wait for its endpoint to come online. + # There may be occasional failures due to transitivity issues, so try up to 2 times. + # deployment_failed of 0 indicates that both the terraform deployment and the endpoint are running, while 1 indicates + # that it failed at some point + retry_counter=0 + max_retry=2 + while [ $retry_counter -lt $max_retry ]; do + echo "Attempt $retry_counter" + deployment_failed=0 + terraform apply -auto-approve \ + -var="aws_region=${{ inputs.aws-region }}" \ + -var="test_id=${{ env.TESTING_ID }}" \ + -var="sample_app_jar=${{ env.SAMPLE_APP_FRONTEND_SERVICE_JAR }}" \ + -var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \ + -var="get_cw_agent_deb_command=${{ env.GET_CW_AGENT_DEB_COMMAND }}" \ + -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \ + -var="language_version=${{ env.JAVA_VERSION }}" \ + -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ + || deployment_failed=$? + + if [ $deployment_failed -eq 1 ]; then + echo "Terraform deployment was unsuccessful. Will attempt to retry deployment." + fi + + # If the success is 1 then either the terraform deployment or the endpoint connection failed, so first destroy the + # resources created from terraform and try again. + if [ $deployment_failed -eq 1 ]; then + echo "Destroying terraform" + terraform destroy -auto-approve \ + -var="test_id=${{ env.TESTING_ID }}" + + retry_counter=$(($retry_counter+1)) + else + # If deployment succeeded, then exit the loop + break + fi + + if [ $retry_counter -eq $max_retry ]; then + echo "Max retry reached, failed to deploy terraform and connect to the endpoint. Exiting code" + exit 1 + fi + done + + - name: Get the ec2 instance ami id + working-directory: terraform/java/ec2/ubuntu + run: | + echo "EC2_INSTANCE_AMI=$(terraform output ec2_instance_ami)" >> $GITHUB_ENV + + - name: Get the sample app and EC2 instance information + working-directory: terraform/java/ec2/ubuntu + run: | + echo "MAIN_SERVICE_ENDPOINT=localhost:8080" >> $GITHUB_ENV + echo "REMOTE_SERVICE_IP=$(terraform output sample_app_remote_service_private_ip)" >> $GITHUB_ENV + echo "MAIN_SERVICE_INSTANCE_ID=$(terraform output main_service_instance_id)" >> $GITHUB_ENV + + - name: Initiate Gradlew Daemon + if: steps.initiate-gradlew == 'failure' + uses: ./.github/workflows/actions/execute_and_retry + continue-on-error: true + with: + command: "./gradlew :validator:build" + cleanup: "./gradlew clean" + max_retry: 3 + sleep_time: 60 + + # Validation for pulse telemetry data + - name: Validate generated EMF logs + id: log-validation + run: ./gradlew validator:run --args='-c java/ec2/ubuntu/log-validation.yml + --testing-id ${{ env.TESTING_ID }} + --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} + --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 + --region ${{ inputs.aws-region }} + --account-id ${{ env.ACCOUNT_ID }} + --metric-namespace ${{ env.METRIC_NAMESPACE }} + --log-group ${{ env.LOG_GROUP_NAME }} + --service-name sample-application-${{ env.TESTING_ID }} + --remote-service-name sample-remote-application-${{ env.TESTING_ID }} + --query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }} + --instance-ami ${{ env.EC2_INSTANCE_AMI }} + --instance-id ${{ env.MAIN_SERVICE_INSTANCE_ID }} + --rollup' + + - name: Validate generated metrics + id: metric-validation + if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() + run: ./gradlew validator:run --args='-c java/ec2/ubuntu/metric-validation.yml + --testing-id ${{ env.TESTING_ID }} + --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} + --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 + --region ${{ inputs.aws-region }} + --account-id ${{ env.ACCOUNT_ID }} + --metric-namespace ${{ env.METRIC_NAMESPACE }} + --log-group ${{ env.LOG_GROUP_NAME }} + --service-name sample-application-${{ env.TESTING_ID }} + --remote-service-name sample-remote-application-${{ env.TESTING_ID }} + --query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }} + --instance-ami ${{ env.EC2_INSTANCE_AMI }} + --instance-id ${{ env.MAIN_SERVICE_INSTANCE_ID }} + --rollup' + + - name: Validate generated traces + id: trace-validation + if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled() + run: ./gradlew validator:run --args='-c java/ec2/ubuntu/trace-validation.yml + --testing-id ${{ env.TESTING_ID }} + --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} + --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 + --region ${{ inputs.aws-region }} + --account-id ${{ env.ACCOUNT_ID }} + --metric-namespace ${{ env.METRIC_NAMESPACE }} + --log-group ${{ env.LOG_GROUP_NAME }} + --service-name sample-application-${{ env.TESTING_ID }} + --remote-service-name sample-remote-application-${{ env.TESTING_ID }} + --query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }} + --instance-ami ${{ env.EC2_INSTANCE_AMI }} + --instance-id ${{ env.MAIN_SERVICE_INSTANCE_ID }} + --rollup' + + - name: Refresh AWS Credentials + if: ${{ github.event.repository.name == 'aws-application-signals-test-framework' }} + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }} + aws-region: ${{ env.E2E_TEST_AWS_REGION }} + + - name: Save test results + if: always() + id: validation-result + run: | + if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then + echo "validation-result=success" >> $GITHUB_OUTPUT + else + echo "validation-result=failure" >> $GITHUB_OUTPUT + fi + + # Clean up Procedures + - name: Terraform destroy + if: always() + continue-on-error: true + working-directory: terraform/java/ec2/default + run: | + terraform destroy -auto-approve \ + -var="test_id=${{ env.TESTING_ID }}" \ No newline at end of file diff --git a/.github/workflows/java-sample-app-s3-deploy.yml b/.github/workflows/java-sample-app-s3-deploy.yml index fd6e64919..ba5a52137 100644 --- a/.github/workflows/java-sample-app-s3-deploy.yml +++ b/.github/workflows/java-sample-app-s3-deploy.yml @@ -20,7 +20,10 @@ jobs: strategy: fail-fast: false matrix: - aws-region: [ 'us-east-1' ] + aws-region: [ 'af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', + 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', + 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', + 'us-east-1','us-east-2','us-west-1','us-west-2' ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -49,13 +52,16 @@ jobs: working-directory: sample-apps/java/springboot-main-service run: | gradle build -P javaVersion=11 - aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body ./build/libs/springboot-*-SNAPSHOT.jar --key java-main-service-v11.jar + aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./build/libs/springboot-*-SNAPSHOT.jar --key java-main-service-v11.jar java-v11-remote: strategy: fail-fast: false matrix: - aws-region: [ 'us-east-1' ] + aws-region: [ 'af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', + 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', + 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', + 'us-east-1','us-east-2','us-west-1','us-west-2' ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -84,7 +90,7 @@ jobs: working-directory: sample-apps/java/springboot-remote-service run: | gradle build -P javaVersion=11 - aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body build/libs/springboot-remote-service-*-SNAPSHOT.jar --key java-remote-service-v11.jar + aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body build/libs/springboot-remote-service-*-SNAPSHOT.jar --key java-remote-service-v11.jar java-main: strategy: @@ -118,7 +124,7 @@ jobs: fi gradle build -P javaVersion=${{ matrix.java-version }} - aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body ./build/libs/springboot-*-SNAPSHOT.jar --key java-main-service-v${{ matrix.java-version }}.jar + aws s3api put-object --bucket aws-appsignals-sample-app-prod-us-east-1 --body ./build/libs/springboot-*-SNAPSHOT.jar --key java-main-service-v${{ matrix.java-version }}.jar java-remote: strategy: @@ -152,13 +158,16 @@ jobs: fi gradle build -P javaVersion=${{ matrix.java-version }} - aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body ./build/libs/springboot-remote-service-*-SNAPSHOT.jar --key java-remote-service-v${{ matrix.java-version }}.jar + aws s3api put-object --bucket aws-appsignals-sample-app-prod-us-east-1 --body ./build/libs/springboot-remote-service-*-SNAPSHOT.jar --key java-remote-service-v${{ matrix.java-version }}.jar java-lambda: strategy: fail-fast: false matrix: - aws-region: [ 'us-east-1' ] + aws-region: [ 'af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', + 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', + 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', + 'us-east-1','us-east-2','us-west-1','us-west-2' ] runs-on: ubuntu-latest steps: - name: Check out ADOT Java repo @@ -196,4 +205,4 @@ jobs: run: | gradle build gradle createLambdaZip - aws s3api put-object --bucket aws-appsignals-sample-app-prod-jeel --body ./build/distributions/lambda-function.zip --key java-lambda-function.zip + aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./build/distributions/lambda-function.zip --key java-lambda-function.zip diff --git a/.github/workflows/traffic-generator-image-build.yml b/.github/workflows/traffic-generator-image-build.yml index 17ddb973f..ad8808050 100644 --- a/.github/workflows/traffic-generator-image-build.yml +++ b/.github/workflows/traffic-generator-image-build.yml @@ -23,7 +23,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - aws-region: ['us-east-1'] + aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', + 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', + 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', + 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -64,7 +67,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - aws-region: ['us-east-1'] + aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', + 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', + 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', + 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -91,4 +97,4 @@ jobs: working-directory: sample-apps/traffic-generator run: | zip traffic-generator.zip ./index.js ./package.json - aws s3 cp traffic-generator.zip s3://aws-appsignals-sample-app-prod-jeel/traffic-generator.zip \ No newline at end of file + aws s3 cp traffic-generator.zip s3://aws-appsignals-sample-app-prod-${{ matrix.aws-region }}/traffic-generator.zip \ No newline at end of file diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index f83d8d092..dd729d4fb 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -39,16 +39,6 @@ resource "aws_key_pair" "aws_ssh_key" { locals { ssh_key_name = aws_key_pair.aws_ssh_key.key_name private_key_content = tls_private_key.ssh_key.private_key_pem - os_configs = { - "ubuntu" = { - name_pattern = "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*" - root_device = "/dev/sda1" - } - "al2" = { - name_pattern = "al20*-ami-minimal-*-${var.cpu_architecture}" - root_device = "/dev/xvda" - } - } } data "aws_ami" "ami" { @@ -56,7 +46,7 @@ data "aws_ami" "ami" { most_recent = true filter { name = "name" - values = [local.os_configs[var.operating_system].name_pattern] + values = ["al20*-ami-minimal-*-${var.cpu_architecture}"] } filter { name = "state" @@ -73,7 +63,7 @@ data "aws_ami" "ami" { filter { name = "root-device-name" - values = [local.os_configs[var.operating_system].root_device] + values = ["/dev/xvda"] } filter { @@ -101,7 +91,7 @@ resource "aws_instance" "main_service_instance" { } root_block_device { - volume_size = 8 + volume_size = 5 } tags = { @@ -112,7 +102,7 @@ resource "aws_instance" "main_service_instance" { resource "null_resource" "main_service_setup" { connection { type = "ssh" - user = var.operating_system=="ubuntu"?"ubuntu":var.user + user = var.user private_key = local.private_key_content host = aws_instance.main_service_instance.public_ip } @@ -123,46 +113,23 @@ resource "null_resource" "main_service_setup" { #!/bin/bash # Make the Terraform fail if any step throws an error set -o errexit - # Install wget and Java based on OS - if [[ "${var.operating_system}" == "ubuntu" ]]; then - # Ubuntu commands - sudo apt-get update - sudo apt-get install -y software-properties-common - sudo add-apt-repository -y ppa:openjdk-r/ppa - sudo apt-get update - sudo apt-get install wget -y - # Try to fix broken packages if any - sudo apt-get install -y -f - # Clean apt cache - sudo apt-get clean - sudo apt-get autoremove -y - if [[ "${var.language_version}" == "8" ]]; then - sudo apt-get install -y openjdk-8-jdk - else - sudo apt-get install -y openjdk-${var.language_version}-jdk - fi - sudo apt-get install -y awscli + # Install wget + sudo yum install wget -y + # Install Java + echo + if [[ "${var.language_version}" == "8" ]]; then + sudo yum install java-1.8.0-amazon-corretto -y else - # Amazon Linux 2 commands - sudo yum install wget -y - if [[ "${var.language_version}" == "8" ]]; then - sudo yum install java-1.8.0-amazon-corretto -y - else - sudo yum install java-${var.language_version}-amazon-corretto -y - fi + sudo yum install java-${var.language_version}-amazon-corretto -y fi # Copy in CW Agent configuration agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' echo $agent_config > amazon-cloudwatch-agent.json - # Get and run CW agent rpm/ubuntu + # Get and run CW agent rpm ${var.get_cw_agent_rpm_command} - if [[ "${var.operating_system}" == "ubuntu" ]]; then - sudo dpkg -i -E ./cw-agent.deb - else - sudo rpm -U ./cw-agent.rpm - fi + sudo rpm -U ./cw-agent.rpm sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:./amazon-cloudwatch-agent.json # Get ADOT @@ -171,7 +138,7 @@ resource "null_resource" "main_service_setup" { # Get and run the sample application with configuration aws s3 cp ${var.sample_app_jar} ./main-service.jar - JAVA_TOOL_OPTIONS=' -javaagent:/home/${var.operating_system == "ubuntu" ? "ubuntu" : "ec2-user"}/adot.jar' \ + JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ @@ -221,7 +188,7 @@ resource "aws_instance" "remote_service_instance" { } root_block_device { - volume_size = 8 + volume_size = 5 } tags = { @@ -232,7 +199,7 @@ resource "aws_instance" "remote_service_instance" { resource "null_resource" "remote_service_setup" { connection { type = "ssh" - user = var.operating_system=="ubuntu"?"ubuntu":var.user + user = var.user private_key = local.private_key_content host = aws_instance.remote_service_instance.public_ip } @@ -243,50 +210,26 @@ resource "null_resource" "remote_service_setup" { #!/bin/bash # Make the Terraform fail if any step throws an error set -o errexit - # Install wget and Java based on OS - if [[ "${var.operating_system}" == "ubuntu" ]]; then - # Ubuntu commands - sudo apt-get update - sudo apt-get install -y software-properties-common - sudo add-apt-repository -y ppa:openjdk-r/ppa - sudo apt-get update - sudo apt-get install wget -y - # Try to fix broken packages if any - sudo apt-get install -y -f - # Clean apt cache - sudo apt-get clean - sudo apt-get autoremove -y - if [[ "${var.language_version}" == "8" ]]; then - sudo apt-get install -y openjdk-8-jdk - else - sudo apt-get install -y openjdk-${var.language_version}-jdk - fi - sudo apt-get install -y awscli - sudo apt-get update - sudo apt-get install ec2-instance-connect -y + # Install wget + sudo yum install wget -y + # Install Java + echo + if [[ "${var.language_version}" == "8" ]]; then + sudo yum install java-1.8.0-amazon-corretto -y else - # Amazon Linux 2 commands - sudo yum install wget -y - if [[ "${var.language_version}" == "8" ]]; then - sudo yum install java-1.8.0-amazon-corretto -y - else - sudo yum install java-${var.language_version}-amazon-corretto -y - fi - # enable ec2 instance connect for debug - sudo yum install ec2-instance-connect -y + sudo yum install java-${var.language_version}-amazon-corretto -y fi + # enable ec2 instance connect for debug + sudo yum install ec2-instance-connect -y + # Copy in CW Agent configuration agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' echo $agent_config > amazon-cloudwatch-agent.json - # Get and run CW agent rpm/ubuntu + # Get and run CW agent rpm ${var.get_cw_agent_rpm_command} - if [[ "${var.operating_system}" == "ubuntu" ]]; then - sudo dpkg -i -E ./cw-agent.deb - else - sudo rpm -U ./cw-agent.rpm - fi + sudo rpm -U ./cw-agent.rpm sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:./amazon-cloudwatch-agent.json # Get ADOT @@ -295,7 +238,7 @@ resource "null_resource" "remote_service_setup" { # Get and run the sample application with configuration aws s3 cp ${var.sample_remote_app_jar} ./remote-service.jar - JAVA_TOOL_OPTIONS=' -javaagent:/home/${var.operating_system == "ubuntu" ? "ubuntu" : "ec2-user"}/adot.jar' \ + JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ @@ -334,7 +277,7 @@ resource "null_resource" "remote_service_setup" { resource "null_resource" "traffic_generator_setup" { connection { type = "ssh" - user = var.operating_system=="ubuntu"?"ubuntu":var.user + user = var.user private_key = local.private_key_content host = aws_instance.main_service_instance.public_ip } @@ -343,22 +286,10 @@ resource "null_resource" "traffic_generator_setup" { inline = [ <<-EOF #!/bin/bash - if [[ "${var.operating_system}" == "ubuntu" ]]; then - # Ubuntu commands - sudo apt-get update - # Install curl first if not already installed - sudo apt-get install -y curl - # Install Node.js and npm using NodeSource - curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - - sudo apt-get install -y nodejs - # Install other required packages - sudo apt-get install -y awscli unzip tmux - else - sudo yum install nodejs aws-cli unzip tmux -y - fi + sudo yum install nodejs aws-cli unzip tmux -y # Bring in the traffic generator files to EC2 Instance - aws s3 cp s3://aws-appsignals-sample-app-prod-jeel/traffic-generator.zip ./traffic-generator.zip + aws s3 cp s3://aws-appsignals-sample-app-prod-${var.aws_region}/traffic-generator.zip ./traffic-generator.zip unzip ./traffic-generator.zip -d ./ # Install the traffic generator dependencies diff --git a/terraform/java/ec2/default/variables.tf b/terraform/java/ec2/default/variables.tf index 0f76ed435..e8b0ef066 100644 --- a/terraform/java/ec2/default/variables.tf +++ b/terraform/java/ec2/default/variables.tf @@ -51,8 +51,4 @@ variable "language_version" { variable "cpu_architecture" { default = "x86_64" -} - -variable "operating_system" { - default = "al2" } \ No newline at end of file diff --git a/terraform/java/ec2/ubuntu/amazon-cloudwatch-agent.json b/terraform/java/ec2/ubuntu/amazon-cloudwatch-agent.json new file mode 100644 index 000000000..a98a40d36 --- /dev/null +++ b/terraform/java/ec2/ubuntu/amazon-cloudwatch-agent.json @@ -0,0 +1,16 @@ +{ + "agent": { + "debug": true, + "region": "$REGION" + }, + "traces": { + "traces_collected": { + "application_signals": {} + } + }, + "logs": { + "metrics_collected": { + "application_signals": {} + } + } +} \ No newline at end of file diff --git a/terraform/java/ec2/ubuntu/main.tf b/terraform/java/ec2/ubuntu/main.tf new file mode 100644 index 000000000..9ad39ead5 --- /dev/null +++ b/terraform/java/ec2/ubuntu/main.tf @@ -0,0 +1,334 @@ +# ------------------------------------------------------------------------ +# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. +# ------------------------------------------------------------------------- + +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + } + } +} + +# Define the provider for AWS +provider "aws" {} + +resource "aws_default_vpc" "default" {} + +resource "tls_private_key" "ssh_key" { + algorithm = "RSA" + rsa_bits = 4096 +} + +resource "aws_key_pair" "aws_ssh_key" { + key_name = "instance_key-${var.test_id}" + public_key = tls_private_key.ssh_key.public_key_openssh +} + +locals { + ssh_key_name = aws_key_pair.aws_ssh_key.key_name + private_key_content = tls_private_key.ssh_key.private_key_pem +} + +data "aws_ami" "ami" { + owners = ["amazon"] + most_recent = true + filter { + name = "name" + values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"] + } + filter { + name = "state" + values = ["available"] + } + filter { + name = "architecture" + values = [var.cpu_architecture] + } + filter { + name = "image-type" + values = ["machine"] + } + + filter { + name = "root-device-name" + values = ["/dev/sda1"] + } + + filter { + name = "root-device-type" + values = ["ebs"] + } + + filter { + name = "virtualization-type" + values = ["hvm"] + } +} + +resource "aws_instance" "main_service_instance" { + ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) + 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] + associate_public_ip_address = true + instance_initiated_shutdown_behavior = "terminate" + + metadata_options { + http_tokens = "required" + } + + root_block_device { + volume_size = 8 + } + + tags = { + Name = "main-service-${var.test_id}" + } +} + +resource "null_resource" "main_service_setup" { + connection { + type = "ssh" + user = var.user + private_key = local.private_key_content + host = aws_instance.main_service_instance.public_ip + } + + provisioner "remote-exec" { + inline = [ + <<-EOF + #!/bin/bash + # Make the Terraform fail if any step throws an error + set -o errexit + # Install wget and Java based on OS + # Ubuntu commands + sudo apt-get update + sudo apt-get install -y software-properties-common + sudo add-apt-repository -y ppa:openjdk-r/ppa + sudo apt-get update + sudo apt-get install wget -y + # Try to fix broken packages if any + sudo apt-get install -y -f + # Clean apt cache + sudo apt-get clean + sudo apt-get autoremove -y + if [[ "${var.language_version}" == "8" ]]; then + sudo apt-get install -y openjdk-8-jdk + else + sudo apt-get install -y openjdk-${var.language_version}-jdk + fi + sudo apt-get install -y awscli + + # Copy in CW Agent configuration + agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' + echo $agent_config > amazon-cloudwatch-agent.json + + # Get and run CW agent rpm/ubuntu + ${var.get_cw_agent_deb_command} + sudo dpkg -i -E ./cw-agent.deb + sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:./amazon-cloudwatch-agent.json + + # Get ADOT + ${var.get_adot_jar_command} + + # Get and run the sample application with configuration + aws s3 cp ${var.sample_app_jar} ./main-service.jar + + JAVA_TOOL_OPTIONS=' -javaagent:/home/ubuntu/adot.jar' \ + OTEL_METRICS_EXPORTER=none \ + OTEL_LOGS_EXPORT=none \ + OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ + OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \ + OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ + OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ + OTEL_RESOURCE_ATTRIBUTES=service.name=sample-application-${var.test_id} \ + OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ + nohup java -XX:+UseG1GC -jar main-service.jar &> nohup.out & + + # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds + sleep 30 + + # Check if the application is up. If it is not up, then exit 1. + attempt_counter=0 + max_attempts=30 + until $(curl --output /dev/null --silent --head --fail --max-time 5 $(echo "http://localhost:8080" | tr -d '"')); do + if [ $attempt_counter -eq $max_attempts ];then + echo "Failed to connect to endpoint." + exit 1 + fi + echo "Attempting to connect to the main endpoint. Tried $attempt_counter out of $max_attempts" + attempt_counter=$(($attempt_counter+1)) + sleep 10 + done + + echo "Successfully connected to main endpoint" + + EOF + ] + } + + depends_on = [aws_instance.main_service_instance] +} + +resource "aws_instance" "remote_service_instance" { + ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) + 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] + associate_public_ip_address = true + instance_initiated_shutdown_behavior = "terminate" + + metadata_options { + http_tokens = "required" + } + + root_block_device { + volume_size = 8 + } + + tags = { + Name = "remote-service-${var.test_id}" + } +} + +resource "null_resource" "remote_service_setup" { + connection { + type = "ssh" + user = var.user + private_key = local.private_key_content + host = aws_instance.remote_service_instance.public_ip + } + + provisioner "remote-exec" { + inline = [ + <<-EOF + #!/bin/bash + # Make the Terraform fail if any step throws an error + set -o errexit + # Install wget and Java based on OS + # Ubuntu commands + sudo apt-get update + sudo apt-get install -y software-properties-common + sudo add-apt-repository -y ppa:openjdk-r/ppa + sudo apt-get update + sudo apt-get install wget -y + # Try to fix broken packages if any + sudo apt-get install -y -f + # Clean apt cache + sudo apt-get clean + sudo apt-get autoremove -y + if [[ "${var.language_version}" == "8" ]]; then + sudo apt-get install -y openjdk-8-jdk + else + sudo apt-get install -y openjdk-${var.language_version}-jdk + fi + sudo apt-get install -y awscli + sudo apt-get update + sudo apt-get install ec2-instance-connect -y + + # Copy in CW Agent configuration + agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' + echo $agent_config > amazon-cloudwatch-agent.json + + # Get and run CW agent rpm/ubuntu + ${var.get_cw_agent_deb_command} + sudo dpkg -i -E ./cw-agent.deb + sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:./amazon-cloudwatch-agent.json + + # Get ADOT + ${var.get_adot_jar_command} + + # Get and run the sample application with configuration + aws s3 cp ${var.sample_remote_app_jar} ./remote-service.jar + + JAVA_TOOL_OPTIONS=' -javaagent:/home/ubuntu/adot.jar' \ + OTEL_METRICS_EXPORTER=none \ + OTEL_LOGS_EXPORT=none \ + OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ + OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \ + OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ + OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ + OTEL_RESOURCE_ATTRIBUTES=service.name=sample-remote-application-${var.test_id} \ + OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ + nohup java -XX:+UseG1GC -jar remote-service.jar &> nohup.out & + + # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds + sleep 30 + + # Check if the application is up. If it is not up, then exit 1. + attempt_counter=0 + max_attempts=30 + until $(curl --output /dev/null --silent --head --fail --max-time 5 $(echo "http://localhost:8080/healthcheck" | tr -d '"')); do + if [ $attempt_counter -eq $max_attempts ];then + echo "Failed to connect to endpoint." + exit 1 + fi + echo "Attempting to connect to the remote endpoint. Tried $attempt_counter out of $max_attempts" + attempt_counter=$(($attempt_counter+1)) + sleep 10 + done + + echo "Successfully connected to remote endpoint" + + EOF + ] + } + + depends_on = [aws_instance.remote_service_instance] +} + +resource "null_resource" "traffic_generator_setup" { + connection { + type = "ssh" + user = var.user + private_key = local.private_key_content + host = aws_instance.main_service_instance.public_ip + } + + provisioner "remote-exec" { + inline = [ + <<-EOF + #!/bin/bash + # Ubuntu commands + sudo apt-get update + # Install curl first if not already installed + sudo apt-get install -y curl + # Install Node.js and npm using NodeSource + curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - + sudo apt-get install -y nodejs + # Install other required packages + sudo apt-get install -y awscli unzip tmux + + # Bring in the traffic generator files to EC2 Instance + aws s3 cp s3://aws-appsignals-sample-app-prod-${var.aws_region}/traffic-generator.zip ./traffic-generator.zip + unzip ./traffic-generator.zip -d ./ + + # Install the traffic generator dependencies + npm install + + tmux new -s traffic-generator -d + tmux send-keys -t traffic-generator "export MAIN_ENDPOINT=\"localhost:8080\"" C-m + tmux send-keys -t traffic-generator "export REMOTE_ENDPOINT=\"${aws_instance.remote_service_instance.private_ip}\"" C-m + tmux send-keys -t traffic-generator "export ID=\"${var.test_id}\"" C-m + tmux send-keys -t traffic-generator "npm start" C-m + + EOF + ] + } + + depends_on = [null_resource.main_service_setup, null_resource.remote_service_setup] +} \ No newline at end of file diff --git a/terraform/java/ec2/ubuntu/output.tf b/terraform/java/ec2/ubuntu/output.tf new file mode 100644 index 000000000..be572868a --- /dev/null +++ b/terraform/java/ec2/ubuntu/output.tf @@ -0,0 +1,26 @@ +# ------------------------------------------------------------------------ +# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. +# ------------------------------------------------------------------------- + +output "sample_app_remote_service_private_ip" { + value = aws_instance.remote_service_instance.private_ip +} + +output "main_service_instance_id" { + value = aws_instance.main_service_instance.id +} + +output "ec2_instance_ami" { + value = data.aws_ami.ami.id +} \ No newline at end of file diff --git a/terraform/java/ec2/ubuntu/variables.tf b/terraform/java/ec2/ubuntu/variables.tf new file mode 100644 index 000000000..fa1084287 --- /dev/null +++ b/terraform/java/ec2/ubuntu/variables.tf @@ -0,0 +1,54 @@ +# ------------------------------------------------------------------------ +# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. +# ------------------------------------------------------------------------- + +variable "test_id" { + default = "dummy-123" +} + +variable "aws_region" { + default = "" +} + +variable "user" { + default = "ubuntu" +} + +variable "sample_app_jar" { + default = "s3:///" +} + +variable "sample_remote_app_jar" { + default = "s3:///" +} + +variable "get_cw_agent_deb_command" { + default = " s3:///" +} + +variable "get_adot_jar_command" { + default = " s3:///" +} + +variable "canary_type" { + default = "java-ec2-ubuntu" +} + +variable "language_version" { + default = "11" +} + +variable "cpu_architecture" { + default = "x86_64" +} \ No newline at end of file diff --git a/validator/src/main/resources/validations/java/ec2/ubuntu/log-validation.yml b/validator/src/main/resources/validations/java/ec2/ubuntu/log-validation.yml new file mode 100644 index 000000000..7eb76ace9 --- /dev/null +++ b/validator/src/main/resources/validations/java/ec2/ubuntu/log-validation.yml @@ -0,0 +1,28 @@ +- + validationType: "cw-log" + httpPath: "/outgoing-http-call" + httpMethod: "get" + callingType: "http" + expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_LOG" +- + validationType: "cw-log" + httpPath: "/aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_LOG" +- + validationType: "cw-log" + httpPath: "/remote-service" + httpMethod: "get" + callingType: "http-with-query" + expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_LOG" +- + validationType: "cw-log" + httpPath: "/client-call" + httpMethod: "get" + callingType: "http" + expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_LOG" +- + validationType: "cw-log" + callingType: "none" + expectedLogStructureTemplate: "JAVA_RUNTIME_METRIC_LOG" \ No newline at end of file diff --git a/validator/src/main/resources/validations/java/ec2/ubuntu/metric-validation.yml b/validator/src/main/resources/validations/java/ec2/ubuntu/metric-validation.yml new file mode 100644 index 000000000..a0e35e8d6 --- /dev/null +++ b/validator/src/main/resources/validations/java/ec2/ubuntu/metric-validation.yml @@ -0,0 +1,28 @@ +- + validationType: "cw-metric" + httpPath: "/outgoing-http-call" + httpMethod: "get" + callingType: "http" + expectedMetricTemplate: "JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_METRIC" +- + validationType: "cw-metric" + httpPath: "/aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedMetricTemplate: "JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_METRIC" +- + validationType: "cw-metric" + httpPath: "/remote-service" + httpMethod: "get" + callingType: "http-with-query" + expectedMetricTemplate: "JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_METRIC" +- + validationType: "cw-metric" + httpPath: "/client-call" + httpMethod: "get" + callingType: "http" + expectedMetricTemplate: "JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_METRIC" +- + validationType: "cw-metric" + callingType: "none" + expectedMetricTemplate: "JAVA_RUNTIME_METRIC" \ No newline at end of file diff --git a/validator/src/main/resources/validations/java/ec2/ubuntu/trace-validation.yml b/validator/src/main/resources/validations/java/ec2/ubuntu/trace-validation.yml new file mode 100644 index 000000000..44cb4ceb7 --- /dev/null +++ b/validator/src/main/resources/validations/java/ec2/ubuntu/trace-validation.yml @@ -0,0 +1,24 @@ +- + validationType: "trace" + httpPath: "/outgoing-http-call" + httpMethod: "get" + callingType: "http" + expectedTraceTemplate: "JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_TRACE" +- + validationType: "trace" + httpPath: "/aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedTraceTemplate: "JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_TRACE" +- + validationType: "trace" + httpPath: "/remote-service" + httpMethod: "get" + callingType: "http-with-query" + expectedTraceTemplate: "JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_TRACE" +- + validationType: "trace" + httpPath: "/client-call" + httpMethod: "get" + callingType: "http" + expectedTraceTemplate: "JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_TRACE" \ No newline at end of file From cab421063ceced1d7eeb30e4ed178d2799a598de Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Mon, 27 Jan 2025 13:24:16 -0800 Subject: [PATCH 13/18] Adding expected template files --- .github/workflows/java-ec2-ubuntu-test.yml | 29 +- terraform/java/ec2/default/main.tf | 4 - terraform/java/ec2/ubuntu/main.tf | 23 +- terraform/java/ec2/ubuntu/variables.tf | 8 - .../java/ec2/ubuntu/aws-sdk-call-log.mustache | 22 + .../ec2/ubuntu/aws-sdk-call-metric.mustache | 376 ++++++++++++++++++ .../ec2/ubuntu/aws-sdk-call-trace.mustache | 67 ++++ .../java/ec2/ubuntu/client-call-log.mustache | 20 + .../ec2/ubuntu/client-call-metric.mustache | 227 +++++++++++ .../ec2/ubuntu/client-call-trace.mustache | 56 +++ .../ubuntu/outgoing-http-call-log.mustache | 21 + .../ubuntu/outgoing-http-call-metric.mustache | 227 +++++++++++ .../ubuntu/outgoing-http-call-trace.mustache | 62 +++ .../ec2/ubuntu/remote-service-log.mustache | 20 + .../ec2/ubuntu/remote-service-metric.mustache | 326 +++++++++++++++ .../ec2/ubuntu/remote-service-trace.mustache | 97 +++++ 16 files changed, 1530 insertions(+), 55 deletions(-) create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-log.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-metric.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-trace.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-log.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-metric.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-trace.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-log.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-metric.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-trace.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-log.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-metric.mustache create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-trace.mustache diff --git a/.github/workflows/java-ec2-ubuntu-test.yml b/.github/workflows/java-ec2-ubuntu-test.yml index ac6a669e9..1ed9d548c 100644 --- a/.github/workflows/java-ec2-ubuntu-test.yml +++ b/.github/workflows/java-ec2-ubuntu-test.yml @@ -4,7 +4,7 @@ # This is a reusable workflow for running the Enablement test for App Signals. # It is meant to be called from another workflow. # Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview -name: Java EC2 Default Use Case +name: Java EC2 Ubuntu Use Case on: workflow_call: inputs: @@ -14,20 +14,6 @@ on: caller-workflow-name: required: true type: string - java-version: - description: "Currently support version 8, 11, 17, 21, 22" - required: false - type: string - default: '11' - cpu-architecture: - description: "Permitted values: x86_64 or arm64" - required: false - type: string - default: "x86_64" - otel-source: - required: false - type: string - default: 'github' outputs: job-started: @@ -42,11 +28,8 @@ permissions: env: E2E_TEST_AWS_REGION: ${{ inputs.aws-region }} CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} - JAVA_VERSION: ${{ inputs.java-version }} - OTEL_SOURCE: ${{ inputs.otel-source }} - CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}//java-main-service-v${{ inputs.java-version }}.jar - SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}//java-remote-service-v${{ inputs.java-version }}.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v11.jar + SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v11.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -106,15 +89,11 @@ jobs: role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }} aws-region: ${{ env.E2E_TEST_AWS_REGION }} -# TODO: Use Latest version from Maven by latest_version=$(curl -s "https://search.maven.org/solrsearch/select?q=g:software.amazon.opentelemetry+a:aws-opentelemetry-agent&core=gav&rows=1&wt=json" | jq -r '.response.docs[0].v') - name: Set Get ADOT Wheel command environment variable run: | if [ "${{ github.event.repository.name }}" = "aws-otel-java-instrumentation" ]; then # Reusing the adot-main-build-staging-jar bucket to store the python wheel file echo GET_ADOT_JAR_COMMAND="aws s3 cp s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar ./adot.jar" >> $GITHUB_ENV - elif [ "${{ env.OTEL_SOURCE }}" == "maven" ]; then - echo "Latest version for Maven is: 1.32.5" - echo GET_ADOT_JAR_COMMAND="wget -O adot.jar https://repo1.maven.org/maven2/software/amazon/opentelemetry/aws-opentelemetry-agent/1.32.5/aws-opentelemetry-agent-1.32.5.jar" >> $GITHUB_ENV else echo GET_ADOT_JAR_COMMAND="wget -O adot.jar https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest/download/aws-opentelemetry-agent.jar" >> $GITHUB_ENV fi @@ -163,8 +142,6 @@ jobs: -var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \ -var="get_cw_agent_deb_command=${{ env.GET_CW_AGENT_DEB_COMMAND }}" \ -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \ - -var="language_version=${{ env.JAVA_VERSION }}" \ - -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index dd729d4fb..8dfb6905a 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -110,7 +110,6 @@ resource "null_resource" "main_service_setup" { provisioner "remote-exec" { inline = [ <<-EOF - #!/bin/bash # Make the Terraform fail if any step throws an error set -o errexit # Install wget @@ -207,13 +206,11 @@ resource "null_resource" "remote_service_setup" { provisioner "remote-exec" { inline = [ <<-EOF - #!/bin/bash # Make the Terraform fail if any step throws an error set -o errexit # Install wget sudo yum install wget -y # Install Java - echo if [[ "${var.language_version}" == "8" ]]; then sudo yum install java-1.8.0-amazon-corretto -y else @@ -285,7 +282,6 @@ resource "null_resource" "traffic_generator_setup" { provisioner "remote-exec" { inline = [ <<-EOF - #!/bin/bash sudo yum install nodejs aws-cli unzip tmux -y # Bring in the traffic generator files to EC2 Instance diff --git a/terraform/java/ec2/ubuntu/main.tf b/terraform/java/ec2/ubuntu/main.tf index 9ad39ead5..db83ae76b 100644 --- a/terraform/java/ec2/ubuntu/main.tf +++ b/terraform/java/ec2/ubuntu/main.tf @@ -52,10 +52,7 @@ data "aws_ami" "ami" { name = "state" values = ["available"] } - filter { - name = "architecture" - values = [var.cpu_architecture] - } + filter { name = "image-type" values = ["machine"] @@ -79,7 +76,7 @@ data "aws_ami" "ami" { resource "aws_instance" "main_service_instance" { ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) - instance_type = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro" + instance_type = "t3.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] @@ -125,11 +122,7 @@ resource "null_resource" "main_service_setup" { # Clean apt cache sudo apt-get clean sudo apt-get autoremove -y - if [[ "${var.language_version}" == "8" ]]; then - sudo apt-get install -y openjdk-8-jdk - else - sudo apt-get install -y openjdk-${var.language_version}-jdk - fi + sudo apt-get install -y openjdk-11-jdk sudo apt-get install -y awscli # Copy in CW Agent configuration @@ -185,7 +178,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 = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro" + instance_type = "t3.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] @@ -219,7 +212,7 @@ resource "null_resource" "remote_service_setup" { #!/bin/bash # Make the Terraform fail if any step throws an error set -o errexit - # Install wget and Java based on OS + # Install wget and Java # Ubuntu commands sudo apt-get update sudo apt-get install -y software-properties-common @@ -231,11 +224,7 @@ resource "null_resource" "remote_service_setup" { # Clean apt cache sudo apt-get clean sudo apt-get autoremove -y - if [[ "${var.language_version}" == "8" ]]; then - sudo apt-get install -y openjdk-8-jdk - else - sudo apt-get install -y openjdk-${var.language_version}-jdk - fi + sudo apt-get install -y openjdk-11-jdk sudo apt-get install -y awscli sudo apt-get update sudo apt-get install ec2-instance-connect -y diff --git a/terraform/java/ec2/ubuntu/variables.tf b/terraform/java/ec2/ubuntu/variables.tf index fa1084287..24dd02ea7 100644 --- a/terraform/java/ec2/ubuntu/variables.tf +++ b/terraform/java/ec2/ubuntu/variables.tf @@ -43,12 +43,4 @@ variable "get_adot_jar_command" { variable "canary_type" { default = "java-ec2-ubuntu" -} - -variable "language_version" { - default = "11" -} - -variable "cpu_architecture" { - default = "x86_64" } \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-log.mustache new file mode 100644 index 000000000..5d820b066 --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-log.mustache @@ -0,0 +1,22 @@ +[{ + "EC2.InstanceId": "^{{instanceId}}$", + "Environment": "^ec2:default$", + "PlatformType": "^AWS::EC2$", + "Operation": "GET /aws-sdk-call", + "Version": "^1$", + "Telemetry.Source": "^LocalRootSpan$", + "Host": "^ip(-[0-9]{1,3}){4}.*$" +}, +{ + "EC2.InstanceId": "^{{instanceId}}$", + "Environment": "^ec2:default$", + "PlatformType": "^AWS::EC2$", + "Operation": "GET /aws-sdk-call", + "Version": "^1$", + "RemoteService": "AWS::S3", + "RemoteOperation": "GetBucketLocation", + "RemoteResourceIdentifier": "^e2e-test-bucket-name-{{testingId}}$", + "RemoteResourceType": "^AWS::S3::Bucket$", + "Telemetry.Source": "^ClientSpan$", + "Host": "^ip(-[0-9]{1,3}){4}.*$" +}] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-metric.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-metric.mustache new file mode 100644 index 000000000..4ad5135e0 --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-metric.mustache @@ -0,0 +1,376 @@ +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + + diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-trace.mustache new file mode 100644 index 000000000..488ce397b --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/aws-sdk-call-trace.mustache @@ -0,0 +1,67 @@ +[{ + "name": "^{{serviceName}}$", + "http": { + "request": { + "url": "^{{endpoint}}/aws-sdk-call(?:\\?ip=(([0-9]{1,3}\\.){3}[0-9]{1,3})&testingId={{testingId}})?$", + "method": "^GET$" + }, + "response": { + "status": "^200$" + } + }, + "aws": { + "account_id": "^{{accountId}}$" + }, + "annotations": { + "aws.local.service": "^{{serviceName}}$", + "aws.local.operation": "^GET /aws-sdk-call$", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "EC2.InstanceId": "^{{instanceId}}$", + "PlatformType": "^AWS::EC2$", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", + "aws.span.kind": "^LOCAL_ROOT$" + } + }, + "subsegments": [ + { + "subsegments": [ + { + "name": "^S3$", + "http": { + "request": { + "url": "^https://e2e-test-bucket-name-{{testingId}}.s3.{{region}}.amazonaws.com\\?location$", + "method": "^GET$" + } + }, + "annotations": { + "aws.local.service": "^{{serviceName}}$", + "aws.local.operation": "^GET /aws-sdk-call$", + "aws.remote.service": "^AWS::S3$", + "aws.remote.operation": "^GetBucketLocation$", + "aws.remote.resource.type": "^AWS::S3::Bucket$", + "aws.remote.resource.identifier": "^e2e-test-bucket-name-{{testingId}}$", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "EC2.InstanceId": "^{{instanceId}}$", + "PlatformType": "^AWS::EC2$", + "aws.span.kind": "^CLIENT$" + } + }, + "namespace": "^aws$" + } + ] + } + ] +}, +{ + "name": "^S3$", + "aws": { + "operation": "^GetBucketLocation$" + } +}] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-log.mustache new file mode 100644 index 000000000..25c72000a --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-log.mustache @@ -0,0 +1,20 @@ +[{ + "EC2.InstanceId": "^{{instanceId}}$", + "Environment": "^ec2:default$", + "PlatformType": "^AWS::EC2$", + "Operation": "InternalOperation", + "Version": "^1$", + "Telemetry.Source": "^LocalRootSpan$", + "Host": "^ip(-[0-9]{1,3}){4}.*$" +}, +{ + "EC2.InstanceId": "^{{instanceId}}$", + "Environment": "^ec2:default$", + "PlatformType": "^AWS::EC2$", + "Operation": "InternalOperation", + "Version": "^1$", + "RemoteService": "local-root-client-call", + "RemoteOperation": "GET /", + "Telemetry.Source": "^ClientSpan$", + "Host": "^ip(-[0-9]{1,3}){4}.*$" +}] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-metric.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-metric.mustache new file mode 100644 index 000000000..86fa8bbf5 --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-metric.mustache @@ -0,0 +1,227 @@ +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Operation + value: InternalOperation + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Operation + value: InternalOperation + - + name: Environment + value: ec2:default + - + name: RemoteService + value: local-root-client-call + - + name: RemoteOperation + value: GET / + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: local-root-client-call + - + name: RemoteOperation + value: GET / + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: local-root-client-call + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Operation + value: InternalOperation + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Operation + value: InternalOperation + - + name: Environment + value: ec2:default + - + name: RemoteService + value: local-root-client-call + - + name: RemoteOperation + value: GET / + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: local-root-client-call + - + name: RemoteOperation + value: GET / + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: local-root-client-call + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Operation + value: InternalOperation + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Operation + value: InternalOperation + - + name: Environment + value: ec2:default + - + name: RemoteService + value: local-root-client-call + - + name: RemoteOperation + value: GET / + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: local-root-client-call + - + name: RemoteOperation + value: GET / + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: local-root-client-call \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-trace.mustache new file mode 100644 index 000000000..5a7774e4b --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/client-call-trace.mustache @@ -0,0 +1,56 @@ +[{ + "name": "^{{serviceName}}$", + "annotations": { + "aws.local.service": "^{{serviceName}}$", + "aws.local.operation": "^InternalOperation$", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" + } + }, + "subsegments": [ + { + "name": "^local-root-client-call$", + "http": { + "request": { + "url": "^http://local-root-client-call$", + "method": "^GET$" + } + }, + "annotations": { + "aws.local.service": "^{{serviceName}}$", + "aws.local.operation": "^InternalOperation$", + "aws.remote.service": "^local-root-client-call$", + "aws.remote.operation": "GET /", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "EC2.InstanceId": "^{{instanceId}}$", + "PlatformType": "^AWS::EC2$", + "aws.span.kind": "^LOCAL_ROOT$" + } + }, + "namespace": "^remote$" + } + ] +}, +{ + "name": "^local-root-client-call$", + "http": { + "request": { + "url": "^http://local-root-client-call$", + "method": "^GET$" + }, + "response": { + "content_length": 0 + } + }, + "annotations": { + "aws.local.service": "^local-root-client-call$", + "aws.local.operation": "^GET /$" + } +}] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-log.mustache new file mode 100644 index 000000000..60c38935c --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-log.mustache @@ -0,0 +1,21 @@ +[{ + "EC2.InstanceId": "^{{instanceId}}$", + "Environment": "^ec2:default$", + "PlatformType": "^AWS::EC2$", + "Operation": "GET /outgoing-http-call", + "Version": "^1$", + "Telemetry.Source": "^LocalRootSpan$", + "Host": "^ip(-[0-9]{1,3}){4}.*$" +}, +{ + "EC2.InstanceId": "^{{instanceId}}$", + "Environment": "^ec2:default$", + "PlatformType": "^AWS::EC2$", + "Operation": "GET /outgoing-http-call", + "Version": "^1$", + "RemoteService": "www.amazon.com", + "RemoteOperation": "GET /", + "Telemetry.Source": "^ClientSpan$", + "Host": "^ip(-[0-9]{1,3}){4}.*$" +}] + diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-metric.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-metric.mustache new file mode 100644 index 000000000..bdf1983f7 --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-metric.mustache @@ -0,0 +1,227 @@ +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /outgoing-http-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /outgoing-http-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET / + - + name: RemoteService + value: www.amazon.com + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET / + - + name: RemoteService + value: www.amazon.com + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: www.amazon.com + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /outgoing-http-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /outgoing-http-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET / + - + name: RemoteService + value: www.amazon.com + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET / + - + name: RemoteService + value: www.amazon.com + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: www.amazon.com + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /outgoing-http-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /outgoing-http-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET / + - + name: RemoteService + value: www.amazon.com + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET / + - + name: RemoteService + value: www.amazon.com + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: www.amazon.com diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-trace.mustache new file mode 100644 index 000000000..c1a91c841 --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/outgoing-http-call-trace.mustache @@ -0,0 +1,62 @@ +[{ + "name": "^{{serviceName}}$", + "http": { + "request": { + "url": "^{{endpoint}}/outgoing-http-call$", + "method": "^GET$" + }, + "response": { + "status": "^200$" + } + }, + "aws": { + "account_id": "^{{accountId}}$" + }, + "annotations": { + "aws.local.service": "^{{serviceName}}$", + "aws.local.operation": "^GET /outgoing-http-call$", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "EC2.InstanceId": "^{{instanceId}}$", + "PlatformType": "^AWS::EC2$", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", + "aws.span.kind": "^LOCAL_ROOT$" + } + }, + "subsegments": [ + { + "subsegments": [ + { + "name": "^www.amazon.com$", + "http": { + "request": { + "url": "^https://www.amazon.com$", + "method": "^GET$" + } + }, + "annotations": { + "aws.local.service": "^{{serviceName}}$", + "aws.local.operation": "^GET /outgoing-http-call$", + "aws.remote.service": "^www.amazon.com$", + "aws.remote.operation": "^GET /$", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "EC2.InstanceId": "^{{instanceId}}$", + "PlatformType": "^AWS::EC2$", + "aws.span.kind": "^CLIENT$" + } + }, + "namespace": "^remote$" + } + ] + } + ] +}, +{ + "name": "^www.amazon.com$" +}] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-log.mustache new file mode 100644 index 000000000..cd457dc7b --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-log.mustache @@ -0,0 +1,20 @@ +[{ + "EC2.InstanceId": "^{{instanceId}}$", + "Environment": "^ec2:default$", + "PlatformType": "^AWS::EC2$", + "Operation": "GET /remote-service", + "Version": "^1$", + "Telemetry.Source": "^LocalRootSpan$", + "Host": "^ip(-[0-9]{1,3}){4}.*$" +}, +{ + "EC2.InstanceId": "^{{instanceId}}$", + "Environment": "^ec2:default$", + "PlatformType": "^AWS::EC2$", + "Operation": "GET /remote-service", + "Version": "^1$", + "RemoteService": "{{remoteServiceDeploymentName}}", + "RemoteOperation": "GET /healthcheck", + "Telemetry.Source": "^ClientSpan$", + "Host": "^ip(-[0-9]{1,3}){4}.*$" +}] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-metric.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-metric.mustache new file mode 100644 index 000000000..4b1f0ad9c --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-metric.mustache @@ -0,0 +1,326 @@ +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /remote-service + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /remote-service + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET /healthcheck + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Environment + value: ec2:default + - + name: Operation + value: GET /healthcheck + - + name: Service + value: {{remoteServiceName}} + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{remoteServiceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET /healthcheck + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /remote-service + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /remote-service + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET /healthcheck + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Environment + value: ec2:default + - + name: Operation + value: GET /healthcheck + - + name: Service + value: {{remoteServiceName}} + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{remoteServiceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET /healthcheck + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /remote-service + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET /remote-service + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET /healthcheck + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Environment + value: ec2:default + - + name: Operation + value: GET /healthcheck + - + name: Service + value: {{remoteServiceName}} + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{remoteServiceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GET /healthcheck + - + name: RemoteService + value: {{remoteServiceDeploymentName}} + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: RemoteService + value: {{remoteServiceDeploymentName}} diff --git a/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-trace.mustache new file mode 100644 index 000000000..2ef1f4d74 --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/ubuntu/remote-service-trace.mustache @@ -0,0 +1,97 @@ +[{ + "name": "^{{serviceName}}$", + "http": { + "request": { + "url": "^{{endpoint}}/remote-service(?:\\?ip=(([0-9]{1,3}\\.){3}[0-9]{1,3})&testingId={{testingId}})?$", + "method": "^GET$" + }, + "response": { + "status": "^200$" + } + }, + "aws": { + "account_id": "^{{accountId}}$" + }, + "annotations": { + "aws.local.service": "^{{serviceName}}$", + "aws.local.operation": "^GET /remote-service$", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "EC2.InstanceId": "^{{instanceId}}$", + "PlatformType": "^AWS::EC2$", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", + "aws.span.kind": "^LOCAL_ROOT$" + } + }, + "subsegments": [ + { + "subsegments": [ + { + "name": "^{{remoteServiceDeploymentName}}$", + "http": { + "request": { + "url": "^http://(([0-9]{1,3}.){3}[0-9]{1,3}):8080/healthcheck$", + "method": "^GET$" + } + }, + "annotations": { + "aws.local.service": "^{{serviceName}}$", + "aws.local.operation": "^GET /remote-service$", + "aws.remote.service": "^{{remoteServiceDeploymentName}}$", + "aws.remote.operation": "^GET /healthcheck$", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "EC2.InstanceId": "^{{instanceId}}$", + "PlatformType": "^AWS::EC2$", + "aws.span.kind": "^CLIENT$" + } + }, + "namespace": "^remote$" + } + ] + } + ] +}, +{ + "name": "^{{remoteServiceName}}$", + "http": { + "request": { + "url": "^http://(([0-9]{1,3}.){3}[0-9]{1,3}):8080/healthcheck$", + "method": "^GET$" + } + }, + "annotations": { + "aws.local.service": "^{{remoteServiceName}}$", + "aws.local.operation": "^GET /healthcheck$", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "EC2.InstanceId": "^i-[A-Za-z0-9]{17}$", + "PlatformType": "^AWS::EC2$", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", + "aws.span.kind": "^LOCAL_ROOT$" + } + }, + "subsegments": [ + { + "name": "^RemoteServiceController.healthcheck$", + "annotations": { + "aws.local.operation": "^GET /healthcheck$", + "aws.local.environment": "^ec2:default$" + }, + "metadata": { + "default": { + "EC2.InstanceId": "^i-[A-Za-z0-9]{17}$", + "PlatformType": "^AWS::EC2$" + } + } + } + ] +}] \ No newline at end of file From 6e46a698072beb3612cbf47768c0c7d57c7b6d5c Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Mon, 27 Jan 2025 14:48:53 -0800 Subject: [PATCH 14/18] Ubuntu test --- .github/workflows/java-ec2-canary.yml | 31 +++++++-------- .github/workflows/java-ec2-default-retry.yml | 38 +++++++++---------- .github/workflows/java-ec2-ubuntu-test.yml | 7 ++-- terraform/java/ec2/ubuntu/main.tf | 10 ++--- .../PredefinedExpectedTemplate.java | 19 ++++++++++ 5 files changed, 60 insertions(+), 45 deletions(-) diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index 3a52bec42..a53bacc8b 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -7,8 +7,8 @@ ## including logs, metrics, and traces. name: Java EC2 Enablement Canary Testing on: - schedule: - - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour + # schedule: + # - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour workflow_dispatch: # be able to run the workflow on demand permissions: @@ -20,24 +20,21 @@ jobs: strategy: fail-fast: false matrix: - aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', - 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', - 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', - 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] + aws-region: ['us-east-1'] uses: ./.github/workflows/java-ec2-default-retry.yml secrets: inherit with: aws-region: ${{ matrix.aws-region }} caller-workflow-name: 'appsignals-e2e-ec2-canary-test' - java-version: '11' - cpu-architecture: 'x86_64' + # java-version: '11' + # cpu-architecture: 'x86_64' - maven: - uses: ./.github/workflows/java-ec2-default-retry.yml - secrets: inherit - with: - aws-region: 'us-east-1' - caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' - otel-source: 'maven' - java-version: '11' - cpu-architecture: 'x86_64' \ No newline at end of file + # maven: + # uses: ./.github/workflows/java-ec2-default-retry.yml + # secrets: inherit + # with: + # aws-region: 'us-east-1' + # caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' + # otel-source: 'maven' + # java-version: '11' + # cpu-architecture: 'x86_64' \ No newline at end of file diff --git a/.github/workflows/java-ec2-default-retry.yml b/.github/workflows/java-ec2-default-retry.yml index 77edc7aca..ddbee927a 100644 --- a/.github/workflows/java-ec2-default-retry.yml +++ b/.github/workflows/java-ec2-default-retry.yml @@ -14,17 +14,17 @@ on: caller-workflow-name: required: true type: string - java-version: - required: true - type: string - cpu-architecture: - required: false - type: string - default: "x86_64" - otel-source: - required: false - type: string - default: 'github' + # java-version: + # required: true + # type: string + # cpu-architecture: + # required: false + # type: string + # default: "x86_64" + # otel-source: + # required: false + # type: string + # default: 'github' permissions: id-token: write @@ -32,26 +32,26 @@ permissions: jobs: java-ec2-default-attempt-1: - uses: ./.github/workflows/java-ec2-default-test.yml + uses: ./.github/workflows/java-ec2-ubuntu-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - java-version: ${{ inputs.java-version }} - otel-source: ${{ inputs.otel-source }} - cpu-architecture: ${{ inputs.cpu-architecture }} + # java-version: ${{ inputs.java-version }} + # otel-source: ${{ inputs.otel-source }} + # cpu-architecture: ${{ inputs.cpu-architecture }} java-ec2-default-attempt-2: needs: [ java-ec2-default-attempt-1 ] if: ${{ needs.java-ec2-default-attempt-1.outputs.job-started != 'true' }} - uses: ./.github/workflows/java-ec2-default-test.yml + uses: ./.github/workflows/java-ec2-ubuntu-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - java-version: ${{ inputs.java-version }} - otel-source: ${{ inputs.otel-source }} - cpu-architecture: ${{ inputs.cpu-architecture }} + # java-version: ${{ inputs.java-version }} + # 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-ubuntu-test.yml b/.github/workflows/java-ec2-ubuntu-test.yml index 1ed9d548c..ac27dc7b6 100644 --- a/.github/workflows/java-ec2-ubuntu-test.yml +++ b/.github/workflows/java-ec2-ubuntu-test.yml @@ -28,8 +28,8 @@ permissions: env: E2E_TEST_AWS_REGION: ${{ inputs.aws-region }} CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v11.jar - SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v11.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-main-service-v11.jar + SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-remote-service-v11.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -53,7 +53,7 @@ jobs: - uses: actions/checkout@v4 with: - repository: 'aws-observability/aws-application-signals-test-framework' + repository: 'Jeel-mehta/aws-application-signals-test-framework' ref: ${{ env.CALLER_WORKFLOW_NAME == 'main-build' && 'main' || github.ref }} fetch-depth: 0 @@ -101,7 +101,6 @@ jobs: - name: Set Get CW Agent command environment variable run: | if [ "${{ github.event.repository.name }}" = "amazon-cloudwatch-agent" ]; then - # Reusing the adot-main-build-staging-jar bucket to store the python wheel file echo GET_CW_AGENT_DEB_COMMAND= "aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ github.sha }}/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb ./cw-agent.deb" >> $GITHUB_ENV else echo GET_CW_AGENT_DEB_COMMAND="wget -O cw-agent.deb https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb" >> $GITHUB_ENV diff --git a/terraform/java/ec2/ubuntu/main.tf b/terraform/java/ec2/ubuntu/main.tf index db83ae76b..15362c5f8 100644 --- a/terraform/java/ec2/ubuntu/main.tf +++ b/terraform/java/ec2/ubuntu/main.tf @@ -75,7 +75,7 @@ data "aws_ami" "ami" { } resource "aws_instance" "main_service_instance" { - ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) + ami = data.aws_ami.ami.id instance_type = "t3.micro" key_name = local.ssh_key_name iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE" @@ -140,7 +140,7 @@ resource "null_resource" "main_service_setup" { # Get and run the sample application with configuration aws s3 cp ${var.sample_app_jar} ./main-service.jar - JAVA_TOOL_OPTIONS=' -javaagent:/home/ubuntu/adot.jar' \ + JAVA_TOOL_OPTIONS=' -javaagent:./adot.jar' \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ @@ -177,7 +177,7 @@ resource "null_resource" "main_service_setup" { } resource "aws_instance" "remote_service_instance" { - ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) + ami = data.aws_ami.ami.id instance_type = "t3.micro" key_name = local.ssh_key_name iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE" @@ -244,7 +244,7 @@ resource "null_resource" "remote_service_setup" { # Get and run the sample application with configuration aws s3 cp ${var.sample_remote_app_jar} ./remote-service.jar - JAVA_TOOL_OPTIONS=' -javaagent:/home/ubuntu/adot.jar' \ + JAVA_TOOL_OPTIONS=' -javaagent:./adot.jar' \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ @@ -303,7 +303,7 @@ resource "null_resource" "traffic_generator_setup" { sudo apt-get install -y awscli unzip tmux # Bring in the traffic generator files to EC2 Instance - aws s3 cp s3://aws-appsignals-sample-app-prod-${var.aws_region}/traffic-generator.zip ./traffic-generator.zip + aws s3 cp s3://aws-appsignals-sample-app-prod-jeel/traffic-generator.zip ./traffic-generator.zip unzip ./traffic-generator.zip -d ./ # Install the traffic generator dependencies diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index 9d7ff14d5..f28f11459 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -96,6 +96,25 @@ public enum PredefinedExpectedTemplate implements FileConfig { JAVA_EC2_ASG_CLIENT_CALL_METRIC("/expected-data-template/java/ec2/asg/client-call-metric.mustache"), JAVA_EC2_ASG_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/asg/client-call-trace.mustache"), + /** Java EC2 Ubuntu Test Case Validations */ + JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/ec2/ubuntu/outgoing-http-call-log.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_METRIC( + "/expected-data-template/java/ec2/ubuntu/outgoing-http-call-metric.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_TRACE( + "/expected-data-template/java/ec2/ubuntu/outgoing-http-call-trace.mustache"), + + JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_LOG("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-log.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_METRIC("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-metric.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_TRACE("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-trace.mustache"), + + JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_LOG("/expected-data-template/java/ec2/ubuntu/remote-service-log.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_METRIC("/expected-data-template/java/ec2/ubuntu/remote-service-metric.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_TRACE("/expected-data-template/java/ec2/ubuntu/remote-service-trace.mustache"), + + JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_LOG("/expected-data-template/java/ec2/ubuntu/client-call-log.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_METRIC("/expected-data-template/java/ec2/ubuntu/client-call-metric.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/ubuntu/client-call-trace.mustache"), + /** Java EC2 K8s Test Case Validations */ JAVA_K8S_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/k8s/outgoing-http-call-log.mustache"), JAVA_K8S_OUTGOING_HTTP_CALL_METRIC("/expected-data-template/java/k8s/outgoing-http-call-metric.mustache"), From 12f0c2c72d78f7ff01cc8001a11eb83737ad34e2 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Mon, 27 Jan 2025 14:55:15 -0800 Subject: [PATCH 15/18] Adjusting terraform file --- .github/workflows/java-ec2-ubuntu-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/java-ec2-ubuntu-test.yml b/.github/workflows/java-ec2-ubuntu-test.yml index ac27dc7b6..3c274abe6 100644 --- a/.github/workflows/java-ec2-ubuntu-test.yml +++ b/.github/workflows/java-ec2-ubuntu-test.yml @@ -17,9 +17,9 @@ on: outputs: job-started: - value: ${{ jobs.java-ec2-default.outputs.job-started }} + value: ${{ jobs.java-ec2-ubuntu.outputs.job-started }} validation-result: - value: ${{ jobs.java-ec2-default.outputs.validation-result }} + value: ${{ jobs.java-ec2-ubuntu.outputs.validation-result }} permissions: id-token: write @@ -117,7 +117,7 @@ jobs: - name: Initiate Terraform uses: ./.github/workflows/actions/execute_and_retry with: - command: "cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/java/ec2/default && terraform init && terraform validate" + command: "cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/java/ec2/ubuntu && terraform init && terraform validate" cleanup: "rm -rf .terraform && rm -rf .terraform.lock.hcl" max_retry: 6 sleep_time: 60 @@ -263,7 +263,7 @@ jobs: - name: Terraform destroy if: always() continue-on-error: true - working-directory: terraform/java/ec2/default + working-directory: terraform/java/ec2/ubuntu run: | terraform destroy -auto-approve \ -var="test_id=${{ env.TESTING_ID }}" \ No newline at end of file From e1a165cdca75caaa1fcaedd86730e3e3f6146391 Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Mon, 27 Jan 2025 15:13:39 -0800 Subject: [PATCH 16/18] Reverting back Testing changes --- .github/workflows/java-ec2-canary.yml | 31 ++++++++-------- .github/workflows/java-ec2-default-retry.yml | 38 ++++++++++---------- .github/workflows/java-ec2-ubuntu-test.yml | 6 ++-- terraform/java/ec2/ubuntu/main.tf | 2 +- 4 files changed, 40 insertions(+), 37 deletions(-) diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index a53bacc8b..3a52bec42 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -7,8 +7,8 @@ ## including logs, metrics, and traces. name: Java EC2 Enablement Canary Testing on: - # schedule: - # - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour + schedule: + - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour workflow_dispatch: # be able to run the workflow on demand permissions: @@ -20,21 +20,24 @@ jobs: strategy: fail-fast: false matrix: - aws-region: ['us-east-1'] + aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', + 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', + 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', + 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] uses: ./.github/workflows/java-ec2-default-retry.yml secrets: inherit with: aws-region: ${{ matrix.aws-region }} caller-workflow-name: 'appsignals-e2e-ec2-canary-test' - # java-version: '11' - # cpu-architecture: 'x86_64' + java-version: '11' + cpu-architecture: 'x86_64' - # maven: - # uses: ./.github/workflows/java-ec2-default-retry.yml - # secrets: inherit - # with: - # aws-region: 'us-east-1' - # caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' - # otel-source: 'maven' - # java-version: '11' - # cpu-architecture: 'x86_64' \ No newline at end of file + maven: + uses: ./.github/workflows/java-ec2-default-retry.yml + secrets: inherit + with: + aws-region: 'us-east-1' + caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' + otel-source: 'maven' + java-version: '11' + cpu-architecture: 'x86_64' \ No newline at end of file diff --git a/.github/workflows/java-ec2-default-retry.yml b/.github/workflows/java-ec2-default-retry.yml index ddbee927a..77edc7aca 100644 --- a/.github/workflows/java-ec2-default-retry.yml +++ b/.github/workflows/java-ec2-default-retry.yml @@ -14,17 +14,17 @@ on: caller-workflow-name: required: true type: string - # java-version: - # required: true - # type: string - # cpu-architecture: - # required: false - # type: string - # default: "x86_64" - # otel-source: - # required: false - # type: string - # default: 'github' + java-version: + required: true + type: string + cpu-architecture: + required: false + type: string + default: "x86_64" + otel-source: + required: false + type: string + default: 'github' permissions: id-token: write @@ -32,26 +32,26 @@ permissions: jobs: java-ec2-default-attempt-1: - uses: ./.github/workflows/java-ec2-ubuntu-test.yml + uses: ./.github/workflows/java-ec2-default-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - # java-version: ${{ inputs.java-version }} - # otel-source: ${{ inputs.otel-source }} - # cpu-architecture: ${{ inputs.cpu-architecture }} + java-version: ${{ inputs.java-version }} + otel-source: ${{ inputs.otel-source }} + cpu-architecture: ${{ inputs.cpu-architecture }} java-ec2-default-attempt-2: needs: [ java-ec2-default-attempt-1 ] if: ${{ needs.java-ec2-default-attempt-1.outputs.job-started != 'true' }} - uses: ./.github/workflows/java-ec2-ubuntu-test.yml + uses: ./.github/workflows/java-ec2-default-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - # java-version: ${{ inputs.java-version }} - # otel-source: ${{ inputs.otel-source }} - # cpu-architecture: ${{ inputs.cpu-architecture }} + java-version: ${{ inputs.java-version }} + 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-ubuntu-test.yml b/.github/workflows/java-ec2-ubuntu-test.yml index 3c274abe6..76e0f39c3 100644 --- a/.github/workflows/java-ec2-ubuntu-test.yml +++ b/.github/workflows/java-ec2-ubuntu-test.yml @@ -28,8 +28,8 @@ permissions: env: E2E_TEST_AWS_REGION: ${{ inputs.aws-region }} CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-main-service-v11.jar - SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-remote-service-v11.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v11.jar + SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v11.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -53,7 +53,7 @@ jobs: - uses: actions/checkout@v4 with: - repository: 'Jeel-mehta/aws-application-signals-test-framework' + repository: 'aws-observability/aws-application-signals-test-framework' ref: ${{ env.CALLER_WORKFLOW_NAME == 'main-build' && 'main' || github.ref }} fetch-depth: 0 diff --git a/terraform/java/ec2/ubuntu/main.tf b/terraform/java/ec2/ubuntu/main.tf index 15362c5f8..9d6412f2f 100644 --- a/terraform/java/ec2/ubuntu/main.tf +++ b/terraform/java/ec2/ubuntu/main.tf @@ -303,7 +303,7 @@ resource "null_resource" "traffic_generator_setup" { sudo apt-get install -y awscli unzip tmux # Bring in the traffic generator files to EC2 Instance - aws s3 cp s3://aws-appsignals-sample-app-prod-jeel/traffic-generator.zip ./traffic-generator.zip + aws s3 cp s3://aws-appsignals-sample-app-prod-${var.aws_region}/traffic-generator.zip ./traffic-generator.zip unzip ./traffic-generator.zip -d ./ # Install the traffic generator dependencies From aad54696b2acfc9a7e115a7b115cd0f81cf68c6c Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Mon, 27 Jan 2025 16:23:54 -0800 Subject: [PATCH 17/18] Testing ubuntu --- .github/workflows/java-ec2-canary.yml | 31 +++++++-------- .github/workflows/java-ec2-default-retry.yml | 38 +++++++++---------- .github/workflows/java-ec2-ubuntu-test.yml | 9 ++--- terraform/java/ec2/ubuntu/main.tf | 2 +- .../PredefinedExpectedTemplate.java | 24 ++++++------ .../java/ec2/ubuntu/log-validation.yml | 8 ++-- .../java/ec2/ubuntu/metric-validation.yml | 8 ++-- .../java/ec2/ubuntu/trace-validation.yml | 8 ++-- 8 files changed, 62 insertions(+), 66 deletions(-) diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index 3a52bec42..a53bacc8b 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -7,8 +7,8 @@ ## including logs, metrics, and traces. name: Java EC2 Enablement Canary Testing on: - schedule: - - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour + # schedule: + # - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour workflow_dispatch: # be able to run the workflow on demand permissions: @@ -20,24 +20,21 @@ jobs: strategy: fail-fast: false matrix: - aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', - 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', - 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', - 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] + aws-region: ['us-east-1'] uses: ./.github/workflows/java-ec2-default-retry.yml secrets: inherit with: aws-region: ${{ matrix.aws-region }} caller-workflow-name: 'appsignals-e2e-ec2-canary-test' - java-version: '11' - cpu-architecture: 'x86_64' + # java-version: '11' + # cpu-architecture: 'x86_64' - maven: - uses: ./.github/workflows/java-ec2-default-retry.yml - secrets: inherit - with: - aws-region: 'us-east-1' - caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' - otel-source: 'maven' - java-version: '11' - cpu-architecture: 'x86_64' \ No newline at end of file + # maven: + # uses: ./.github/workflows/java-ec2-default-retry.yml + # secrets: inherit + # with: + # aws-region: 'us-east-1' + # caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' + # otel-source: 'maven' + # java-version: '11' + # cpu-architecture: 'x86_64' \ No newline at end of file diff --git a/.github/workflows/java-ec2-default-retry.yml b/.github/workflows/java-ec2-default-retry.yml index 77edc7aca..ddbee927a 100644 --- a/.github/workflows/java-ec2-default-retry.yml +++ b/.github/workflows/java-ec2-default-retry.yml @@ -14,17 +14,17 @@ on: caller-workflow-name: required: true type: string - java-version: - required: true - type: string - cpu-architecture: - required: false - type: string - default: "x86_64" - otel-source: - required: false - type: string - default: 'github' + # java-version: + # required: true + # type: string + # cpu-architecture: + # required: false + # type: string + # default: "x86_64" + # otel-source: + # required: false + # type: string + # default: 'github' permissions: id-token: write @@ -32,26 +32,26 @@ permissions: jobs: java-ec2-default-attempt-1: - uses: ./.github/workflows/java-ec2-default-test.yml + uses: ./.github/workflows/java-ec2-ubuntu-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - java-version: ${{ inputs.java-version }} - otel-source: ${{ inputs.otel-source }} - cpu-architecture: ${{ inputs.cpu-architecture }} + # java-version: ${{ inputs.java-version }} + # otel-source: ${{ inputs.otel-source }} + # cpu-architecture: ${{ inputs.cpu-architecture }} java-ec2-default-attempt-2: needs: [ java-ec2-default-attempt-1 ] if: ${{ needs.java-ec2-default-attempt-1.outputs.job-started != 'true' }} - uses: ./.github/workflows/java-ec2-default-test.yml + uses: ./.github/workflows/java-ec2-ubuntu-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - java-version: ${{ inputs.java-version }} - otel-source: ${{ inputs.otel-source }} - cpu-architecture: ${{ inputs.cpu-architecture }} + # java-version: ${{ inputs.java-version }} + # 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-ubuntu-test.yml b/.github/workflows/java-ec2-ubuntu-test.yml index 76e0f39c3..af0b86e76 100644 --- a/.github/workflows/java-ec2-ubuntu-test.yml +++ b/.github/workflows/java-ec2-ubuntu-test.yml @@ -28,8 +28,8 @@ permissions: env: E2E_TEST_AWS_REGION: ${{ inputs.aws-region }} CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v11.jar - SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v11.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-main-service-v11.jar + SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-remote-service-v11.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -53,7 +53,7 @@ jobs: - uses: actions/checkout@v4 with: - repository: 'aws-observability/aws-application-signals-test-framework' + repository: 'Jeel-mehta/aws-application-signals-test-framework' ref: ${{ env.CALLER_WORKFLOW_NAME == 'main-build' && 'main' || github.ref }} fetch-depth: 0 @@ -89,10 +89,9 @@ jobs: role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }} aws-region: ${{ env.E2E_TEST_AWS_REGION }} - - name: Set Get ADOT Wheel command environment variable + - name: Set Get ADOT JAR command environment variable run: | if [ "${{ github.event.repository.name }}" = "aws-otel-java-instrumentation" ]; then - # Reusing the adot-main-build-staging-jar bucket to store the python wheel file echo GET_ADOT_JAR_COMMAND="aws s3 cp s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar ./adot.jar" >> $GITHUB_ENV else echo GET_ADOT_JAR_COMMAND="wget -O adot.jar https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest/download/aws-opentelemetry-agent.jar" >> $GITHUB_ENV diff --git a/terraform/java/ec2/ubuntu/main.tf b/terraform/java/ec2/ubuntu/main.tf index 9d6412f2f..15362c5f8 100644 --- a/terraform/java/ec2/ubuntu/main.tf +++ b/terraform/java/ec2/ubuntu/main.tf @@ -303,7 +303,7 @@ resource "null_resource" "traffic_generator_setup" { sudo apt-get install -y awscli unzip tmux # Bring in the traffic generator files to EC2 Instance - aws s3 cp s3://aws-appsignals-sample-app-prod-${var.aws_region}/traffic-generator.zip ./traffic-generator.zip + aws s3 cp s3://aws-appsignals-sample-app-prod-jeel/traffic-generator.zip ./traffic-generator.zip unzip ./traffic-generator.zip -d ./ # Install the traffic generator dependencies diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index f28f11459..2bd01de29 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -97,23 +97,23 @@ public enum PredefinedExpectedTemplate implements FileConfig { JAVA_EC2_ASG_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/asg/client-call-trace.mustache"), /** Java EC2 Ubuntu Test Case Validations */ - JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/ec2/ubuntu/outgoing-http-call-log.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_METRIC( + JAVA_EC2_UBUNTU_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/ec2/ubuntu/outgoing-http-call-log.mustache"), + JAVA_EC2_UBUNTU_OUTGOING_HTTP_CALL_METRIC( "/expected-data-template/java/ec2/ubuntu/outgoing-http-call-metric.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_TRACE( + JAVA_EC2_UBUNTU_OUTGOING_HTTP_CALL_TRACE( "/expected-data-template/java/ec2/ubuntu/outgoing-http-call-trace.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_LOG("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-log.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_METRIC("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-metric.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_TRACE("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-trace.mustache"), + JAVA_EC2_UBUNTU_AWS_SDK_CALL_LOG("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-log.mustache"), + JAVA_EC2_UBUNTU_AWS_SDK_CALL_METRIC("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-metric.mustache"), + JAVA_EC2_UBUNTU_AWS_SDK_CALL_TRACE("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-trace.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_LOG("/expected-data-template/java/ec2/ubuntu/remote-service-log.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_METRIC("/expected-data-template/java/ec2/ubuntu/remote-service-metric.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_TRACE("/expected-data-template/java/ec2/ubuntu/remote-service-trace.mustache"), + JAVA_EC2_UBUNTU_REMOTE_SERVICE_LOG("/expected-data-template/java/ec2/ubuntu/remote-service-log.mustache"), + JAVA_EC2_UBUNTU_REMOTE_SERVICE_METRIC("/expected-data-template/java/ec2/ubuntu/remote-service-metric.mustache"), + JAVA_EC2_UBUNTU_REMOTE_SERVICE_TRACE("/expected-data-template/java/ec2/ubuntu/remote-service-trace.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_LOG("/expected-data-template/java/ec2/ubuntu/client-call-log.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_METRIC("/expected-data-template/java/ec2/ubuntu/client-call-metric.mustache"), - JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/ubuntu/client-call-trace.mustache"), + JAVA_EC2_UBUNTU_CLIENT_CALL_LOG("/expected-data-template/java/ec2/ubuntu/client-call-log.mustache"), + JAVA_EC2_UBUNTU_CLIENT_CALL_METRIC("/expected-data-template/java/ec2/ubuntu/client-call-metric.mustache"), + JAVA_EC2_UBUNTU_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/ubuntu/client-call-trace.mustache"), /** Java EC2 K8s Test Case Validations */ JAVA_K8S_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/k8s/outgoing-http-call-log.mustache"), diff --git a/validator/src/main/resources/validations/java/ec2/ubuntu/log-validation.yml b/validator/src/main/resources/validations/java/ec2/ubuntu/log-validation.yml index 7eb76ace9..1b7b06c6f 100644 --- a/validator/src/main/resources/validations/java/ec2/ubuntu/log-validation.yml +++ b/validator/src/main/resources/validations/java/ec2/ubuntu/log-validation.yml @@ -3,25 +3,25 @@ httpPath: "/outgoing-http-call" httpMethod: "get" callingType: "http" - expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_LOG" + expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_OUTGOING_HTTP_CALL_LOG" - validationType: "cw-log" httpPath: "/aws-sdk-call" httpMethod: "get" callingType: "http-with-query" - expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_LOG" + expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_AWS_SDK_CALL_LOG" - validationType: "cw-log" httpPath: "/remote-service" httpMethod: "get" callingType: "http-with-query" - expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_LOG" + expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_REMOTE_SERVICE_LOG" - validationType: "cw-log" httpPath: "/client-call" httpMethod: "get" callingType: "http" - expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_LOG" + expectedLogStructureTemplate: "JAVA_EC2_UBUNTU_CLIENT_CALL_LOG" - validationType: "cw-log" callingType: "none" diff --git a/validator/src/main/resources/validations/java/ec2/ubuntu/metric-validation.yml b/validator/src/main/resources/validations/java/ec2/ubuntu/metric-validation.yml index a0e35e8d6..efaa3a075 100644 --- a/validator/src/main/resources/validations/java/ec2/ubuntu/metric-validation.yml +++ b/validator/src/main/resources/validations/java/ec2/ubuntu/metric-validation.yml @@ -3,25 +3,25 @@ httpPath: "/outgoing-http-call" httpMethod: "get" callingType: "http" - expectedMetricTemplate: "JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_METRIC" + expectedMetricTemplate: "JAVA_EC2_UBUNTU_OUTGOING_HTTP_CALL_METRIC" - validationType: "cw-metric" httpPath: "/aws-sdk-call" httpMethod: "get" callingType: "http-with-query" - expectedMetricTemplate: "JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_METRIC" + expectedMetricTemplate: "JAVA_EC2_UBUNTU_AWS_SDK_CALL_METRIC" - validationType: "cw-metric" httpPath: "/remote-service" httpMethod: "get" callingType: "http-with-query" - expectedMetricTemplate: "JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_METRIC" + expectedMetricTemplate: "JAVA_EC2_UBUNTU_REMOTE_SERVICE_METRIC" - validationType: "cw-metric" httpPath: "/client-call" httpMethod: "get" callingType: "http" - expectedMetricTemplate: "JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_METRIC" + expectedMetricTemplate: "JAVA_EC2_UBUNTU_CLIENT_CALL_METRIC" - validationType: "cw-metric" callingType: "none" diff --git a/validator/src/main/resources/validations/java/ec2/ubuntu/trace-validation.yml b/validator/src/main/resources/validations/java/ec2/ubuntu/trace-validation.yml index 44cb4ceb7..ff410c081 100644 --- a/validator/src/main/resources/validations/java/ec2/ubuntu/trace-validation.yml +++ b/validator/src/main/resources/validations/java/ec2/ubuntu/trace-validation.yml @@ -3,22 +3,22 @@ httpPath: "/outgoing-http-call" httpMethod: "get" callingType: "http" - expectedTraceTemplate: "JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_TRACE" + expectedTraceTemplate: "JAVA_EC2_UBUNTU_OUTGOING_HTTP_CALL_TRACE" - validationType: "trace" httpPath: "/aws-sdk-call" httpMethod: "get" callingType: "http-with-query" - expectedTraceTemplate: "JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_TRACE" + expectedTraceTemplate: "JAVA_EC2_UBUNTU_AWS_SDK_CALL_TRACE" - validationType: "trace" httpPath: "/remote-service" httpMethod: "get" callingType: "http-with-query" - expectedTraceTemplate: "JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_TRACE" + expectedTraceTemplate: "JAVA_EC2_UBUNTU_REMOTE_SERVICE_TRACE" - validationType: "trace" httpPath: "/client-call" httpMethod: "get" callingType: "http" - expectedTraceTemplate: "JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_TRACE" \ No newline at end of file + expectedTraceTemplate: "JAVA_EC2_UBUNTU_CLIENT_CALL_TRACE" \ No newline at end of file From b1745c379bb35f06cc565879f81e7e5c5f8f847d Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Mon, 27 Jan 2025 16:39:23 -0800 Subject: [PATCH 18/18] Final Test --- .github/workflows/java-ec2-canary.yml | 31 ++++++++-------- .github/workflows/java-ec2-default-retry.yml | 38 ++++++++++---------- .github/workflows/java-ec2-ubuntu-test.yml | 6 ++-- terraform/java/ec2/ubuntu/main.tf | 2 +- 4 files changed, 40 insertions(+), 37 deletions(-) diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index a53bacc8b..3a52bec42 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -7,8 +7,8 @@ ## including logs, metrics, and traces. name: Java EC2 Enablement Canary Testing on: - # schedule: - # - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour + schedule: + - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour workflow_dispatch: # be able to run the workflow on demand permissions: @@ -20,21 +20,24 @@ jobs: strategy: fail-fast: false matrix: - aws-region: ['us-east-1'] + aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', + 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', + 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', + 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] uses: ./.github/workflows/java-ec2-default-retry.yml secrets: inherit with: aws-region: ${{ matrix.aws-region }} caller-workflow-name: 'appsignals-e2e-ec2-canary-test' - # java-version: '11' - # cpu-architecture: 'x86_64' + java-version: '11' + cpu-architecture: 'x86_64' - # maven: - # uses: ./.github/workflows/java-ec2-default-retry.yml - # secrets: inherit - # with: - # aws-region: 'us-east-1' - # caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' - # otel-source: 'maven' - # java-version: '11' - # cpu-architecture: 'x86_64' \ No newline at end of file + maven: + uses: ./.github/workflows/java-ec2-default-retry.yml + secrets: inherit + with: + aws-region: 'us-east-1' + caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' + otel-source: 'maven' + java-version: '11' + cpu-architecture: 'x86_64' \ No newline at end of file diff --git a/.github/workflows/java-ec2-default-retry.yml b/.github/workflows/java-ec2-default-retry.yml index ddbee927a..77edc7aca 100644 --- a/.github/workflows/java-ec2-default-retry.yml +++ b/.github/workflows/java-ec2-default-retry.yml @@ -14,17 +14,17 @@ on: caller-workflow-name: required: true type: string - # java-version: - # required: true - # type: string - # cpu-architecture: - # required: false - # type: string - # default: "x86_64" - # otel-source: - # required: false - # type: string - # default: 'github' + java-version: + required: true + type: string + cpu-architecture: + required: false + type: string + default: "x86_64" + otel-source: + required: false + type: string + default: 'github' permissions: id-token: write @@ -32,26 +32,26 @@ permissions: jobs: java-ec2-default-attempt-1: - uses: ./.github/workflows/java-ec2-ubuntu-test.yml + uses: ./.github/workflows/java-ec2-default-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - # java-version: ${{ inputs.java-version }} - # otel-source: ${{ inputs.otel-source }} - # cpu-architecture: ${{ inputs.cpu-architecture }} + java-version: ${{ inputs.java-version }} + otel-source: ${{ inputs.otel-source }} + cpu-architecture: ${{ inputs.cpu-architecture }} java-ec2-default-attempt-2: needs: [ java-ec2-default-attempt-1 ] if: ${{ needs.java-ec2-default-attempt-1.outputs.job-started != 'true' }} - uses: ./.github/workflows/java-ec2-ubuntu-test.yml + uses: ./.github/workflows/java-ec2-default-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - # java-version: ${{ inputs.java-version }} - # otel-source: ${{ inputs.otel-source }} - # cpu-architecture: ${{ inputs.cpu-architecture }} + java-version: ${{ inputs.java-version }} + 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-ubuntu-test.yml b/.github/workflows/java-ec2-ubuntu-test.yml index af0b86e76..a17b091e3 100644 --- a/.github/workflows/java-ec2-ubuntu-test.yml +++ b/.github/workflows/java-ec2-ubuntu-test.yml @@ -28,8 +28,8 @@ permissions: env: E2E_TEST_AWS_REGION: ${{ inputs.aws-region }} CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-main-service-v11.jar - SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-remote-service-v11.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v11.jar + SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v11.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -53,7 +53,7 @@ jobs: - uses: actions/checkout@v4 with: - repository: 'Jeel-mehta/aws-application-signals-test-framework' + repository: 'aws-observability/aws-application-signals-test-framework' ref: ${{ env.CALLER_WORKFLOW_NAME == 'main-build' && 'main' || github.ref }} fetch-depth: 0 diff --git a/terraform/java/ec2/ubuntu/main.tf b/terraform/java/ec2/ubuntu/main.tf index 15362c5f8..9d6412f2f 100644 --- a/terraform/java/ec2/ubuntu/main.tf +++ b/terraform/java/ec2/ubuntu/main.tf @@ -303,7 +303,7 @@ resource "null_resource" "traffic_generator_setup" { sudo apt-get install -y awscli unzip tmux # Bring in the traffic generator files to EC2 Instance - aws s3 cp s3://aws-appsignals-sample-app-prod-jeel/traffic-generator.zip ./traffic-generator.zip + aws s3 cp s3://aws-appsignals-sample-app-prod-${var.aws_region}/traffic-generator.zip ./traffic-generator.zip unzip ./traffic-generator.zip -d ./ # Install the traffic generator dependencies