diff --git a/.github/workflows/appsignals-e2e-ec2-canary-test.yml b/.github/workflows/appsignals-e2e-ec2-canary-test.yml deleted file mode 100644 index 44968e6def..0000000000 --- a/.github/workflows/appsignals-e2e-ec2-canary-test.yml +++ /dev/null @@ -1,25 +0,0 @@ -## This workflow aims to run the Application Signals end-to-end tests as a canary to -## test the artifacts for App Signals enablement. It will deploy a sample app and remote -## service on two EC2 instances, call the APIs, and validate the generated telemetry, -## including logs, metrics, and traces. -name: App Signals Enablement - E2E EC2 Canary Testing -on: - schedule: - - cron: '0/15 * * * *' # run the workflow every 15 minutes - workflow_dispatch: # be able to run the workflow on demand - -permissions: - id-token: write - contents: read - -jobs: - e2e-canary-test: - strategy: - fail-fast: false - matrix: - aws-region: ['us-east-1', 'us-east-2', 'eu-west-1', 'ap-northeast-1', 'ap-southeast-2'] - uses: ./.github/workflows/appsignals-e2e-ec2-test.yml - secrets: inherit - with: - aws-region: ${{ matrix.aws-region }} - caller-workflow-name: 'appsignals-e2e-ec2-canary-test' diff --git a/.github/workflows/appsignals-e2e-ec2-test.yml b/.github/workflows/appsignals-e2e-ec2-test.yml index 428c8ad02e..84d4cd7e6a 100644 --- a/.github/workflows/appsignals-e2e-ec2-test.yml +++ b/.github/workflows/appsignals-e2e-ec2-test.yml @@ -24,6 +24,8 @@ env: SAMPLE_APP_FRONTEND_SERVICE_JAR: ${{ secrets.APP_SIGNALS_E2E_FE_SA_JAR }} SAMPLE_APP_REMOTE_SERVICE_JAR: ${{ secrets.APP_SIGNALS_E2E_RE_SA_JAR }} APP_SIGNALS_ADOT_JAR: "https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest/download/aws-opentelemetry-agent.jar" + GET_CW_AGENT_RPM_COMMAND: "wget -O cw-agent.rpm https://amazoncloudwatch-agent-us-east-1.s3.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" + GET_ADOT_JAR_COMMAND: "aws s3 cp s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar ./adot.jar" METRIC_NAMESPACE: AppSignals LOG_GROUP_NAME: /aws/appsignals/generic @@ -31,22 +33,11 @@ jobs: e2e-ec2-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Get testing resources from aws-application-signals-test-framework + uses: actions/checkout@v4 with: - fetch-depth: 0 - - - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - - name: Set CW Agent RPM environment variable - run: | - if [ ${{ env.AWS_DEFAULT_REGION }} == "us-east-1" ]; then - echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-us-east-1.s3.amazonaws.com/amazon_linux/amd64/1.300031.0b313/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV - else - echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ env.AWS_DEFAULT_REGION }}.s3.${{ env.AWS_DEFAULT_REGION }}.amazonaws.com/amazon_linux/amd64/1.300031.0b313/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV - fi + repository: aws-observability/aws-application-signals-test-framework + ref: main - name: Generate testing id run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV @@ -58,135 +49,73 @@ jobs: aws-region: ${{ env.AWS_DEFAULT_REGION }} - uses: actions/download-artifact@v3 - if: inputs.caller-workflow-name == 'main-build' with: name: aws-opentelemetry-agent.jar - name: Upload main-build adot.jar to s3 - if: inputs.caller-workflow-name == 'main-build' - run: aws s3 cp ./aws-opentelemetry-agent-*-SNAPSHOT.jar s3://main-build-adot-staging-jar/aws-opentelemetry-agent.jar - - - name: Set Get ADOT.jar command environment variable - working-directory: testing/terraform/ec2 - run: | - if [ ${{ inputs.caller-workflow-name }} == "main-build" ]; then - echo GET_ADOT_JAR_COMMAND="aws s3 cp s3://main-build-adot-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 - fi + run: aws s3 cp ./aws-opentelemetry-agent-*-SNAPSHOT.jar s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar - name: Set up terraform uses: hashicorp/setup-terraform@v3 with: terraform_wrapper: false - - name: Deploy sample app via terraform and wait for endpoint to come online - working-directory: testing/terraform/ec2 + - name: Deploy sample app via terraform + working-directory: terraform/ec2 run: | terraform init terraform validate - - # 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=${{ env.AWS_DEFAULT_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_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \ - -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \ - || deployment_failed=$? - - if [ $deployment_failed -eq 1 ]; then - echo "Terraform deployment was unsuccessful. Will attempt to retry deployment." - fi - - # If the deployment_failed is still 0, then the terraform deployment succeeded and now try to connect to the endpoint. - # Attempts to connect will be made for up to 10 minutes - if [ $deployment_failed -eq 0 ]; then - echo "Attempting to connect to the endpoint" - sample_app_endpoint=http://$(terraform output sample_app_main_service_public_dns):8080 - attempt_counter=0 - max_attempts=60 - until $(curl --output /dev/null --silent --head --fail $(echo "$sample_app_endpoint" | tr -d '"')); do - if [ ${attempt_counter} -eq ${max_attempts} ];then - echo "Failed to connect to endpoint. Will attempt to redeploy sample app." - deployment_failed=1 - break - fi - - printf '.' - attempt_counter=$(($attempt_counter+1)) - sleep 10 - done - 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 - - # cache local patch outputs - - name: Cache local Maven repository - id: cache-local-maven-repo - uses: actions/cache@v3 - with: - path: | - ~/.m2/repository/io/opentelemetry/ - key: ${{ runner.os }}-maven-local-${{ hashFiles('.github/patches/opentelemetry-java*.patch') }} - - - name: Publish patched dependencies to maven local - uses: ./.github/actions/patch-dependencies - if: steps.cache-local-maven-repo.outputs.cache-hit != 'true' - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - gpg_password: ${{ secrets.GPG_PASSPHRASE }} + terraform apply -auto-approve \ + -var="aws_region=${{ env.AWS_DEFAULT_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_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \ + -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" - name: Get the ec2 instance ami id run: | echo "EC2_INSTANCE_AMI=$(terraform output ec2_instance_ami)" >> $GITHUB_ENV - working-directory: testing/terraform/ec2 + working-directory: terraform/ec2 - name: Get the sample app endpoint run: | echo "MAIN_SERVICE_ENDPOINT=$(terraform output sample_app_main_service_public_dns):8080" >> $GITHUB_ENV echo "REMOTE_SERVICE_IP=$(terraform output sample_app_remote_service_public_ip)" >> $GITHUB_ENV - working-directory: testing/terraform/ec2 + working-directory: terraform/ec2 + + - name: Wait for app endpoint to come online + id: endpoint-check + run: | + attempt_counter=0 + max_attempts=30 + until $(curl --output /dev/null --silent --head --fail http://${{ env.MAIN_SERVICE_ENDPOINT }}); do + if [ ${attempt_counter} -eq ${max_attempts} ];then + echo "Max attempts reached" + exit 1 + fi + + printf '.' + attempt_counter=$(($attempt_counter+1)) + sleep 10 + done # This steps increases the speed of the validation by creating the telemetry data in advance - name: Call all test APIs continue-on-error: true run: | - curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call/ - curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call/ - curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}/ - curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call/ + curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call/; echo + curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call/; echo + curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}/; echo + curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call/; echo + + - name: Build Gradle + run: ./gradlew # Validation for pulse telemetry data - name: Validate generated EMF logs id: log-validation - run: ./gradlew testing:validator:run --args='-c ec2/log-validation.yml + run: ./gradlew validator:run --args='-c ec2/log-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 @@ -203,7 +132,7 @@ jobs: - name: Validate generated metrics id: metric-validation if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() - run: ./gradlew testing:validator:run --args='-c ec2/metric-validation.yml + run: ./gradlew validator:run --args='-c ec2/metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 @@ -220,7 +149,7 @@ jobs: - name: Validate generated traces id: trace-validation if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled() - run: ./gradlew testing:validator:run --args='-c ec2/trace-validation.yml + run: ./gradlew validator:run --args='-c ec2/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 @@ -255,7 +184,7 @@ jobs: - name: Terraform destroy if: always() continue-on-error: true - working-directory: testing/terraform/ec2 + working-directory: terraform/ec2 run: | terraform destroy -auto-approve \ -var="test_id=${{ env.TESTING_ID }}" \ No newline at end of file diff --git a/.github/workflows/appsignals-e2e-eks-canary-test.yml b/.github/workflows/appsignals-e2e-eks-canary-test.yml deleted file mode 100644 index 7380042cf7..0000000000 --- a/.github/workflows/appsignals-e2e-eks-canary-test.yml +++ /dev/null @@ -1,30 +0,0 @@ -## This workflow aims to run the Application Signals end-to-end tests as a canary to -## test the artifacts for App Signals enablement. It will deploy a sample app and remote -## service onto an EKS cluster, call the APIs, and validate the generated telemetry, -## including logs, metrics, and traces. -name: App Signals Enablement - E2E EKS Canary Testing -on: - schedule: - - cron: '0/15 * * * *' # run the workflow every 15 minutes - workflow_dispatch: # be able to run the workflow on demand - -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: false - -permissions: - id-token: write - contents: read - -jobs: - e2e-test: - strategy: - fail-fast: false - matrix: - aws-region: ['us-east-1', 'us-east-2', 'eu-west-1', 'ap-northeast-1', 'ap-southeast-2'] - uses: ./.github/workflows/appsignals-e2e-eks-test.yml - secrets: inherit - with: - aws-region: ${{ matrix.aws-region }} - test-cluster-name: 'e2e-canary-test' - caller-workflow-name: 'appsignals-e2e-eks-canary-test' diff --git a/.github/workflows/appsignals-e2e-eks-test.yml b/.github/workflows/appsignals-e2e-eks-test.yml index 315632f512..23bb431e91 100644 --- a/.github/workflows/appsignals-e2e-eks-test.yml +++ b/.github/workflows/appsignals-e2e-eks-test.yml @@ -27,7 +27,6 @@ env: # It is not redundant AWS_DEFAULT_REGION: ${{ inputs.aws-region }} TEST_ACCOUNT: ${{ secrets.APP_SIGNALS_E2E_TEST_ACC }} - ENABLEMENT_SCRIPT_S3_BUCKET: ${{ secrets.APP_SIGNALS_E2E_ENABLEMENT_SCRIPT }} SAMPLE_APP_NAMESPACE: sample-app-namespace SAMPLE_APP_FRONTEND_SERVICE_IMAGE: ${{ secrets.APP_SIGNALS_E2E_FE_SA_IMG }} SAMPLE_APP_REMOTE_SERVICE_IMAGE: ${{ secrets.APP_SIGNALS_E2E_RE_SA_IMG }} @@ -38,9 +37,11 @@ jobs: e2e-eks-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Get testing resources from aws-application-signals-test-framework + uses: actions/checkout@v4 with: - fetch-depth: 0 + repository: aws-observability/aws-application-signals-test-framework + ref: main - name: Download enablement script uses: actions/checkout@v4 @@ -60,11 +61,6 @@ jobs: delete_log_group="aws logs delete-log-group --log-group-name '${{ env.LOG_GROUP_NAME }}' --region \$REGION" sed -i "s#$delete_log_group##g" clean-app-signals.sh - - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - name: Generate testing id run: echo TESTING_ID="${{ env.AWS_DEFAULT_REGION }}-${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV @@ -108,109 +104,44 @@ jobs: with: terraform_wrapper: false - - name: Deploy sample app via terraform and wait for the endpoint to come online - id: deploy-sample-app - working-directory: testing/terraform/eks + - name: Deploy sample app via terraform + working-directory: terraform/eks run: | terraform init terraform validate - - # Attempt to deploy the sample app on an EKS 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="test_id=${{ env.TESTING_ID }}" \ - -var="aws_region=${{ env.AWS_DEFAULT_REGION }}" \ - -var="kube_directory_path=${{ github.workspace }}/.kube" \ - -var="eks_cluster_name=${{ inputs.test-cluster-name }}" \ - -var="eks_cluster_context_name=$(kubectl config current-context)" \ - -var="test_namespace=${{ env.SAMPLE_APP_NAMESPACE }}" \ - -var="service_account_aws_access=service-account-${{ env.TESTING_ID }}" \ - -var="sample_app_image=${{ env.SAMPLE_APP_FRONTEND_SERVICE_IMAGE }}" \ - -var="sample_remote_app_image=${{ env.SAMPLE_APP_REMOTE_SERVICE_IMAGE }}" \ - || deployment_failed=$? - - if [ $deployment_failed -eq 1 ]; then - echo "Terraform deployment was unsuccessful. Will attempt to retry deployment." - fi + terraform apply -auto-approve \ + -var="test_id=${{ env.TESTING_ID }}" \ + -var="aws_region=${{ env.AWS_DEFAULT_REGION }}" \ + -var="kube_directory_path=${{ github.workspace }}/.kube" \ + -var="eks_cluster_name=${{ inputs.test-cluster-name }}" \ + -var="eks_cluster_context_name=$(kubectl config current-context)" \ + -var="test_namespace=${{ env.SAMPLE_APP_NAMESPACE }}" \ + -var="service_account_aws_access=service-account-${{ env.TESTING_ID }}" \ + -var="sample_app_image=${{ env.SAMPLE_APP_FRONTEND_SERVICE_IMAGE }}" \ + -var="sample_remote_app_image=${{ env.SAMPLE_APP_REMOTE_SERVICE_IMAGE }}" - # If the deployment_failed is still 0, then the terraform deployment succeeded and now try to connect to the endpoint - # after installing App Signals. Attempts to connect will be made for up to 10 minutes - if [ $deployment_failed -eq 0 ]; then - echo "Installing app signals to the sample app" - ${GITHUB_WORKSPACE}/enablement-script/scripts/eks/appsignals/enable-app-signals.sh \ - ${{ inputs.test-cluster-name }} \ - ${{ env.AWS_DEFAULT_REGION }} \ - ${{ env.SAMPLE_APP_NAMESPACE }} - - # If the workflow provides a specific ADOT image to test, patch the deployment and restart CW agent related pods - if [ ${{ inputs.appsignals-adot-image-name }} != "" ]; then - kubectl patch deploy -namazon-cloudwatch amazon-cloudwatch-observability-controller-manager --type='json' \ - -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args/0", "value": "--auto-instrumentation-java-image=${{ inputs.appsignals-adot-image-name }}"}]' - - kubectl delete pods --all -n amazon-cloudwatch - kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch - fi - - kubectl delete pods --all -n ${{ env.SAMPLE_APP_NAMESPACE }} - kubectl wait --for=condition=Ready pod --all -n ${{ env.SAMPLE_APP_NAMESPACE }} - - echo "Attempting to connect to the endpoint" - sample_app_endpoint=http://$(terraform output sample_app_endpoint) - attempt_counter=0 - max_attempts=60 - until $(curl --output /dev/null --silent --head --fail $(echo "$sample_app_endpoint" | tr -d '"')); do - if [ ${attempt_counter} -eq ${max_attempts} ];then - echo "Failed to connect to endpoint. Will attempt to redeploy sample app." - deployment_failed=1 - break - fi - - printf '.' - attempt_counter=$(($attempt_counter+1)) - sleep 10 - done - fi - - # If the deployment_failed 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 "Cleaning up App Signal" - ./clean-app-signals.sh \ - ${{ inputs.test-cluster-name }} \ - ${{ env.AWS_DEFAULT_REGION }} \ - ${{ env.SAMPLE_APP_NAMESPACE }} - - # Running clean-app-signal.sh removes the current cluster from the config. Update the cluster again for subsequent runs. - aws eks update-kubeconfig --name ${{ inputs.test-cluster-name }} --region ${{ env.AWS_DEFAULT_REGION }} - - echo "Destroying terraform" - terraform destroy -auto-approve \ - -var="test_id=${{ env.TESTING_ID }}" \ - -var="aws_region=${{ env.AWS_DEFAULT_REGION }}" \ - -var="kube_directory_path=${{ github.workspace }}/.kube" \ - -var="eks_cluster_name=${{ inputs.test-cluster-name }}" \ - -var="test_namespace=${{ env.SAMPLE_APP_NAMESPACE }}" \ - -var="service_account_aws_access=service-account-${{ env.TESTING_ID }}" \ - -var="sample_app_image=${{ env.SAMPLE_APP_IMAGE }}" - - 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 + # Enable App Signals on the test cluster + - name: Enable App Signals + working-directory: enablement-script/scripts/eks/appsignals + run: | + ./enable-app-signals.sh \ + ${{ inputs.test-cluster-name }} \ + ${{ env.AWS_DEFAULT_REGION }} \ + ${{ env.SAMPLE_APP_NAMESPACE }} + + - name: Patch the ADOT image and restart CloudWatch pods + run: | + kubectl patch deploy -namazon-cloudwatch amazon-cloudwatch-observability-controller-manager --type='json' \ + -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args/0", "value": "--auto-instrumentation-java-image=${{ inputs.appsignals-adot-image-name }}"}]' + kubectl delete pods --all -n amazon-cloudwatch + kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch + + - name: Restart the app pods + run: kubectl delete pods --all -n ${{ env.SAMPLE_APP_NAMESPACE }} + + - name: Wait for sample app pods to come up + run: | + kubectl wait --for=condition=Ready pod --all -n ${{ env.SAMPLE_APP_NAMESPACE }} - name: Get remote service pod name and IP run: | @@ -227,40 +158,43 @@ jobs: kubectl get pods -n amazon-cloudwatch --output json | \ jq '.items[0].status.containerStatuses[0].imageID' - # cache local patch outputs - - name: Cache local Maven repository - id: cache-local-maven-repo - uses: actions/cache@v3 - with: - path: | - ~/.m2/repository/io/opentelemetry/ - key: ${{ runner.os }}-maven-local-${{ hashFiles('.github/patches/opentelemetry-java*.patch') }} - - - name: Publish patched dependencies to maven local - uses: ./.github/actions/patch-dependencies - if: steps.cache-local-maven-repo.outputs.cache-hit != 'true' - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - gpg_password: ${{ secrets.GPG_PASSPHRASE }} - - name: Get the sample app endpoint run: echo "APP_ENDPOINT=$(terraform output sample_app_endpoint)" >> $GITHUB_ENV - working-directory: testing/terraform/eks + working-directory: terraform/eks + + - name: Wait for app endpoint to come online + id: endpoint-check + run: | + attempt_counter=0 + max_attempts=30 + until $(curl --output /dev/null --silent --head --fail http://${{ env.APP_ENDPOINT }}); do + if [ ${attempt_counter} -eq ${max_attempts} ];then + echo "Max attempts reached" + exit 1 + fi + + printf '.' + attempt_counter=$(($attempt_counter+1)) + sleep 10 + done # This steps increases the speed of the validation by creating the telemetry data in advance - name: Call all test APIs continue-on-error: true run: | - curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/outgoing-http-call/ - curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/aws-sdk-call/ - curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}/ - curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/client-call/ + curl -S -s http://${{ env.APP_ENDPOINT }}/outgoing-http-call/; echo + curl -S -s http://${{ env.APP_ENDPOINT }}/aws-sdk-call/; echo + curl -S -s http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}/; echo + curl -S -s http://${{ env.APP_ENDPOINT }}/client-call/; echo + + - name: Build Gradle + run: ./gradlew # Validation for app signals telemetry data - name: Call endpoint and validate generated EMF logs id: log-validation - if: steps.deploy-sample-app.outcome == 'success' && !cancelled() - run: ./gradlew testing:validator:run --args='-c eks/log-validation.yml + if: steps.endpoint-check.outcome == 'success' && !cancelled() + run: ./gradlew validator:run --args='-c eks/log-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.APP_ENDPOINT }} --region ${{ env.AWS_DEFAULT_REGION }} @@ -276,8 +210,8 @@ jobs: - name: Call endpoints and validate generated metrics id: metric-validation - if: (steps.deploy-sample-app.outcome == 'success' || steps.log-validation.outcome == 'failure') && !cancelled() - run: ./gradlew testing:validator:run --args='-c eks/metric-validation.yml + if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() + run: ./gradlew validator:run --args='-c eks/metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.APP_ENDPOINT }} --region ${{ env.AWS_DEFAULT_REGION }} @@ -294,8 +228,8 @@ jobs: - name: Call endpoints and validate generated traces id: trace-validation - if: (steps.deploy-sample-app.outcome == 'success' || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled() - run: ./gradlew testing:validator:run --args='-c eks/trace-validation.yml + if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled() + run: ./gradlew validator:run --args='-c eks/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.APP_ENDPOINT }} --region ${{ env.AWS_DEFAULT_REGION }} @@ -348,7 +282,7 @@ jobs: - name: Terraform destroy if: always() continue-on-error: true - working-directory: testing/terraform/eks + working-directory: terraform/eks run: | terraform destroy -auto-approve \ -var="test_id=${{ env.TESTING_ID }}" \ @@ -367,4 +301,4 @@ jobs: --name service-account-${{ env.TESTING_ID }} \ --namespace ${{ env.SAMPLE_APP_NAMESPACE }} \ --cluster ${{ inputs.test-cluster-name }} \ - --region ${{ env.AWS_DEFAULT_REGION }} \ No newline at end of file + --region ${{ env.AWS_DEFAULT_REGION }} diff --git a/testing/README.md b/testing/README.md deleted file mode 100644 index d5e94a6ab3..0000000000 --- a/testing/README.md +++ /dev/null @@ -1,111 +0,0 @@ -# How to Test E2E Resource Changes -This guide will give a step by step instruction on how to test changes made to E2E testing resources before pushing a PR. -The guide will include the following: -- Setting up IAM roles and an EKS cluster -- Setting up VPC settings and IAM role for EC2 instances -- Buliding sample app images/files and putting them into ECRs/S3 buckets -- Forking a repository and setting up necessary secrets - - -### 1. Create an IAM Role with OIDC Identity Provider -This step is needed to allow Github Action to have access to resources in the AWS account -#### Create an OIDC Provider -- First step is to create an OIDC Identity Provider to allow Github action access to the AWS account resource. Login to AWS, go to the IAM console and click on the Identity Providers tab. -- Click on Add Provider, choose OpenID Connect and type `https://token.actions.githubusercontent.com` in the Provider URL. Click "Get thumbprint". For Audience, use `sts.amazonaws.com`. Finally, click "Add provider" -#### Create an IAM role -- Next, an IAM role needs to be created using the OIDC Identity Provider. Go to the Roles tab and click Create role. -- Choose Web Identity, and choose `token.actions.githubusercontent.com` as the Identity provider, Audience as `sts.amazonaws.com`, and for Github organizations put your github username down. Click next. -- Add the AdministratorAccess policy. Click next. -- Enter your Role name. Click "Create role". -#### Add Additional Permission -- After the role is created, search the role name in the roles tab, click on the role, and go to the Trust relationships tab. Click on "Edit trust policy". -- In the Statement list, add the following item: -`{ - "Sid": "accessToRole", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam:::root" - }, - "Action": "sts:AssumeRole" - }`. This additional permission is need to allow Github Action to assume roles and have access to the EKS cluster. - -Additional Resource: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services - -### 2. Create EKS Clusters -The E2E EKS test uses an EKS cluster to deploy the sample apps. -#### Setup Environment with the Appropriate Roles and Permissions. -Note: Make sure to replace with the correct value. -- First, login to the testing account -- Assume the e2e test role by running - - `output=$(aws sts assume-role --role-arn arn:aws:iam:::role/ --role-session-name AWSCLI-Session)` - - `export AWS_ACCESS_KEY_ID=$(echo $output | jq -r .Credentials.AccessKeyId)` - - `export AWS_SECRET_ACCESS_KEY=$(echo $output | jq -r .Credentials.SecretAccessKey)` - - `export AWS_SESSION_TOKEN=$(echo $output | jq -r .Credentials.SessionToken)` -- Run `aws sts get-caller-identity` to check if you are in the correct role -#### Create a new Cluster -Note: Make sure to replace with the correct value (e.g. us-east-1) -- Next, create the cluster by running `eksctl create cluster --name e2e-canary-test --region --zones a,b`. This will take around ~10 minutes. -#### Install AWS Load Balancer Controller Add-on -- Finally, install the AWS Load Balancer Controller add-on by running the following commands. Make sure to replace the `` and `` with the correct value. - ``` - eksctl utils associate-iam-oidc-provider --cluster e2e-canary-test --region --approve - curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.7/docs/install/iam_policy.json - aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam_policy.json --region - eksctl create iamserviceaccount --cluster=e2e-canary-test --namespace=kube-system --name=aws-load-balancer-controller --attach-policy-arn=arn:aws:iam:::policy/AWSLoadBalancerControllerIAMPolicy --region --approve - kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.5.4/cert-manager.yaml - curl -Lo v2_4_7_full.yaml https://github.com/kubernetes-sigs/aws-load-balancer-controller/releases/download/v2.4.7/v2_4_7_full.yaml - sed -i.bak -e '561,569d' ./v2_4_7_full.yaml - sed -i.bak -e 's|your-cluster-name|e2e-canary-test|' ./v2_4_7_full.yaml - kubectl apply -f v2_4_7_full.yaml - curl -Lo v2_4_7_ingclass.yaml https://github.com/kubernetes-sigs/aws-load-balancer-controller/releases/download/v2.4.7/v2_4_7_ingclass.yaml - kubectl apply -f v2_4_7_ingclass.yaml``` -#### Create a New Cluster and Install the AWS Load Balancer Controller Add-on for All Regions -Repeat the previous two steps for all 5 regions. (us-east-1, us-east-2, eu-west-1, ap-northeast-1, ap-southeast-2) - -Note: If you do not want to test all 5 regions, you can create one for us-east-1, then on the [appsignals-e2e-eks-canary-test.yml](.github/workflows/appsignals-e2e-eks-canary-test.yml) comment out the other regions on line 24 - -### 3. Setting up Environment for EC2 Tests -#### Create IAM Role for EC2 Instance -- Login to AWS, go to the IAM console and click on the Roles tab. Click Create role. -- Choose AWS service, and choose EC2 as the use case. Click Next. -- Choose AmazonS3ReadOnlyAccess, AWSXrayWriteOnlyAccess, and CloudWatchAgentServerPolicy as the permission. -- Type the role name as `APP_SIGNALS_EC2_TEST_ROLE` and click "Create role". - -#### Setting Up Default VPC -- Go to the VPC console and on the routing table for the default VPC, click Edit routes. (The default VPC should have the `-` name if it hasn't been assigned to another VPC before) -- Click add routes, for destination add `0.0.0.0/0`, for target add Internet Gateway and save changes. -- Go to the Security groups tab, find the security group attached to the default VPC, click Edit inbound rules, choose type: All Traffic, Source: custom, and CIDR block: 0.0.0.0/0. Save rules. - -### 4. Building Sample App to ECR -Create two ECR repositories: one for the sample app main service and another for the sample app remote service. -Follow the instructions [here](./sample-apps/README.md) to build the sample app image and upload it to the ECR - -### 5. Building Sample App to S3 Bucket -Create an S3 Bucket to store the .jar files for the sample app main service and sample app remote service. -Follow the instructions under [here](./sample-apps/README.md) to build the sample app .jar and upload it to the bucket - -### 6. Setting up repository -- Go to https://github.com/aws-observability/aws-otel-java-instrumentation and create a fork -- Go to the forked repo and enable action on the Action tab -- Add the following secrets to the repository - - APP_SIGNALS_E2E_TEST_ACC: `` - - E2E_TEST_ROLE_ARN: `arn:aws:iam:::role/` - - APP_SIGNALS_E2E_FE_SA_IMG: `.dkr.ecr.us-east-1.amazonaws.com/` - - APP_SIGNALS_E2E_RE_SA_IMG: `.dkr.ecr.us-east-1.amazonaws.com/` - - APP_SIGNALS_E2E_FE_SA_JAR: s3:/// - - APP_SIGNALS_E2E_RE_SA_JAR: s3:/// - - -### 7. Running the tests -Go to the Actions tab on the forked repository. - -- To run the EKS test, go to `App Signals Enablement - E2E EKS Canary Testing`, and click `Enable Workflow`, then `Run Workflow`. -- To run the EC2 test, go to `App Signals Enablement - E2E EC2 Canary Testing`, and click `Enable Workflow`, then `Run Workflow`. - -If you don't want the canaries to run every 15 minutes on the forked repository, click the `...` button on the top right and choose `Disable Workflow` - -### E2E Testing Resources -- `./.github/workflows/appsignals-e2e-*`: workflow files for running e2e tests -- `./testing/sample-apps/*`: files for building the sample app -- `./testing/validator/*`: files for validating logs/metrics/traces generated by sample app -- `./testing/terraform/*`: files for launching the sample app to EKS cluster or EC2 instances \ No newline at end of file diff --git a/testing/sample-apps/README.md b/testing/sample-apps/README.md deleted file mode 100644 index 468bcf0912..0000000000 --- a/testing/sample-apps/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Demo Sample App Updating Guide - -## Introduction: - -The demo sample app is used to perform E2E testing on cloudwatch, cloudwatch operator and adot repository. If any changes need to be made on the demo sample app, the following steps should be taken. - -## EKS Use Case: Uploading to ECR -Since the images are shared by three different repositories, care must be taken while updating the images so that none of the three repositories get left behind. -Ensure that none of the repositories are currently using the image about to be updated. If all images are being used, create a new image instead. -To update the image, first push the update to a backup image (or generate a new one), then switch the address on the three repositories to the backup image one by one. Once all three repositories are pointing to -the backup image, push the update to the main image and revert the addresses on the repositories back to the original. Be careful to ensure the image names are appropriately stored in secrets. - -### Setting up the environment: -1. Run `./.github/scripts/patch.sh` in the repository root. You should have a new folder called `opentelemetry-java-instrumentation` -2. Cd to the new folder, then run `gradle publishToMavenLocal` -3. Run `rm -rf opentelemetry-java-instrumentation` to delete the folder. - -### Steps to update image: -1. Login to the testing account -2. Create a new ECR repository if there's no existing one. -2. Login to ECR Repository: `aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin {REPOSITORY}`. -3. Change repository name in the `build.gradle.kts` file under `testing/sample-apps/springboot` or `testing/sample-apps/sprintboot-remote-service` -4. Change the `tasks.named("jib").enabled` value on the `build.gradle.kts` file from false to true -4. Run `gradle jib` under the respective directory. - -## EC2 Use Case: Building the JAR Files -To build the JAR files of the sample application, simply `cd` into each application, e.g. `cd testing/sample-apps/springboot`, and run `gradle build`. -This will create JAR files in the `build/libs/` folder with the format: -- springboot-*-SNAPSHOT-javadoc.jar -- springboot-*-SNAPSHOT-plain.jar -- springboot-*-SNAPSHOT-sources.jar -- springboot-*-SNAPSHOT.jar. - -To update the JAR file in the testing account: -- Login to the testing account -- Only after you're sure of your changes and if they do not break the tests running in other repos, use `aws s3api put-object --bucket --body build/libs/springboot-*-SNAPSHOT.jar --key .jar` - -Note: Replace * with the version number and `.jar` is the desired name of the .jar file once in the s3 bucket. e.g. `sample-app-main-service.jar` diff --git a/testing/sample-apps/springboot-remote-service/build.gradle.kts b/testing/sample-apps/springboot-remote-service/build.gradle.kts deleted file mode 100644 index dbe67c6e50..0000000000 --- a/testing/sample-apps/springboot-remote-service/build.gradle.kts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -plugins { - java - application - id("org.springframework.boot") - id("io.spring.dependency-management") version "1.1.0" - id("com.google.cloud.tools.jib") -} - -group = "com.amazon.sampleapp" -version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_11 -java.targetCompatibility = JavaVersion.VERSION_11 - -dependencies { - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("org.springframework.boot:spring-boot-starter-logging") -} -tasks { - named("jib") { - enabled = false - } -} -jib { - to { - image = ":" - } - container { - mainClass = "com.amazon.sampleapp.RemoteService" - ports = listOf("8080") - } -} - -application { - mainClass.set("com.amazon.sampleapp.RemoteService") -} diff --git a/testing/sample-apps/springboot-remote-service/src/main/java/com/amazon/sampleapp/RemoteService.java b/testing/sample-apps/springboot-remote-service/src/main/java/com/amazon/sampleapp/RemoteService.java deleted file mode 100644 index 01076f2645..0000000000 --- a/testing/sample-apps/springboot-remote-service/src/main/java/com/amazon/sampleapp/RemoteService.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.sampleapp; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class RemoteService { - public static void main(String[] args) { - SpringApplication.run(RemoteService.class, args); - } -} diff --git a/testing/sample-apps/springboot-remote-service/src/main/java/com/amazon/sampleapp/RemoteServiceController.java b/testing/sample-apps/springboot-remote-service/src/main/java/com/amazon/sampleapp/RemoteServiceController.java deleted file mode 100644 index cf71fbe4ce..0000000000 --- a/testing/sample-apps/springboot-remote-service/src/main/java/com/amazon/sampleapp/RemoteServiceController.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.sampleapp; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -@Controller -public class RemoteServiceController { - - @GetMapping("/healthcheck") - @ResponseBody - public String healthcheck() { - return "Remote service healthcheck"; - } -} diff --git a/testing/sample-apps/springboot/build.gradle.kts b/testing/sample-apps/springboot/build.gradle.kts deleted file mode 100644 index eb483f45e8..0000000000 --- a/testing/sample-apps/springboot/build.gradle.kts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -plugins { - java - application - id("org.springframework.boot") - id("io.spring.dependency-management") version "1.1.0" - id("com.google.cloud.tools.jib") -} - -group = "com.amazon.sampleapp" -version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_11 -java.targetCompatibility = JavaVersion.VERSION_11 - -dependencies { - implementation(platform("software.amazon.awssdk:bom:2.20.78")) - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("org.springframework.boot:spring-boot-starter-logging") - implementation("io.opentelemetry:opentelemetry-api") - implementation("software.amazon.awssdk:s3") - implementation("software.amazon.awssdk:sts") -} -tasks { - named("jib") { - enabled = false - } -} -jib { - to { - image = ":" - } - container { - mainClass = "com.amazon.sampleapp.FrontendService" - ports = listOf("8080") - } -} - -application { - mainClass.set("com.amazon.sampleapp.FrontendService") -} diff --git a/testing/sample-apps/springboot/src/main/java/com/amazon/sampleapp/FrontendService.java b/testing/sample-apps/springboot/src/main/java/com/amazon/sampleapp/FrontendService.java deleted file mode 100644 index 7cc24822c4..0000000000 --- a/testing/sample-apps/springboot/src/main/java/com/amazon/sampleapp/FrontendService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.sampleapp; - -import java.net.http.HttpClient; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import software.amazon.awssdk.services.s3.S3Client; - -@SpringBootApplication -public class FrontendService { - - @Bean - public HttpClient httpClient() { - return HttpClient.newHttpClient(); - } - - @Bean - public S3Client s3() { - return S3Client.builder().build(); - } - - public static void main(String[] args) { - SpringApplication.run(FrontendService.class, args); - } -} diff --git a/testing/sample-apps/springboot/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/testing/sample-apps/springboot/src/main/java/com/amazon/sampleapp/FrontendServiceController.java deleted file mode 100644 index 0d0777ccb4..0000000000 --- a/testing/sample-apps/springboot/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.sampleapp; - -import io.opentelemetry.api.trace.Span; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import software.amazon.awssdk.services.s3.S3Client; -import software.amazon.awssdk.services.s3.model.GetBucketLocationRequest; - -@Controller -public class FrontendServiceController { - private static final Logger logger = LoggerFactory.getLogger(FrontendServiceController.class); - private final HttpClient httpClient; - private final S3Client s3; - private AtomicBoolean shouldSendLocalRootClientCall = new AtomicBoolean(false); - - @Bean - private void runLocalRootClientCallRecurringService() { // run the service - ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); - - Runnable runnableTask = - () -> { - if (shouldSendLocalRootClientCall.get()) { - shouldSendLocalRootClientCall.set(false); - HttpRequest request = - HttpRequest.newBuilder() - .uri(URI.create("http://local-root-client-call")) - .GET() - .build(); - try { - HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); - } catch (Exception e) { - } - } - }; - // Run with initial 0.1s delay, every 1 second - executorService.scheduleAtFixedRate(runnableTask, 100, 1000, TimeUnit.MILLISECONDS); - } - - @Autowired - public FrontendServiceController(HttpClient httpClient, S3Client s3) { - this.httpClient = httpClient; - this.s3 = s3; - } - - @GetMapping("/") - @ResponseBody - public String healthcheck() { - return "healthcheck"; - } - - // test aws calls instrumentation - @GetMapping("/aws-sdk-call") - @ResponseBody - public String awssdkCall() { - GetBucketLocationRequest bucketLocationRequest = - GetBucketLocationRequest.builder().bucket("e2e-test-bucket-name").build(); - try { - s3.getBucketLocation(bucketLocationRequest); - } catch (Exception e) { - // e2e-test-bucket-name does not exist, so this is expected. - logger.error("Could not retrieve http request:" + e.getLocalizedMessage()); - } - return getXrayTraceId(); - } - - // test http instrumentation (java client) - @GetMapping("/outgoing-http-call") - @ResponseBody - public String httpCall() { - HttpRequest request = - HttpRequest.newBuilder().uri(URI.create("https://www.amazon.com")).GET().build(); - - try { - HttpResponse response = - httpClient.send(request, HttpResponse.BodyHandlers.ofString()); - int statusCode = response.statusCode(); - - logger.info("outgoing-http-call status code: " + statusCode); - } catch (Exception e) { - logger.error("Could not complete http request:" + e.getMessage()); - } - - return getXrayTraceId(); - } - - // RemoteService must also be deployed to use this API - @GetMapping("/remote-service") - @ResponseBody - public String downstreamService(@RequestParam("ip") String ip) { - // Ensure IP doesn't have extra slashes anywhere - ip = ip.replace("/", ""); - HttpRequest request = - HttpRequest.newBuilder() - .uri(URI.create("http://" + ip + ":8080/healthcheck")) - .GET() - .build(); - - try { - HttpResponse response = - httpClient.send(request, HttpResponse.BodyHandlers.ofString()); - int statusCode = response.statusCode(); - - logger.info("Remote service call status code: " + statusCode); - return getXrayTraceId(); - } catch (Exception e) { - logger.error("Could not complete http request to remote service:" + e.getMessage()); - } - - return getXrayTraceId(); - } - - // Test Local Root Client Span generation - @GetMapping("/client-call") - @ResponseBody - public String asyncService() { - logger.info("Client-call received"); - shouldSendLocalRootClientCall.set(true); - // This API is used to trigger the http://local-root-client-call call on running on the executor - // recurring service, which will generate a local root client span. The E2E testing will attempt - // to validate the span - // generated by the /local-root-client-call, not this /client-call API call. Therefore, the - // traceId of this API call is not needed and we return an invalid traceId to indicate that the - // call was received but to not use this - // traceId. - return "{\"traceId\": \"1-00000000-000000000000000000000000\"}"; - } - - // get x-ray trace id - private String getXrayTraceId() { - String traceId = Span.current().getSpanContext().getTraceId(); - String xrayTraceId = "1-" + traceId.substring(0, 8) + "-" + traceId.substring(8); - - return String.format("{\"traceId\": \"%s\"}", xrayTraceId); - } -} diff --git a/testing/terraform/ec2/amazon-cloudwatch-agent.json b/testing/terraform/ec2/amazon-cloudwatch-agent.json deleted file mode 100644 index 07ea062b7d..0000000000 --- a/testing/terraform/ec2/amazon-cloudwatch-agent.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "agent": { - "debug": true, - "region": "$REGION" - }, - "traces": { - "traces_collected": { - "app_signals": { - "enabled": true - } - } - }, - "logs": { - "metrics_collected": { - "app_signals": { - "enabled": true - } - } - } -} \ No newline at end of file diff --git a/testing/terraform/ec2/main.tf b/testing/terraform/ec2/main.tf deleted file mode 100644 index 55576e8ff2..0000000000 --- a/testing/terraform/ec2/main.tf +++ /dev/null @@ -1,185 +0,0 @@ -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 = ["al20*-ami-minimal-*-x86_64"] - } - filter { - name = "state" - values = ["available"] - } - filter { - name = "architecture" - values = ["x86_64"] - } - filter { - name = "image-type" - values = ["machine"] - } - - filter { - name = "root-device-name" - values = ["/dev/xvda"] - } - - 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 = "t2.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" - } - - 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 = [ - # Install Java 11 and wget - "sudo yum install wget java-11-amazon-corretto -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 - "${var.get_cw_agent_rpm_command}", - "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 - "${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/ec2-user/adot.jar' \\", - "OTEL_METRICS_EXPORTER=none \\", - "OTEL_SMP_ENABLED=true \\", - "OTEL_AWS_SMP_EXPORTER_ENDPOINT=http://localhost:4315 \\", - "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4315 \\", - "OTEL_RESOURCE_ATTRIBUTES=aws.hostedin.environment=EC2,service.name=sample-application-${var.test_id} \\", - "nohup java -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" - ] - } - - 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 = "t2.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" - } - - 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 = [ - # Install Java 11 and wget - "sudo yum install wget java-11-amazon-corretto -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 - "${var.get_cw_agent_rpm_command}", - "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 - "${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/ec2-user/adot.jar' \\", - "OTEL_METRICS_EXPORTER=none \\", - "OTEL_SMP_ENABLED=true \\", - "OTEL_AWS_SMP_EXPORTER_ENDPOINT=http://localhost:4315 \\", - "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4315 \\", - "OTEL_RESOURCE_ATTRIBUTES=aws.hostedin.environment=EC2,service.name=sample-remote-application-${var.test_id} \\", - "nohup java -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" - ] - } - - depends_on = [aws_instance.remote_service_instance] -} diff --git a/testing/terraform/ec2/output.tf b/testing/terraform/ec2/output.tf deleted file mode 100644 index 1447d2c854..0000000000 --- a/testing/terraform/ec2/output.tf +++ /dev/null @@ -1,11 +0,0 @@ -output "sample_app_main_service_public_dns" { - value = aws_instance.main_service_instance.public_dns -} - -output "sample_app_remote_service_public_ip" { - value = aws_instance.remote_service_instance.public_ip -} - -output "ec2_instance_ami" { - value = data.aws_ami.ami.id -} \ No newline at end of file diff --git a/testing/terraform/ec2/variables.tf b/testing/terraform/ec2/variables.tf deleted file mode 100644 index 8d128cf17d..0000000000 --- a/testing/terraform/ec2/variables.tf +++ /dev/null @@ -1,42 +0,0 @@ -# ------------------------------------------------------------------------ -# 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 = "ec2-user" -} - -variable "sample_app_jar" { - default = "s3:///" -} - -variable "sample_remote_app_jar" { - default = "s3:///" -} - -variable "get_cw_agent_rpm_command" { - default = " s3:///" -} - -variable "get_adot_jar_command" { - default = " s3:///" -} \ No newline at end of file diff --git a/testing/terraform/eks/kubeconfig.tpl b/testing/terraform/eks/kubeconfig.tpl deleted file mode 100644 index bbcaa8aed7..0000000000 --- a/testing/terraform/eks/kubeconfig.tpl +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: ${CA_DATA} - server: ${SERVER_ENDPOINT} - name: ${CLUSTER_NAME} -contexts: -- context: - cluster: ${CLUSTER_NAME} - user: terraform_user - name: ${CLUSTER_NAME} -current-context: ${CLUSTER_NAME} -kind: Config -preferences: {} -users: -- name: terraform_user - user: - token: ${TOKEN} \ No newline at end of file diff --git a/testing/terraform/eks/main.tf b/testing/terraform/eks/main.tf deleted file mode 100644 index dcf18c8375..0000000000 --- a/testing/terraform/eks/main.tf +++ /dev/null @@ -1,231 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - } - - kubernetes = { - source = "hashicorp/kubernetes" - version = ">= 2.16.1" - } - - kubectl = { - source = "gavinbunney/kubectl" - version = ">= 1.7.0" - } - } -} - -provider "aws" { - region = var.aws_region -} - -# get eks cluster -data "aws_eks_cluster" "testing_cluster" { - name = var.eks_cluster_name -} -data "aws_eks_cluster_auth" "testing_cluster" { - name = var.eks_cluster_name -} - -# set up kubectl -provider "kubernetes" { - host = data.aws_eks_cluster.testing_cluster.endpoint - cluster_ca_certificate = base64decode(data.aws_eks_cluster.testing_cluster.certificate_authority[0].data) - token = data.aws_eks_cluster_auth.testing_cluster.token -} - -provider "kubectl" { - // Note: copy from eks module. Please avoid use shorted-lived tokens when running locally. - // For more information: https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs#exec-plugins - host = data.aws_eks_cluster.testing_cluster.endpoint - cluster_ca_certificate = base64decode(data.aws_eks_cluster.testing_cluster.certificate_authority[0].data) - token = data.aws_eks_cluster_auth.testing_cluster.token - load_config_file = false -} - -data "template_file" "kubeconfig_file" { - template = file("./kubeconfig.tpl") - vars = { - CLUSTER_NAME : var.eks_cluster_context_name - CA_DATA : data.aws_eks_cluster.testing_cluster.certificate_authority[0].data - SERVER_ENDPOINT : data.aws_eks_cluster.testing_cluster.endpoint - TOKEN = data.aws_eks_cluster_auth.testing_cluster.token - } -} - -resource "local_file" "kubeconfig" { - content = data.template_file.kubeconfig_file.rendered - filename = "${var.kube_directory_path}/config" -} - -### Setting up the sample app on the cluster - -resource "kubernetes_deployment" "sample_app_deployment" { - - metadata { - name = "sample-app-deployment-${var.test_id}" - namespace = var.test_namespace - } - - spec { - replicas = 1 - selector { - match_labels = { - app = "sample-app" - } - } - template { - metadata { - labels = { - app = "sample-app" - } - annotations = { - # these annotations allow for OTel Java instrumentation - "instrumentation.opentelemetry.io/inject-java" = "true" - } - } - spec { - service_account_name = var.service_account_aws_access - container { - name = "back-end" - image = var.sample_app_image - image_pull_policy = "Always" - env { - #inject the test id to service name for unique App Signals metrics - name = "OTEL_SERVICE_NAME" - value = "sample-application-${var.test_id}" - } - port { - container_port = 8080 - } - } - } - } - } -} - -resource "kubernetes_service" "sample_app_service" { - depends_on = [ kubernetes_deployment.sample_app_deployment ] - - metadata { - name = "sample-app-service" - namespace = var.test_namespace - } - spec { - type = "NodePort" - selector = { - app = "sample-app" - } - port { - protocol = "TCP" - port = 8080 - target_port = 8080 - node_port = 30100 - } - } -} - -resource "kubernetes_ingress_v1" "sample-app-ingress" { - depends_on = [kubernetes_service.sample_app_service] - wait_for_load_balancer = true - metadata { - name = "sample-app-ingress-${var.test_id}" - namespace = var.test_namespace - annotations = { - "kubernetes.io/ingress.class" = "alb" - "alb.ingress.kubernetes.io/scheme" = "internet-facing" - "alb.ingress.kubernetes.io/target-type" = "ip" - } - labels = { - app = "sample-app-ingress" - } - } - spec { - rule { - http { - path { - path = "/" - path_type = "Prefix" - backend { - service { - name = kubernetes_service.sample_app_service.metadata[0].name - port { - number = 8080 - } - } - } - } - } - } - } -} - -# Set up the remote service - -resource "kubernetes_deployment" "sample_remote_app_deployment" { - - metadata { - name = "sample-r-app-deployment-${var.test_id}" - namespace = var.test_namespace - labels = { - app = "remote-app" - } - } - - spec { - replicas = 1 - selector { - match_labels = { - app = "remote-app" - } - } - template { - metadata { - labels = { - app = "remote-app" - } - annotations = { - # these annotations allow for OTel Java instrumentation - "instrumentation.opentelemetry.io/inject-java" = "true" - } - } - spec { - service_account_name = var.service_account_aws_access - container { - name = "back-end" - image = var.sample_remote_app_image - image_pull_policy = "Always" - port { - container_port = 8080 - } - } - } - } - } -} - -resource "kubernetes_service" "sample_remote_app_service" { - depends_on = [ kubernetes_deployment.sample_remote_app_deployment ] - - metadata { - name = "sample-remote-app-service" - namespace = var.test_namespace - } - spec { - type = "NodePort" - selector = { - app = "remote-app" - } - port { - protocol = "TCP" - port = 8080 - target_port = 8080 - node_port = 30101 - } - } -} - -output "sample_app_endpoint" { - value = kubernetes_ingress_v1.sample-app-ingress.status.0.load_balancer.0.ingress.0.hostname -} diff --git a/testing/terraform/eks/variables.tf b/testing/terraform/eks/variables.tf deleted file mode 100644 index b54f093a6c..0000000000 --- a/testing/terraform/eks/variables.tf +++ /dev/null @@ -1,50 +0,0 @@ -# ------------------------------------------------------------------------ -# 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 "kube_directory_path" { - default = "./.kube" -} - -variable "aws_region" { - default = "" -} - -variable "eks_cluster_name" { - default = "" -} - -variable "eks_cluster_context_name" { - default = "." -} - -variable "test_namespace" { - default = "sample-app-namespace" -} - -variable "service_account_aws_access" { - default = "sample-app-service-account" -} - -variable "sample_app_image" { - default = ":" -} - -variable "sample_remote_app_image" { - default = ":" -} \ No newline at end of file diff --git a/testing/validator/README.md b/testing/validator/README.md deleted file mode 100644 index 443dc6c959..0000000000 --- a/testing/validator/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Validator -This validator is a version of the ADOT test framework validator fitted to the needs of the app signals E2E tests. -It validates the metrics and traces that come out of the application after app signals has been enabled. - -## Run -### Run as a command - -Run the following command in the root directory of the repository to run the app signals metric and trace validations - -```shell -./gradlew :testing:validator:run --args='-c validation.yml --endpoint --region --account-id --metric-namespace --rollup' -``` - -Help - -```shell -./gradlew :testing:validator:run --args='-h' -``` - -## Add a validation suite - -1. add a config file under `resources/validations` -2. add an expected data under `resources/expected-data-template` \ No newline at end of file diff --git a/testing/validator/build.gradle.kts b/testing/validator/build.gradle.kts deleted file mode 100644 index 050b40c5c3..0000000000 --- a/testing/validator/build.gradle.kts +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -plugins { - id("java") - - id("application") - - // lombok - id("io.freefair.lombok") version "8.1.0" -} - -repositories { - mavenCentral() - mavenLocal() - - maven( - "https://jitpack.io", - ) - maven { - setUrl("https://oss.sonatype.org/content/repositories/snapshots") - } -} - -dependencies { - // junit - testImplementation("org.junit.jupiter:junit-jupiter-api") - - // log - implementation(group = "org.apache.logging.log4j", name = "log4j-api", version = "2.20.0") - implementation(group = "org.apache.logging.log4j", name = "log4j-core", version = "2.22.1") - - // mustache template - implementation(group = "com.github.spullara.mustache.java", name = "compiler", version = "0.9.10") - - // apache io utils - implementation(group = "commons-io", name = "commons-io", version = "2.12.0") - - // yaml reader - implementation(group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version = "2.15.1") - - // json flattener - implementation(group = "com.github.wnameless", name = "json-flattener", version = "0.7.1") - implementation(group = "com.github.fge", name = "json-schema-validator", version = "2.0.0") - - // command cli - implementation("info.picocli:picocli:4.7.3") - - compileOnly("info.picocli:picocli-codegen:4.7.3") - - // aws sdk - implementation(platform("com.amazonaws:aws-java-sdk-bom:1.12.506")) - implementation("com.amazonaws:aws-java-sdk-s3") - implementation("com.amazonaws:aws-java-sdk-cloudwatch") - implementation("com.amazonaws:aws-java-sdk-xray") - implementation("com.amazonaws:aws-java-sdk-logs") - implementation("com.amazonaws:aws-java-sdk-sts") - - // aws ecs sdk - implementation("com.amazonaws:aws-java-sdk-ecs") - - // https://mvnrepository.com/artifact/com.github.awslabs/aws-request-signing-apache-interceptor - implementation("com.github.awslabs:aws-request-signing-apache-interceptor:b3772780da") - - // http client - implementation("com.squareup.okhttp3:okhttp:4.9.3") - - // command cli - implementation("info.picocli:picocli:4.7.3") - - compileOnly("info.picocli:picocli-codegen:4.7.3") - - // mockito - testImplementation("org.mockito:mockito-core:5.3.1") -} - -application { - // Define the main class for the application. - mainClass.set("com.amazon.aoc.App") -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/App.java b/testing/validator/src/main/java/com/amazon/aoc/App.java deleted file mode 100644 index 423c74d12b..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/App.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc; - -import com.amazon.aoc.helpers.ConfigLoadHelper; -import com.amazon.aoc.models.*; -import com.amazon.aoc.services.CloudWatchService; -import com.amazon.aoc.validators.ValidatorFactory; -import com.amazonaws.services.cloudwatch.model.Dimension; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.time.Duration; -import java.time.Instant; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; -import lombok.extern.log4j.Log4j2; -import picocli.CommandLine; - -@CommandLine.Command(name = "e2etest", mixinStandardHelpOptions = true, version = "1.0") -@Log4j2 -public class App implements Callable { - - @CommandLine.Option(names = {"-c", "--config-path"}) - private String configPath; - - @CommandLine.Option( - names = {"-t", "--testing-id"}, - defaultValue = "dummy-id") - private String testingId; - - @CommandLine.Option(names = {"--account-id"}) - private String accountId; - - @CommandLine.Option(names = {"--language"}) - private String language; - - @CommandLine.Option( - names = {"--metric-namespace"}, - defaultValue = "AWSObservability/CloudWatchOTService") - private String metricNamespace; - - @CommandLine.Option( - names = {"--app-namespace"}, - defaultValue = "demo") - private String appNamespace; - - @CommandLine.Option( - names = {"--platform-info"}, - defaultValue = "demo-cluster") - private String platformInfo; - - @CommandLine.Option( - names = {"--service-name"}, - defaultValue = "demo-deployment") - private String serviceName; - - @CommandLine.Option(names = {"--remote-service-name"}) - private String remoteServiceName; - - @CommandLine.Option(names = {"--remote-service-deployment-name"}) - private String remoteServiceDeploymentName; - - @CommandLine.Option(names = {"--endpoint"}) - private String endpoint; - - @CommandLine.Option(names = {"--request-body"}) - private String requestBody; - - @CommandLine.Option( - names = {"--log-group"}, - defaultValue = "/aws/appsignals/eks") - private String logGroup; - - @CommandLine.Option( - names = {"--region"}, - defaultValue = "us-west-2") - private String region; - - @CommandLine.Option(names = {"--availability-zone"}) - private String availabilityZone; - - @CommandLine.Option(names = {"--ecs-context"}) - private String ecsContext; - - @CommandLine.Option(names = {"--ec2-context"}) - private String ec2Context; - - @CommandLine.Option(names = {"--cloudwatch-context"}) - private String cloudWatchContext; - - @CommandLine.Option( - names = {"--alarm-names"}, - description = "the cloudwatch alarm names") - private List alarmNameList; - - @CommandLine.Option( - names = {"--mocked-server-validating-url"}, - description = "mocked server validating url") - private String mockedServerValidatingUrl; - - @CommandLine.Option( - names = {"--canary"}, - defaultValue = "false") - private boolean isCanary; - - @CommandLine.Option( - names = {"--testcase"}, - defaultValue = "otlp_mock") - private String testcase; - - @CommandLine.Option( - names = {"--cortex-instance-endpoint"}, - description = "cortex instance validating url") - private String cortexInstanceEndpoint; - - @CommandLine.Option( - names = {"--rollup"}, - defaultValue = "true") - private boolean isRollup; - - @CommandLine.Option( - names = {"--instance-ami"}, - defaultValue = "") - private String instanceAmi; - - private static final String TEST_CASE_DIM_KEY = "testcase"; - private static final String CANARY_NAMESPACE = "Otel/Canary"; - private static final String CANARY_METRIC_NAME = "Success"; - - public static void main(String[] args) throws Exception { - int exitCode = new CommandLine(new App()).execute(args); - System.exit(exitCode); - } - - @Override - public Integer call() throws Exception { - final Instant startTime = Instant.now(); - // build context - Context context = new Context(this.testingId, this.region, this.isCanary, this.isRollup); - context.setAccountId(this.accountId); - context.setAvailabilityZone(this.availabilityZone); - context.setMetricNamespace(this.metricNamespace); - context.setAppNamespace(this.appNamespace); - context.setPlatformInfo(this.platformInfo); - context.setServiceName(this.serviceName); - context.setRemoteServiceName(this.remoteServiceName); - context.setRemoteServiceDeploymentName(this.remoteServiceDeploymentName); - context.setEndpoint(this.endpoint); - context.setRequestBody(this.requestBody); - context.setLogGroup(this.logGroup); - context.setEcsContext(buildJsonContext(ecsContext, ECSContext.class)); - context.setEc2Context(buildJsonContext(ec2Context, EC2Context.class)); - context.setCloudWatchContext(buildJsonContext(cloudWatchContext, CloudWatchContext.class)); - context.setAlarmNameList(alarmNameList); - context.setMockedServerValidatingUrl(mockedServerValidatingUrl); - context.setCortexInstanceEndpoint(this.cortexInstanceEndpoint); - context.setTestcase(testcase); - context.setLanguage(language); - context.setInstanceAmi(this.instanceAmi); - - log.info(context); - - // load config - List validationConfigList = - new ConfigLoadHelper().loadConfigFromFile(configPath); - - // run validation - validate(context, validationConfigList); - - Instant endTime = Instant.now(); - Duration duration = Duration.between(startTime, endTime); - log.info("Validation has completed in {} minutes.", duration.toMinutes()); - return null; - } - - private void validate(Context context, List validationConfigList) - throws Exception { - CloudWatchService cloudWatchService = new CloudWatchService(region); - Dimension dimension = new Dimension().withName(TEST_CASE_DIM_KEY).withValue(this.testcase); - int maxValidationCycles = 1; - ValidatorFactory validatorFactory = new ValidatorFactory(context); - if (this.isCanary) { - maxValidationCycles = 20; - } - for (int cycle = 0; cycle < maxValidationCycles; cycle++) { - for (ValidationConfig validationConfigItem : validationConfigList) { - try { - validatorFactory.launchValidator(validationConfigItem).validate(); - } catch (Exception e) { - if (this.isCanary) { - // emit metric - cloudWatchService.putMetricData(CANARY_NAMESPACE, CANARY_METRIC_NAME, 0.0, dimension); - } - throw e; - } - } - if (maxValidationCycles - cycle - 1 > 0) { - log.info( - "Completed {} validation cycle for current canary test. " - + "Still need to validate {} cycles. Sleep 1 minute then proceed.", - cycle + 1, - maxValidationCycles - cycle - 1); - TimeUnit.MINUTES.sleep(1); - } - } - if (this.isCanary) { - // emit metric - cloudWatchService.putMetricData(CANARY_NAMESPACE, CANARY_METRIC_NAME, 1.0, dimension); - } - } - - private ECSContext buildECSContext(Map ecsContextMap) { - if (ecsContextMap == null) { - return null; - } - return new ObjectMapper().convertValue(ecsContextMap, ECSContext.class); - } - - private T buildJsonContext(String metricContext, Class clazz) - throws JsonProcessingException { - if (metricContext == null || metricContext.isEmpty()) { - return null; - } - return new ObjectMapper().readValue(metricContext, clazz); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/callers/HttpCaller.java b/testing/validator/src/main/java/com/amazon/aoc/callers/HttpCaller.java deleted file mode 100644 index eda96cefec..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/callers/HttpCaller.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.callers; - -import com.amazon.aoc.enums.GenericConstants; -import com.amazon.aoc.exception.BaseException; -import com.amazon.aoc.exception.ExceptionCode; -import com.amazon.aoc.helpers.RetryHelper; -import com.amazon.aoc.models.SampleAppResponse; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.util.concurrent.atomic.AtomicReference; -import lombok.extern.log4j.Log4j2; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; - -@Log4j2 -public class HttpCaller implements ICaller { - private String url; - private String path; - private String requestBody; - - /** - * construct httpCaller. - * - * @param endpoint the endpoint to call, for example "http://127.0.0.1:8080" - * @param path the path to call, for example "/test" - */ - public HttpCaller(String endpoint, String path) { - this.path = path; - this.url = endpoint + path; - log.info("validator is trying to hit this {} endpoint", this.url); - } - - /** - * construct httpCaller. - * - * @param endpoint the endpoint to call, for example "http://127.0.0.1:8080" - * @param path the path to call, for example "/test" - * @param requestBody the request body, for example "key=value" - */ - public HttpCaller(String endpoint, String path, String requestBody) { - this.path = path; - this.url = endpoint + path + "?" + requestBody + "/"; - log.info("validator is trying to hit this {} endpoint", this.url); - } - - @Override - public SampleAppResponse callSampleApp() throws Exception { - OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder().url(url).build(); - - AtomicReference sampleAppResponseAtomicReference = new AtomicReference<>(); - RetryHelper.retry( - 40, - () -> { - try (Response response = client.newCall(request).execute()) { - String responseBody = response.body().string(); - log.info("response from sample app {}", responseBody); - if (!response.isSuccessful()) { - throw new BaseException(ExceptionCode.DATA_EMITTER_UNAVAILABLE); - } - SampleAppResponse sampleAppResponse = null; - try { - sampleAppResponse = - new ObjectMapper().readValue(responseBody, SampleAppResponse.class); - } catch (JsonProcessingException ex) { - // try to get the trace id from header - // this is a specific logic for xray sdk, which injects trace id in header - log.info("getting trace id from header"); - // X-Amzn-Trace-Id: Root=1-5f84a611-f2f5df6827016222af9d8b60 - String traceId = - response.header(GenericConstants.HTTP_HEADER_TRACE_ID.getVal()).substring(5); - sampleAppResponse = new SampleAppResponse(); - sampleAppResponse.setTraceId(traceId); - } - sampleAppResponseAtomicReference.set(sampleAppResponse); - } - }); - - return sampleAppResponseAtomicReference.get(); - } - - @Override - public String getCallingPath() { - return path; - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/callers/ICaller.java b/testing/validator/src/main/java/com/amazon/aoc/callers/ICaller.java deleted file mode 100644 index dc848669b6..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/callers/ICaller.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.callers; - -import com.amazon.aoc.models.SampleAppResponse; - -public interface ICaller { - SampleAppResponse callSampleApp() throws Exception; - - String getCallingPath(); -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/enums/GenericConstants.java b/testing/validator/src/main/java/com/amazon/aoc/enums/GenericConstants.java deleted file mode 100644 index d5f1b2a525..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/enums/GenericConstants.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.enums; - -import lombok.Getter; - -@Getter -public enum GenericConstants { - // retry - SLEEP_IN_MILLISECONDS("10000"), // ms - SLEEP_IN_SECONDS("30"), - MAX_RETRIES("10"), - - // validator env vars - ENV_VAR_AGENT_VERSION("AGENT_VERSION"), - ENV_VAR_TESTING_ID("TESTING_ID"), - ENV_VAR_EXPECTED_METRIC("EXPECTED_METRIC"), - ENV_VAR_EXPECTED_TRACE("EXPECTED_TRACE"), - ENV_VAR_REGION("REGION"), - ENV_VAR_NAMESPACE("NAMESPACE"), - ENV_VAR_DATA_EMITTER_ENDPOINT("DATA_EMITTER_ENDPOINT"), - - // XRay sdk related - HTTP_HEADER_TRACE_ID("X-Amzn-Trace-Id"), - ; - - private String val; - - GenericConstants(String val) { - this.val = val; - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/exception/BaseException.java b/testing/validator/src/main/java/com/amazon/aoc/exception/BaseException.java deleted file mode 100644 index 9bc87ae5db..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/exception/BaseException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.exception; - -import lombok.Getter; - -@Getter -public class BaseException extends Exception { - private int code; - private String message; - - public BaseException(ExceptionCode exceptionCode) { - this.code = exceptionCode.getCode(); - this.message = exceptionCode.getMessage(); - } - - public BaseException(ExceptionCode exceptionCode, String message) { - this.code = exceptionCode.getCode(); - this.message = message; - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/exception/ExceptionCode.java b/testing/validator/src/main/java/com/amazon/aoc/exception/ExceptionCode.java deleted file mode 100644 index fc439dcd3b..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/exception/ExceptionCode.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.exception; - -public enum ExceptionCode { - S3_KEY_ALREADY_EXIST(20001, "s3 key is existed already"), - FAILED_AFTER_RETRY(20004, "failed after retry"), - S3_BUCKET_IS_EXISTED_IN_CURRENT_ACCOUNT(20013, "s3 bucket is already existed in your account"), - S3_BUCKET_IS_EXISTED_GLOBALLY(20014, "s3 bucket is already existed globally"), - - EXPECTED_METRIC_NOT_FOUND(30001, "expected metric not found"), - EXPECTED_LOG_NOT_FOUND(30002, "expected log not found"), - - // validating errors - TRACE_ID_NOT_MATCHED(50001, "trace id not matched"), - DATA_MODEL_NOT_MATCHED(50006, "data model not matched"), - TRACE_SPAN_LIST_NOT_MATCHED(50002, "trace span list has different length"), - TRACE_SPAN_NOT_MATCHED(50003, "trace span not matched"), - TRACE_LIST_NOT_MATCHED(50004, "trace list has different length"), - DATA_EMITTER_UNAVAILABLE(50005, "the data emitter is unavailable to ping"), - EMPTY_LIST(50007, "list is empty or null"), - LOG_FORMAT_NOT_MATCHED(50008, "log format not matched"), - HEALTH_STATUS_NOT_MATCHED(50009, "health_check status not matched"), - - // build validator - VALIDATION_TYPE_NOT_EXISTED(60001, "validation type not existed"), - CALLER_TYPE_NOT_EXISTED(60002, "caller type not existed"), - - // alarm validation - ALARM_BAKING(70001, "alarms still need to be baked"), - - // mocked server - MOCKED_SERVER_NOT_AVAILABLE(80001, "mocked server is not available"), - MOCKED_SERVER_NOT_RECEIVE_DATA(80002, "mocked server not receive data"), - - // clients failed - CORTEX_CLIENT_REQUEST_FAILED(90001, "request to pull mode sample app failed"), - PULL_MODE_SAMPLE_APP_CLIENT_REQUEST_FAILED(90001, "request to pull mode sample app failed"), - - // ecs resource - ECS_RESOURCES_NOT_FOUND(100001, "awaiting on ECS resources to be ready"), - ; - private int code; - private String message; - - ExceptionCode(int code, String message) { - this.code = code; - this.message = message; - } - - public int getCode() { - return code; - } - - public String getMessage() { - return message; - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/fileconfigs/FileConfig.java b/testing/validator/src/main/java/com/amazon/aoc/fileconfigs/FileConfig.java deleted file mode 100644 index 879698e7b4..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/fileconfigs/FileConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.fileconfigs; - -import java.io.IOException; -import java.net.URL; - -/** - * Any file based config will need to implement this interface, so that the mustacheHelper could - * render it. - */ -public interface FileConfig { - /** - * get the mustache file path. - * - * @return file path - */ - URL getPath() throws IOException; -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/fileconfigs/LocalPathExpectedTemplate.java b/testing/validator/src/main/java/com/amazon/aoc/fileconfigs/LocalPathExpectedTemplate.java deleted file mode 100644 index 599a957aba..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/fileconfigs/LocalPathExpectedTemplate.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.fileconfigs; - -import java.io.IOException; -import java.net.URL; - -/** - * LocalPathExpectedTemplate represents the template which comes from outside of testing framework - * but at the same file system with terraform runtime. todo, we can probably support remote - * templates which come from s3. - */ -public class LocalPathExpectedTemplate implements FileConfig { - public LocalPathExpectedTemplate(String path) { - this.path = path; - } - - private String path; - - @Override - public URL getPath() throws IOException { - return new URL(path); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/testing/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java deleted file mode 100644 index b22e6aab7d..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.fileconfigs; - -import java.net.URL; - -/** - * PredefinedExpectedTemplate includes all the built-in expected data templates, which are under - * resources/expected-data-templates. - */ -public enum PredefinedExpectedTemplate implements FileConfig { - /** EKS Test Case Validations */ - EKS_OUTGOING_HTTP_CALL_LOG("/expected-data-template/eks/outgoing-http-call-log.mustache"), - EKS_OUTGOING_HTTP_CALL_METRIC("/expected-data-template/eks/outgoing-http-call-metric.mustache"), - EKS_OUTGOING_HTTP_CALL_TRACE("/expected-data-template/eks/outgoing-http-call-trace.mustache"), - - EKS_AWS_SDK_CALL_LOG("/expected-data-template/eks/aws-sdk-call-log.mustache"), - EKS_AWS_SDK_CALL_METRIC("/expected-data-template/eks/aws-sdk-call-metric.mustache"), - EKS_AWS_SDK_CALL_TRACE("/expected-data-template/eks/aws-sdk-call-trace.mustache"), - - EKS_REMOTE_SERVICE_LOG("/expected-data-template/eks/remote-service-log.mustache"), - EKS_REMOTE_SERVICE_METRIC("/expected-data-template/eks/remote-service-metric.mustache"), - EKS_REMOTE_SERVICE_TRACE("/expected-data-template/eks/remote-service-trace.mustache"), - - EKS_CLIENT_CALL_LOG("/expected-data-template/eks/client-call-log.mustache"), - EKS_CLIENT_CALL_METRIC("/expected-data-template/eks/client-call-metric.mustache"), - EKS_CLIENT_CALL_TRACE("/expected-data-template/eks/client-call-trace.mustache"), - - /** EC2 Test Case Validations */ - EC2_OUTGOING_HTTP_CALL_LOG("/expected-data-template/ec2/outgoing-http-call-log.mustache"), - EC2_OUTGOING_HTTP_CALL_METRIC("/expected-data-template/ec2/outgoing-http-call-metric.mustache"), - EC2_OUTGOING_HTTP_CALL_TRACE("/expected-data-template/ec2/outgoing-http-call-trace.mustache"), - - EC2_AWS_SDK_CALL_LOG("/expected-data-template/ec2/aws-sdk-call-log.mustache"), - EC2_AWS_SDK_CALL_METRIC("/expected-data-template/ec2/aws-sdk-call-metric.mustache"), - EC2_AWS_SDK_CALL_TRACE("/expected-data-template/ec2/aws-sdk-call-trace.mustache"), - - EC2_REMOTE_SERVICE_LOG("/expected-data-template/ec2/remote-service-log.mustache"), - EC2_REMOTE_SERVICE_METRIC("/expected-data-template/ec2/remote-service-metric.mustache"), - EC2_REMOTE_SERVICE_TRACE("/expected-data-template/ec2/remote-service-trace.mustache"), - - EC2_CLIENT_CALL_LOG("/expected-data-template/ec2/client-call-log.mustache"), - EC2_CLIENT_CALL_METRIC("/expected-data-template/ec2/client-call-metric.mustache"), - EC2_CLIENT_CALL_TRACE("/expected-data-template/ec2/client-call-trace.mustache"), - ; - - private String path; - - PredefinedExpectedTemplate(String path) { - this.path = path; - } - - @Override - public URL getPath() { - return getClass().getResource(path); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/helpers/CWMetricHelper.java b/testing/validator/src/main/java/com/amazon/aoc/helpers/CWMetricHelper.java deleted file mode 100644 index c3c7cff804..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/helpers/CWMetricHelper.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.helpers; - -import com.amazon.aoc.callers.ICaller; -import com.amazon.aoc.fileconfigs.FileConfig; -import com.amazon.aoc.models.Context; -import com.amazonaws.services.cloudwatch.model.Dimension; -import com.amazonaws.services.cloudwatch.model.Metric; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** helper class for getting expected metrics from templates. */ -public class CWMetricHelper { - private static final String DEFAULT_DIMENSION_NAME = "OTelLib"; - MustacheHelper mustacheHelper = new MustacheHelper(); - - /** - * get expected metrics from template with injecting context. - * - * @param context testing context - * @param expectedMetric expected template - * @param caller http caller, none caller, could be null - * @return list of metrics - * @throws Exception when caller throws exception or template can not be found - */ - public List listExpectedMetrics( - Context context, FileConfig expectedMetric, ICaller caller) throws Exception { - // call endpoint - if (caller != null) { - caller.callSampleApp(); - } - - // get expected metrics as yaml from config - String yamlExpectedMetrics = mustacheHelper.render(expectedMetric, context); - - // load metrics from yaml - ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); - List expectedMetricList = - mapper.readValue( - yamlExpectedMetrics.getBytes(StandardCharsets.UTF_8), - new TypeReference>() {}); - - if (context.getIsRollup()) { - return this.rollupMetric(expectedMetricList); - } - - return expectedMetricList; - } - - /** - * rollup the metrics 1. all dimension rollup 2. zero dimension rollup 3. single dimension rollup - * Ex. A metric A with dimensions OtelLib, Dimension_1, Dimension_2 will be rolled up to four - * metrics: 1. All dimension rollup: A [OtelLib, Dimension_1, Dimension_2]. 2. Zero dimension - * rollup: A [OtelLib]. 3. Single dimension rollup: A [OtelLib, Dimension_1], A [OtelLib, - * Dimension_2] - * - * @param metricList after rolled up - * @return list of rolled up metrics - */ - private List rollupMetric(List metricList) { - List rollupMetricList = new ArrayList<>(); - for (Metric metric : metricList) { - Dimension otellibDimension = new Dimension(); - boolean otelLibDimensionExisted = false; - - if (metric.getDimensions().size() > 0) { - // get otellib dimension out - // assuming the first dimension is otellib, if not the validation fails - otellibDimension = metric.getDimensions().get(0); - otelLibDimensionExisted = otellibDimension.getName().equals(DEFAULT_DIMENSION_NAME); - } - - if (otelLibDimensionExisted) { - metric.getDimensions().remove(0); - } - - // all dimension rollup - Metric allDimensionsMetric = new Metric(); - allDimensionsMetric.setMetricName(metric.getMetricName()); - allDimensionsMetric.setNamespace(metric.getNamespace()); - allDimensionsMetric.setDimensions(metric.getDimensions()); - - if (otelLibDimensionExisted) { - allDimensionsMetric - .getDimensions() - .add( - new Dimension() - .withName(otellibDimension.getName()) - .withValue(otellibDimension.getValue())); - } - rollupMetricList.add(allDimensionsMetric); - - // zero dimension rollup - Metric zeroDimensionMetric = new Metric(); - zeroDimensionMetric.setNamespace(metric.getNamespace()); - zeroDimensionMetric.setMetricName(metric.getMetricName()); - - if (otelLibDimensionExisted) { - zeroDimensionMetric.setDimensions( - Arrays.asList( - new Dimension() - .withName(otellibDimension.getName()) - .withValue(otellibDimension.getValue()))); - } - rollupMetricList.add(zeroDimensionMetric); - - // single dimension rollup - for (Dimension dimension : metric.getDimensions()) { - Metric singleDimensionMetric = new Metric(); - singleDimensionMetric.setNamespace(metric.getNamespace()); - singleDimensionMetric.setMetricName(metric.getMetricName()); - if (otelLibDimensionExisted) { - singleDimensionMetric.setDimensions( - Arrays.asList( - new Dimension() - .withName(otellibDimension.getName()) - .withValue(otellibDimension.getValue()))); - } - singleDimensionMetric.getDimensions().add(dimension); - rollupMetricList.add(singleDimensionMetric); - } - } - - return rollupMetricList; - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/helpers/ConfigLoadHelper.java b/testing/validator/src/main/java/com/amazon/aoc/helpers/ConfigLoadHelper.java deleted file mode 100644 index 3202dc7b37..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/helpers/ConfigLoadHelper.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.helpers; - -import com.amazon.aoc.models.ValidationConfig; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import java.io.IOException; -import java.net.URL; -import java.util.List; -import lombok.extern.log4j.Log4j2; -import org.apache.commons.io.IOUtils; - -@Log4j2 -public class ConfigLoadHelper { - /** - * load validation config from file, the base path is the resource path. - * - * @param filePath the relative path under /resources/validations/ - * @return a list of validationconfig object - * @throws IOException when the filepath is not existed - */ - public List loadConfigFromFile(String filePath) throws IOException { - // todo support filepath which is not in the resource folder - - ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); - List validationConfigList = - mapper.readValue( - IOUtils.toString(getResourcePath(filePath)), - new TypeReference>() {}); - return validationConfigList; - } - - private URL getResourcePath(String filePath) { - return getClass().getResource("/validations/" + filePath); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/helpers/MustacheHelper.java b/testing/validator/src/main/java/com/amazon/aoc/helpers/MustacheHelper.java deleted file mode 100644 index ec8389b364..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/helpers/MustacheHelper.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.helpers; - -import com.amazon.aoc.fileconfigs.FileConfig; -import com.github.mustachejava.DefaultMustacheFactory; -import com.github.mustachejava.Mustache; -import com.github.mustachejava.MustacheFactory; -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.net.URL; -import lombok.extern.log4j.Log4j2; -import org.apache.commons.io.IOUtils; - -@Log4j2 -public class MustacheHelper { - private MustacheFactory mustacheFactory = new DefaultMustacheFactory(); - - /** - * Render the template file with injecting the data. - * - * @param fileConfig any object implementing the FileConfig interface - * @param dataToInject the object to inject to the template - * @return generated content - * @throws IOException when the template file is not existed - */ - public String render(FileConfig fileConfig, Object dataToInject) throws IOException { - return render(fileConfig.getPath(), dataToInject); - } - - private String render(URL path, Object dataToInject) throws IOException { - log.info("fetch config: {}", path); - String templateContent = IOUtils.toString(path); - Mustache mustache = mustacheFactory.compile(new StringReader(templateContent), path.getPath()); - StringWriter stringWriter = new StringWriter(); - mustache.execute(stringWriter, dataToInject).flush(); - return stringWriter.getBuffer().toString(); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/helpers/RetryHelper.java b/testing/validator/src/main/java/com/amazon/aoc/helpers/RetryHelper.java deleted file mode 100644 index 27bcd257b9..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/helpers/RetryHelper.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.helpers; - -import com.amazon.aoc.enums.GenericConstants; -import java.util.concurrent.TimeUnit; -import lombok.extern.log4j.Log4j2; - -@Log4j2 -public class RetryHelper { - /** - * retry executes the lambda, retry if the lambda throw exceptions. - * - * @param retryCount the total retry count - * @param sleepInMilliSeconds sleep time among retries - * @param retryable the lambda - * @return false if retryCount exhausted - * @throws Exception when the retry count is reached - */ - public static boolean retry( - int retryCount, int sleepInMilliSeconds, boolean throwExceptionInTheEnd, Retryable retryable) - throws Exception { - Exception exceptionInTheEnd = null; - int initialCount = retryCount; - while (retryCount-- > 0) { - try { - log.info("retry attempt left : {} ", retryCount); - retryable.execute(); - return true; - } catch (Exception ex) { - exceptionInTheEnd = ex; - if (retryCount != 0) { // don't sleep before leave this loop - log.info( - "retrying after {} seconds", TimeUnit.MILLISECONDS.toSeconds(sleepInMilliSeconds)); - TimeUnit.MILLISECONDS.sleep(sleepInMilliSeconds); - } - } - } - - log.error("All {} retries exhausted", initialCount); - if (throwExceptionInTheEnd) { - throw exceptionInTheEnd; - } - return false; - } - - /** - * retry executes lambda with default retry count(10) and sleep seconds(10). - * - * @param retryable the lambda - * @throws Exception when the retry count is reached - */ - public static void retry(Retryable retryable) throws Exception { - retry( - Integer.valueOf(GenericConstants.MAX_RETRIES.getVal()), - Integer.valueOf(GenericConstants.SLEEP_IN_MILLISECONDS.getVal()), - true, - retryable); - } - - /** - * retry executes lambda with default sleeping seconds 10s. - * - * @param retryCount the total retry count - * @param retryable the lambda function to be executed - * @throws Exception when the retry count is reached - */ - public static void retry(int retryCount, Retryable retryable) throws Exception { - retry( - retryCount, - Integer.valueOf(GenericConstants.SLEEP_IN_MILLISECONDS.getVal()), - true, - retryable); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/helpers/Retryable.java b/testing/validator/src/main/java/com/amazon/aoc/helpers/Retryable.java deleted file mode 100644 index 5beda303a9..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/helpers/Retryable.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.helpers; - -public interface Retryable { - void execute() throws Exception; -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/helpers/SortUtils.java b/testing/validator/src/main/java/com/amazon/aoc/helpers/SortUtils.java deleted file mode 100644 index 3287ab9b74..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/helpers/SortUtils.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.helpers; - -import com.amazon.aoc.models.xray.Entity; -import java.util.List; - -public final class SortUtils { - private static final int MAX_RESURSIVE_DEPTH = 10; - - /** - * Given a list of entities, which are X-Ray segments or subsegments, recursively sort each of - * their children subsegments by start time, then sort the given list itself by start time. - * - * @param entities - list of X-Ray entities to sort recursively. Modified in place. - */ - public static void recursiveEntitySort(List entities) { - recursiveEntitySort(entities, 0); - } - - private static void recursiveEntitySort(List entities, int depth) { - if (entities == null || entities.size() == 0 || depth >= MAX_RESURSIVE_DEPTH) { - return; - } - int currDepth = depth + 1; - - for (Entity entity : entities) { - if (entity.getSubsegments() != null && !entity.getSubsegments().isEmpty()) { - recursiveEntitySort(entity.getSubsegments(), currDepth); - } - } - - entities.sort( - (entity1, entity2) -> { - if (entity1.getStartTime() == entity2.getStartTime()) { - return 0; - } - - return entity1.getStartTime() < entity2.getStartTime() ? -1 : 1; - }); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/models/CloudWatchContext.java b/testing/validator/src/main/java/com/amazon/aoc/models/CloudWatchContext.java deleted file mode 100644 index acb5d30deb..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/models/CloudWatchContext.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.models; - -import lombok.Data; - -@Data -public class CloudWatchContext { - private String clusterName; - - private App appMesh; - private App nginx; - private App jmx; - private App haproxy; - private App memcached; - - public void setAppMesh(App appMesh) { - appMesh.setName("appMesh"); - this.appMesh = appMesh; - } - - public void setNginx(App nginx) { - nginx.setName("nginx"); - this.nginx = nginx; - } - - public void setJmx(App jmx) { - jmx.setName("jmx"); - this.jmx = jmx; - } - - public void setHaproxy(App haproxy) { - haproxy.setName("haproxy"); - this.haproxy = haproxy; - } - - public void setMemcached(App memcached) { - memcached.setName("memcached"); - this.memcached = memcached; - } - - @Data - public static class App { - private String name; - private String namespace; - private String job; - // For ECS - private String[] taskDefinitionFamilies; - private String serviceName; - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/models/Context.java b/testing/validator/src/main/java/com/amazon/aoc/models/Context.java deleted file mode 100644 index 5d8a13c085..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/models/Context.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.models; - -import java.util.List; -import lombok.Data; -import lombok.NonNull; - -@Data -public class Context { - @NonNull private String testingId; - - private String accountId; - - private String language; - - @NonNull private String region; - - private String availabilityZone; - - @NonNull private Boolean isCanary; - - @NonNull private Boolean isRollup; - - private String metricNamespace; - - private String appNamespace; - - // Variable containing platform specific information. Ex: For EKS, the cluster where the sample - // app is deployed is needed. - private String platformInfo; - - private String serviceName; - - private String remoteServiceName; - - private String remoteServiceDeploymentName; - - private String endpoint; - - private String requestBody; - - private String logGroup; - - private String instanceAmi; - - private ECSContext ecsContext; - - private CloudWatchContext cloudWatchContext; - - private EC2Context ec2Context; - - /* testcase name */ - private String testcase; - - /* - alarm related parameters - */ - private List alarmNameList; - private Integer alarmPullingDuration; - private Integer alarmPullingTimes; - - /* - mocked server parameters - */ - private String mockedServerValidatingUrl; - - /* - cortex parameters - */ - private String cortexInstanceEndpoint; -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/models/EC2Context.java b/testing/validator/src/main/java/com/amazon/aoc/models/EC2Context.java deleted file mode 100644 index 35f0c6b5a8..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/models/EC2Context.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.models; - -import lombok.Data; - -@Data -public class EC2Context { - // ec2 related context - private String hostId; - private String ami; - private String name; - private String instanceType; -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/models/ECSContext.java b/testing/validator/src/main/java/com/amazon/aoc/models/ECSContext.java deleted file mode 100644 index 06884027b0..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/models/ECSContext.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.models; - -import lombok.Data; - -@Data -public class ECSContext { - // ecs related context - private String ecsClusterName; - private String ecsClusterArn; - private String ecsTaskDefArn; - private String ecsTaskDefFamily; - private String ecsTaskDefVersion; - private String ecsLaunchType; -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/models/SampleAppResponse.java b/testing/validator/src/main/java/com/amazon/aoc/models/SampleAppResponse.java deleted file mode 100644 index b370aa5d36..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/models/SampleAppResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.models; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import java.io.Serializable; -import lombok.Data; - -@Data -@JsonIgnoreProperties(ignoreUnknown = true) -public class SampleAppResponse implements Serializable { - private String traceId; -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/models/ValidationConfig.java b/testing/validator/src/main/java/com/amazon/aoc/models/ValidationConfig.java deleted file mode 100644 index f1c83a553d..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/models/ValidationConfig.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.models; - -import com.amazon.aoc.fileconfigs.FileConfig; -import com.amazon.aoc.fileconfigs.LocalPathExpectedTemplate; -import com.amazon.aoc.fileconfigs.PredefinedExpectedTemplate; -import com.amazonaws.util.StringUtils; -import lombok.Data; - -@Data -public class ValidationConfig { - String validationType; - String callingType = "none"; - - String httpPath; - String httpMethod; - String requestBody; - - String expectedResultPath; - Boolean shouldValidateMetricValue; - - String expectedMetricTemplate; - String expectedTraceTemplate; - String expectedLogStructureTemplate; - - /** alarm related. */ - Integer pullingDuration; - - Integer pullingTimes; - - /** performance test related. */ - String cpuMetricName; - - String memoryMetricName; - Integer collectionPeriod; - Integer datapointPeriod; - String dataType; - String dataMode; - Integer dataRate; - String[] otReceivers; - String[] otProcessors; - String[] otExporters; - - // Dimensions - String testcase; - String commitId; - String instanceId; - String instanceType; - String launchDate; - String exe; - String processName; - String testingAmi; - String negativeSoaking; - - public FileConfig getExpectedMetricTemplate() { - return this.getTemplate(this.expectedMetricTemplate); - } - - public FileConfig getExpectedTraceTemplate() { - return this.getTemplate(this.expectedTraceTemplate); - } - - public FileConfig getExpectedLogStructureTemplate() { - return this.getTemplate(this.expectedLogStructureTemplate); - } - - /** - * get expected template 1. if the path starts with "file://", we assume it's a local path. 2. if - * not, we assume it's a ENUM name which we defined in the framework. - * - * @return ExpectedMetric - */ - private FileConfig getTemplate(String templatePath) { - // allow templatePath to be empty or null - // return a empty FileConfig in this case. - if (StringUtils.isNullOrEmpty(templatePath)) { - return new LocalPathExpectedTemplate(templatePath); - } - - if (templatePath.startsWith("file://")) { - return new LocalPathExpectedTemplate(templatePath); - } - - return PredefinedExpectedTemplate.valueOf(templatePath); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/models/xray/Entity.java b/testing/validator/src/main/java/com/amazon/aoc/models/xray/Entity.java deleted file mode 100644 index 3f95d0634a..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/models/xray/Entity.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.models.xray; - -import com.fasterxml.jackson.annotation.JsonInclude; -import java.util.List; -import java.util.Map; -import lombok.Getter; -import lombok.Setter; - -/** - * Barebones class representing a X-Ray Entity, used for JSON deserialization with Jackson. It is - * not exactly an entity because it includes fields that are only allowed in Segments (e.g. origin, - * user) but for the purposes of the validator that is acceptable because those fields will be - * ignored when they're not present in subsegments. - */ -@Getter -@Setter -@JsonInclude(JsonInclude.Include.NON_DEFAULT) -public class Entity { - private String name; - private String id; - private String parentId; - private double startTime; - private String resourceArn; - private String user; - private String origin; - private String traceId; - - private double endTime; - private boolean fault; - private boolean error; - private boolean throttle; - private boolean inProgress; - private boolean inferred; - private boolean stubbed; - private String namespace; - - private List subsegments; - - private Map cause; - private Map http; - private Map aws; - private Map sql; - private Map service; - - private Map> metadata; - private Map annotations; -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/services/CloudWatchService.java b/testing/validator/src/main/java/com/amazon/aoc/services/CloudWatchService.java deleted file mode 100644 index db444f42e1..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/services/CloudWatchService.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.services; - -import com.amazonaws.services.cloudwatch.AmazonCloudWatch; -import com.amazonaws.services.cloudwatch.AmazonCloudWatchClientBuilder; -import com.amazonaws.services.cloudwatch.model.*; -import com.amazonaws.services.logs.AWSLogs; -import com.amazonaws.services.logs.AWSLogsClientBuilder; -import com.amazonaws.services.logs.model.FilterLogEventsRequest; -import com.amazonaws.services.logs.model.FilterLogEventsResult; -import com.amazonaws.services.logs.model.FilteredLogEvent; -import com.amazonaws.services.logs.model.GetLogEventsRequest; -import com.amazonaws.services.logs.model.GetLogEventsResult; -import com.amazonaws.services.logs.model.OutputLogEvent; -import java.util.Date; -import java.util.List; -import lombok.extern.log4j.Log4j2; - -/** a wrapper of cloudwatch client. */ -@Log4j2 -public class CloudWatchService { - public static final String SERVICE_DIMENSION = "Service"; - public static final String REMOTE_SERVICE_DIMENSION = "RemoteService"; - - private static final int MAX_QUERY_PERIOD = 60; - private static final String REQUESTER = "integrationTest"; - - private AmazonCloudWatch amazonCloudWatch; - private AWSLogs awsLogs; - - /** - * Construct CloudWatch Service with region. - * - * @param region the region for CloudWatch - */ - public CloudWatchService(String region) { - amazonCloudWatch = AmazonCloudWatchClientBuilder.standard().withRegion(region).build(); - awsLogs = AWSLogsClientBuilder.standard().withRegion(region).build(); - } - - /** - * listMetrics fetches metrics from CloudWatch. - * - * @param namespace the metric namespace on CloudWatch - * @param metricName the metric name on CloudWatch - * @return List of Metrics - */ - public List listMetrics( - final String namespace, - final String metricName, - final String dimensionKey, - final String dimensionValue) { - final DimensionFilter dimensionFilter = - new DimensionFilter().withName(dimensionKey).withValue(dimensionValue); - final ListMetricsRequest listMetricsRequest = - new ListMetricsRequest() - .withNamespace(namespace) - .withMetricName(metricName) - .withDimensions(dimensionFilter) - .withRecentlyActive("PT3H"); - return amazonCloudWatch.listMetrics(listMetricsRequest).getMetrics(); - } - - /** - * getMetricData fetches the history data of the given metric from CloudWatch. - * - * @param metric metric query object - * @param startTime the start timestamp - * @param endTime the end timestamp - * @return List of MetricDataResult - */ - public List getMetricData(Metric metric, Date startTime, Date endTime) { - MetricStat stat = - new MetricStat().withMetric(metric).withStat("Average").withPeriod(MAX_QUERY_PERIOD); - MetricDataQuery query = new MetricDataQuery().withMetricStat(stat).withId(REQUESTER); - final GetMetricDataRequest request = - new GetMetricDataRequest() - .withMetricDataQueries(query) - .withStartTime(startTime) - .withEndTime(endTime); - - GetMetricDataResult result = amazonCloudWatch.getMetricData(request); - return result.getMetricDataResults(); - } - - /** - * putMetricData publish metric to CloudWatch. - * - * @param namespace the metric namespace on CloudWatch - * @param metricName the metric name on CloudWatch - * @param value the metric value on CloudWatch - * @param dimensions the dimensions of metric - * @return Response of PMD call - */ - public PutMetricDataResult putMetricData( - final String namespace, - final String metricName, - final Double value, - final Dimension... dimensions) { - MetricDatum datum = - new MetricDatum() - .withMetricName(metricName) - .withUnit(StandardUnit.None) - .withDimensions(dimensions) - .withValue(value); - PutMetricDataRequest request = - new PutMetricDataRequest().withNamespace(namespace).withMetricData(datum); - return amazonCloudWatch.putMetricData(request); - } - - /** - * getDatapoints fetches datapoints from CloudWatch using the given request. - * - * @param request request for datapoint - * @return List of Datapoints - */ - public List getDatapoints(GetMetricStatisticsRequest request) { - return amazonCloudWatch.getMetricStatistics(request).getDatapoints(); - } - - /** - * getLogs fetches log entries from CloudWatch. - * - * @param logGroupName the log group name - * @param logStreamName the log stream name - * @param startFromTimestamp the start timestamp - * @param limit the maximum number of log events to be returned in a single query - * @return List of OutputLogEvent - */ - public List getLogs( - String logGroupName, String logStreamName, long startFromTimestamp, int limit) { - GetLogEventsRequest request = - new GetLogEventsRequest() - .withLogGroupName(logGroupName) - .withLogStreamName(logStreamName) - .withStartTime(startFromTimestamp) - .withLimit(limit); - - GetLogEventsResult result = awsLogs.getLogEvents(request); - return result.getEvents(); - } - - /** - * filterLogs filters log entries from CloudWatch. - * - * @param logGroupName the log group name - * @param filterPattern the filter pattern, see - * https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html - * @param startFromTimestamp the start timestamp - * @param limit the maximum number of log events to be returned in a single query - * @return List of FilteredLogEvent - */ - public List filterLogs( - String logGroupName, String filterPattern, long startFromTimestamp, int limit) { - FilterLogEventsRequest request = - new FilterLogEventsRequest() - .withLogGroupName(logGroupName) - .withStartTime(startFromTimestamp) - .withFilterPattern(filterPattern) - .withLimit(limit); - - FilterLogEventsResult result = awsLogs.filterLogEvents(request); - return result.getEvents(); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/services/XRayService.java b/testing/validator/src/main/java/com/amazon/aoc/services/XRayService.java deleted file mode 100644 index b96ff3332c..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/services/XRayService.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.services; - -import com.amazonaws.services.xray.AWSXRay; -import com.amazonaws.services.xray.AWSXRayClientBuilder; -import com.amazonaws.services.xray.model.BatchGetTracesRequest; -import com.amazonaws.services.xray.model.BatchGetTracesResult; -import com.amazonaws.services.xray.model.GetTraceSummariesRequest; -import com.amazonaws.services.xray.model.GetTraceSummariesResult; -import com.amazonaws.services.xray.model.Trace; -import com.amazonaws.services.xray.model.TraceSummary; -import java.util.Date; -import java.util.List; -import org.joda.time.DateTime; - -public class XRayService { - private AWSXRay awsxRay; - private final int SEARCH_PERIOD = 60; - public static String DEFAULT_TRACE_ID = "1-00000000-000000000000000000000000"; - - public XRayService(String region) { - awsxRay = AWSXRayClientBuilder.standard().withRegion(region).build(); - } - - /** - * List trace objects by ids. - * - * @param traceIdList trace id list - * @return trace object list - */ - public List listTraceByIds(List traceIdList) { - BatchGetTracesResult batchGetTracesResult = - awsxRay.batchGetTraces(new BatchGetTracesRequest().withTraceIds(traceIdList)); - - return batchGetTracesResult.getTraces(); - } - - // Search for traces generated within the last 60 second. - public List searchClientCallTraces(String serviceName) { - Date currentDate = new Date(); - Date pastDate = new DateTime(currentDate).minusSeconds(SEARCH_PERIOD).toDate(); - GetTraceSummariesResult traceSummaryResult = - awsxRay.getTraceSummaries( - new GetTraceSummariesRequest() - .withStartTime(pastDate) - .withEndTime(currentDate) - .withFilterExpression( - "annotation.aws_local_service = \"" - + serviceName - + "\" AND annotation.aws_local_service = \"local-root-client-call\"")); - return traceSummaryResult.getTraceSummaries(); - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/validators/CWLogValidator.java b/testing/validator/src/main/java/com/amazon/aoc/validators/CWLogValidator.java deleted file mode 100644 index f464e41193..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/validators/CWLogValidator.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.validators; - -import com.amazon.aoc.callers.ICaller; -import com.amazon.aoc.exception.BaseException; -import com.amazon.aoc.exception.ExceptionCode; -import com.amazon.aoc.fileconfigs.FileConfig; -import com.amazon.aoc.helpers.MustacheHelper; -import com.amazon.aoc.helpers.RetryHelper; -import com.amazon.aoc.models.Context; -import com.amazon.aoc.models.ValidationConfig; -import com.amazon.aoc.services.CloudWatchService; -import com.amazonaws.services.logs.model.FilteredLogEvent; -import com.github.wnameless.json.flattener.FlattenMode; -import com.github.wnameless.json.flattener.JsonFlattener; -import com.github.wnameless.json.flattener.JsonifyArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import lombok.extern.log4j.Log4j2; - -@Log4j2 -public class CWLogValidator implements IValidator { - private static int DEFAULT_MAX_RETRY_COUNT = 15; - - private MustacheHelper mustacheHelper = new MustacheHelper(); - private ICaller caller; - private Context context; - private FileConfig expectedLog; - private CloudWatchService cloudWatchService; - private int maxRetryCount; - - @Override - public void validate() throws Exception { - log.info("Start CW Log Validation for path {}", caller.getCallingPath()); - - // Get expected values for log attributes we want to check - JsonifyArrayList> expectedAttributesArray = this.getExpectedAttributes(); - log.info("Values of expected logs: {}", expectedAttributesArray); - - RetryHelper.retry( - this.maxRetryCount, - () -> { - - // Call sample app to generate logs - this.caller.callSampleApp(); - - // Iterate through each expected template to check if the log is present - for (Map expectedAttributes : expectedAttributesArray) { - // All attributes are in REGEX for preciseness except operation, remoteService and - // remoteOperation - // which are in normal text as they are needed for - // the filter expressions for retrieving the actual logs. - log.info("Searching for expected log: {}", expectedAttributes); - String operation = (String) expectedAttributes.get("Operation"); - String remoteService = (String) expectedAttributes.get("RemoteService"); - String remoteOperation = (String) expectedAttributes.get("RemoteOperation"); - - Map actualLog = - this.getActualLog(operation, remoteService, remoteOperation); - log.info("Value of an actual log: {}", actualLog); - - if (actualLog == null) throw new BaseException(ExceptionCode.EXPECTED_LOG_NOT_FOUND); - - validateLogs(expectedAttributes, actualLog); - } - }); - - log.info("Log validation is passed for path {}", caller.getCallingPath()); - } - - private void validateLogs(Map expectedAttributes, Map actualLog) - throws Exception { - for (Map.Entry entry : expectedAttributes.entrySet()) { - String expectedKey = entry.getKey(); - Object expectedValue = entry.getValue(); - - if (!actualLog.containsKey(expectedKey)) { - log.error("Log Validation Failure: Key {} does not exist", expectedKey); - throw new BaseException(ExceptionCode.EXPECTED_LOG_NOT_FOUND); - } - - Pattern pattern = Pattern.compile(expectedValue.toString()); - Matcher matcher = pattern.matcher(actualLog.get(expectedKey).toString()); - - if (!matcher.find()) { - log.error( - "Log Validation Failure: Value for Key: {} was expected to be: {}, but actual was: {}", - expectedKey, - expectedValue, - actualLog.get(expectedKey)); - throw new BaseException(ExceptionCode.DATA_MODEL_NOT_MATCHED); - } - } - } - - private JsonifyArrayList> getExpectedAttributes() throws Exception { - JsonifyArrayList> flattenedJsonMapForExpectedLogArray = null; - String jsonExpectedLog = mustacheHelper.render(this.expectedLog, context); - - try { - // flattened JSON object to a map while keeping the arrays - Map flattenedJsonMapForExpectedLog = - new JsonFlattener(jsonExpectedLog) - .withFlattenMode(FlattenMode.KEEP_ARRAYS) - .flattenAsMap(); - - flattenedJsonMapForExpectedLogArray = - (JsonifyArrayList) flattenedJsonMapForExpectedLog.get("root"); - } catch (Exception e) { - e.printStackTrace(); - } - - return flattenedJsonMapForExpectedLogArray; - } - - private Map getActualLog( - String operation, String remoteService, String remoteOperation) throws Exception { - String filterPattern = null; - - // Dependency calls will have the remoteService and remoteOperation attribute, but service calls - // will not. A service call will have - // null remoteService and null remoteOperation and the filter expression must be adjusted - // accordingly. - if (remoteService == null && remoteOperation == null) { - filterPattern = - String.format( - "{ ($.Service = %s) && ($.Operation = \"%s\") && " - + "($.RemoteService NOT EXISTS) && ($.RemoteOperation NOT EXISTS) }", - context.getServiceName(), operation); - } else { - filterPattern = - String.format( - "{ ($.Service = %s) && ($.Operation = \"%s\") && " - + "($.RemoteService = \"%s\") && ($.RemoteOperation = \"%s\") }", - context.getServiceName(), operation, remoteService, remoteOperation); - } - log.info("Filter Pattern for Log Search: " + filterPattern); - - List retrievedLogs = - this.cloudWatchService.filterLogs( - context.getLogGroup(), - filterPattern, - System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(5), - 10); - - if (retrievedLogs == null || retrievedLogs.isEmpty()) { - throw new BaseException(ExceptionCode.EMPTY_LIST); - } - - return JsonFlattener.flattenAsMap(retrievedLogs.get(0).getMessage()); - } - - @Override - public void init( - Context context, - ValidationConfig validationConfig, - ICaller caller, - FileConfig expectedLogTemplate) - throws Exception { - this.context = context; - this.caller = caller; - this.expectedLog = expectedLogTemplate; - this.cloudWatchService = new CloudWatchService(context.getRegion()); - this.maxRetryCount = DEFAULT_MAX_RETRY_COUNT; - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java b/testing/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java deleted file mode 100644 index c881301bc4..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.validators; - -import com.amazon.aoc.callers.ICaller; -import com.amazon.aoc.exception.BaseException; -import com.amazon.aoc.exception.ExceptionCode; -import com.amazon.aoc.fileconfigs.FileConfig; -import com.amazon.aoc.helpers.CWMetricHelper; -import com.amazon.aoc.helpers.MustacheHelper; -import com.amazon.aoc.helpers.RetryHelper; -import com.amazon.aoc.models.Context; -import com.amazon.aoc.models.ValidationConfig; -import com.amazon.aoc.services.CloudWatchService; -import com.amazonaws.services.cloudwatch.model.Dimension; -import com.amazonaws.services.cloudwatch.model.Metric; -import com.google.common.collect.Lists; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import lombok.extern.log4j.Log4j2; - -@Log4j2 -public class CWMetricValidator implements IValidator { - private static int DEFAULT_MAX_RETRY_COUNT = 10; - - private MustacheHelper mustacheHelper = new MustacheHelper(); - private ICaller caller; - private Context context; - private FileConfig expectedMetric; - - private CloudWatchService cloudWatchService; - private CWMetricHelper cwMetricHelper; - private int maxRetryCount; - - // for unit test - public void setCloudWatchService(CloudWatchService cloudWatchService) { - this.cloudWatchService = cloudWatchService; - } - - // for unit test so that we lower the count to 1 - public void setMaxRetryCount(int maxRetryCount) { - this.maxRetryCount = maxRetryCount; - } - - @Override - public void validate() throws Exception { - log.info("Start metric validating"); - // get expected metrics and remove the to be skipped dimensions - final List expectedMetricList = - cwMetricHelper.listExpectedMetrics(context, expectedMetric, caller); - Set skippedDimensionNameList = new HashSet<>(); - for (Metric metric : expectedMetricList) { - for (Dimension dimension : metric.getDimensions()) { - - if (dimension.getValue() == null || dimension.getValue().equals("")) { - continue; - } - - if (dimension.getValue().equals("SKIP")) { - skippedDimensionNameList.add(dimension.getName()); - } - } - } - for (Metric metric : expectedMetricList) { - metric - .getDimensions() - .removeIf((dimension) -> skippedDimensionNameList.contains(dimension.getName())); - } - - // get metric from cloudwatch - RetryHelper.retry( - maxRetryCount, - () -> { - // We will query both the Service and RemoteService dimensions to ensure we get all - // metrics from all aggregations, specifically the [RemoteService] aggregation. - List serviceNames = - Lists.newArrayList( - context.getServiceName(), context.getRemoteServiceDeploymentName()); - // TODO - Put the following back in: "www.amazon.com", "AWS.SDK.S3" - List remoteServiceNames = - Lists.newArrayList(context.getRemoteServiceDeploymentName()); - if (context.getRemoteServiceName() != null && !context.getRemoteServiceName().isEmpty()) { - serviceNames.add(context.getRemoteServiceName()); - } - - List actualMetricList = Lists.newArrayList(); - addMetrics( - CloudWatchService.SERVICE_DIMENSION, - serviceNames, - expectedMetricList, - actualMetricList); - addMetrics( - CloudWatchService.REMOTE_SERVICE_DIMENSION, - remoteServiceNames, - expectedMetricList, - actualMetricList); - - // remove the skip dimensions - log.info("dimensions to be skipped in validation: {}", skippedDimensionNameList); - for (Metric metric : actualMetricList) { - metric - .getDimensions() - .removeIf((dimension) -> skippedDimensionNameList.contains(dimension.getName())); - } - - log.info("check if all the expected metrics are found"); - log.info("actual metricList is {}", actualMetricList); - log.info("expected metricList is {}", expectedMetricList); - compareMetricLists(expectedMetricList, actualMetricList); - }); - - log.info("finish metric validation"); - } - - private void addMetrics( - String dimensionName, - List dimensionValues, - List expectedMetricList, - List actualMetricList) - throws Exception { - for (String dimensionValue : dimensionValues) { - actualMetricList.addAll( - this.listMetricFromCloudWatch( - cloudWatchService, expectedMetricList, dimensionName, dimensionValue)); - } - } - - /** - * Check if every metric in toBeChckedMetricList is in baseMetricList. - * - * @param toBeCheckedMetricList toBeCheckedMetricList - * @param baseMetricList baseMetricList - */ - private void compareMetricLists(List toBeCheckedMetricList, List baseMetricList) - throws BaseException { - - // load metrics into a hash set - Set metricSet = - new TreeSet<>( - (Metric o1, Metric o2) -> { - // check namespace - if (!o1.getNamespace().equals(o2.getNamespace())) { - return o1.getNamespace().compareTo(o2.getNamespace()); - } - - // check metric name - if (!o1.getMetricName().equals(o2.getMetricName())) { - return o1.getMetricName().compareTo(o2.getMetricName()); - } - - // sort and check dimensions - List dimensionList1 = o1.getDimensions(); - List dimensionList2 = o2.getDimensions(); - - // sort - dimensionList1.sort(Comparator.comparing(Dimension::getName)); - dimensionList2.sort(Comparator.comparing(Dimension::getName)); - - return dimensionList1.toString().compareTo(dimensionList2.toString()); - }); - for (Metric metric : baseMetricList) { - metricSet.add(metric); - } - for (Metric metric : toBeCheckedMetricList) { - if (!metricSet.contains(metric)) { - throw new BaseException( - ExceptionCode.EXPECTED_METRIC_NOT_FOUND, - String.format( - "metric in %ntoBeCheckedMetricList: %s is not found in %nbaseMetricList: %s %n", - metric, metricSet)); - } - } - } - - private List listMetricFromCloudWatch( - CloudWatchService cloudWatchService, - List expectedMetricList, - String dimensionKey, - String dimensionValue) - throws IOException { - // put namespace into the map key, so that we can use it to search metric - HashMap metricNameMap = new HashMap<>(); - for (Metric metric : expectedMetricList) { - metricNameMap.put(metric.getMetricName(), metric.getNamespace()); - } - - // search by metric name - List result = new ArrayList<>(); - for (String metricName : metricNameMap.keySet()) { - result.addAll( - cloudWatchService.listMetrics( - metricNameMap.get(metricName), metricName, dimensionKey, dimensionValue)); - } - return result; - } - - @Override - public void init( - Context context, - ValidationConfig validationConfig, - ICaller caller, - FileConfig expectedMetricTemplate) - throws Exception { - this.context = context; - this.caller = caller; - this.expectedMetric = expectedMetricTemplate; - this.cloudWatchService = new CloudWatchService(context.getRegion()); - this.cwMetricHelper = new CWMetricHelper(); - this.maxRetryCount = DEFAULT_MAX_RETRY_COUNT; - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/validators/IValidator.java b/testing/validator/src/main/java/com/amazon/aoc/validators/IValidator.java deleted file mode 100644 index 0f04f66625..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/validators/IValidator.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.validators; - -import com.amazon.aoc.callers.ICaller; -import com.amazon.aoc.fileconfigs.FileConfig; -import com.amazon.aoc.models.Context; -import com.amazon.aoc.models.ValidationConfig; - -public interface IValidator { - void init( - Context context, - ValidationConfig validationConfig, - ICaller caller, - FileConfig expectedDataTemplate) - throws Exception; - - void validate() throws Exception; -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/validators/TraceValidator.java b/testing/validator/src/main/java/com/amazon/aoc/validators/TraceValidator.java deleted file mode 100644 index 10801157eb..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/validators/TraceValidator.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.validators; - -import com.amazon.aoc.callers.ICaller; -import com.amazon.aoc.enums.GenericConstants; -import com.amazon.aoc.exception.BaseException; -import com.amazon.aoc.exception.ExceptionCode; -import com.amazon.aoc.fileconfigs.FileConfig; -import com.amazon.aoc.helpers.MustacheHelper; -import com.amazon.aoc.helpers.RetryHelper; -import com.amazon.aoc.helpers.SortUtils; -import com.amazon.aoc.models.Context; -import com.amazon.aoc.models.SampleAppResponse; -import com.amazon.aoc.models.ValidationConfig; -import com.amazon.aoc.models.xray.Entity; -import com.amazon.aoc.services.XRayService; -import com.amazonaws.services.xray.model.Segment; -import com.amazonaws.services.xray.model.Trace; -import com.amazonaws.services.xray.model.TraceSummary; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import com.github.wnameless.json.flattener.JsonFlattener; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import lombok.extern.log4j.Log4j2; - -@Log4j2 -public class TraceValidator implements IValidator { - private MustacheHelper mustacheHelper = new MustacheHelper(); - private XRayService xrayService; - private ICaller caller; - private Context context; - private FileConfig expectedTrace; - private static final ObjectMapper MAPPER = - new ObjectMapper().setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); - - @Override - public void init( - Context context, ValidationConfig validationConfig, ICaller caller, FileConfig expectedTrace) - throws Exception { - this.xrayService = new XRayService(context.getRegion()); - this.caller = caller; - this.context = context; - this.expectedTrace = expectedTrace; - } - - @Override - public void validate() throws Exception { - // 2 retries for calling the sample app to handle the Lambda case, - // where first request might be a cold start and have an additional unexpected subsegment - boolean isMatched = - RetryHelper.retry( - 2, - Integer.parseInt(GenericConstants.SLEEP_IN_MILLISECONDS.getVal()), - false, - () -> { - // Call sample app and get locally stored trace - Map storedTrace = this.getStoredTrace(); - log.info("value of stored trace map: {}", storedTrace); - - // prepare list of trace IDs to retrieve from X-Ray service - String traceId = (String) storedTrace.get("[0].trace_id"); - // If the traceId is invalid, then we don't want to try validating the retrieved trace - // with the invalid id. Therefore, - // remove it from the expected trace. - if (XRayService.DEFAULT_TRACE_ID.equals(traceId)) { - storedTrace.remove("[0].trace_id"); - } - List traceIdList = Collections.singletonList(traceId); - - // Retry 5 times to since segments might not be immediately available in X-Ray service - RetryHelper.retry( - 5, - () -> { - // get retrieved trace from x-ray service - Map retrievedTrace = this.getRetrievedTrace(traceIdList); - log.info("value of retrieved trace map: {}", retrievedTrace); - - // data model validation of other fields of segment document - for (Map.Entry entry : storedTrace.entrySet()) { - String targetKey = entry.getKey(); - if (retrievedTrace.get(targetKey) == null) { - log.error("mis target data: {}", targetKey); - throw new BaseException(ExceptionCode.DATA_MODEL_NOT_MATCHED); - } - - String expected = entry.getValue().toString(); - String actual = retrievedTrace.get(targetKey).toString(); - - Pattern pattern = Pattern.compile(expected.toString()); - Matcher matcher = pattern.matcher(actual.toString()); - - if (!matcher.find()) { - log.error("data model validation failed"); - log.info("mismatched data model field list"); - log.info("value of stored trace map: {}", entry.getValue()); - log.info("value of retrieved map: {}", retrievedTrace.get(targetKey)); - log.info("=========================================="); - throw new BaseException(ExceptionCode.DATA_MODEL_NOT_MATCHED); - } - } - }); - }); - - if (!isMatched) { - throw new BaseException(ExceptionCode.DATA_MODEL_NOT_MATCHED); - } - - log.info("validation is passed for path {}", caller.getCallingPath()); - } - - // this method will hit get trace from x-ray service and get retrieved trace - private Map getRetrievedTrace(List traceIdList) throws Exception { - List retrieveTraceList = null; - // Special Case for the /client-call. The API call doesn't return the trace ID of the local root - // client span, so find the trace by filtering traces generated within the last 60 second - // with the serviceName and the local_root_client_call keyword. - if (XRayService.DEFAULT_TRACE_ID.equals(traceIdList.get(0))) { - List retrieveTraceLists = - xrayService.searchClientCallTraces(context.getServiceName()); - List traceIdLists = Collections.singletonList(retrieveTraceLists.get(0).getId()); - retrieveTraceList = xrayService.listTraceByIds(traceIdLists); - } else { - retrieveTraceList = xrayService.listTraceByIds(traceIdList); - } - - if (retrieveTraceList == null || retrieveTraceList.isEmpty()) { - throw new BaseException(ExceptionCode.EMPTY_LIST); - } - return this.flattenDocument(retrieveTraceList.get(0).getSegments()); - } - - private Map flattenDocument(List segmentList) { - List entityList = new ArrayList<>(); - - // Parse retrieved segment documents into a barebones Entity POJO - for (Segment segment : segmentList) { - Entity entity; - try { - entity = MAPPER.readValue(segment.getDocument(), Entity.class); - entityList.add(entity); - } catch (JsonProcessingException e) { - log.warn("Error parsing segment JSON", e); - } - } - - // Recursively sort all segments and subsegments so the ordering is always consistent - SortUtils.recursiveEntitySort(entityList); - StringBuilder segmentsJson = new StringBuilder("["); - - // build the segment's document as a json array and flatten it for easy comparison - for (Entity entity : entityList) { - try { - segmentsJson.append(MAPPER.writeValueAsString(entity)); - segmentsJson.append(","); - } catch (JsonProcessingException e) { - log.warn("Error serializing segment JSON", e); - } - } - - segmentsJson.replace(segmentsJson.length() - 1, segmentsJson.length(), "]"); - return JsonFlattener.flattenAsMap(segmentsJson.toString()); - } - - // this method will hit a http endpoints of sample web apps and get stored trace - private Map getStoredTrace() throws Exception { - Map flattenedJsonMapForStoredTraces = null; - - SampleAppResponse sampleAppResponse = this.caller.callSampleApp(); - - String jsonExpectedTrace = mustacheHelper.render(this.expectedTrace, context); - - try { - // flattened JSON object to a map - flattenedJsonMapForStoredTraces = JsonFlattener.flattenAsMap(jsonExpectedTrace); - flattenedJsonMapForStoredTraces.put("[0].trace_id", sampleAppResponse.getTraceId()); - } catch (Exception e) { - e.printStackTrace(); - } - - return flattenedJsonMapForStoredTraces; - } -} diff --git a/testing/validator/src/main/java/com/amazon/aoc/validators/ValidatorFactory.java b/testing/validator/src/main/java/com/amazon/aoc/validators/ValidatorFactory.java deleted file mode 100644 index 56397cb283..0000000000 --- a/testing/validator/src/main/java/com/amazon/aoc/validators/ValidatorFactory.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.validators; - -import com.amazon.aoc.callers.HttpCaller; -import com.amazon.aoc.callers.ICaller; -import com.amazon.aoc.exception.BaseException; -import com.amazon.aoc.exception.ExceptionCode; -import com.amazon.aoc.fileconfigs.FileConfig; -import com.amazon.aoc.models.Context; -import com.amazon.aoc.models.ValidationConfig; - -public class ValidatorFactory { - private Context context; - - public ValidatorFactory(Context context) { - this.context = context; - } - - /** - * create and init validator base on config. - * - * @param validationConfig config from file - * @return validator object - * @throws Exception when there's no matched validator - */ - public IValidator launchValidator(ValidationConfig validationConfig) throws Exception { - // get validator - IValidator validator; - FileConfig expectedData = null; - switch (validationConfig.getValidationType()) { - case "trace": - validator = new TraceValidator(); - expectedData = validationConfig.getExpectedTraceTemplate(); - break; - case "cw-metric": - validator = new CWMetricValidator(); - expectedData = validationConfig.getExpectedMetricTemplate(); - break; - case "cw-log": - validator = new CWLogValidator(); - expectedData = validationConfig.getExpectedLogStructureTemplate(); - break; - default: - throw new BaseException(ExceptionCode.VALIDATION_TYPE_NOT_EXISTED); - } - - // get caller - ICaller caller; - switch (validationConfig.getCallingType()) { - case "http": - caller = new HttpCaller(context.getEndpoint(), validationConfig.getHttpPath()); - break; - case "http-with-body": - // ONLY ONE OF THESE CAN BE USED PER VALIDATOR CALL - caller = - new HttpCaller( - context.getEndpoint(), validationConfig.getHttpPath(), context.getRequestBody()); - break; - case "none": - caller = null; - break; - default: - throw new BaseException(ExceptionCode.CALLER_TYPE_NOT_EXISTED); - } - - // init validator - validator.init(this.context, validationConfig, caller, expectedData); - return validator; - } -} diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/aws-sdk-call-log.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/aws-sdk-call-log.mustache deleted file mode 100644 index d0de0dd600..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/aws-sdk-call-log.mustache +++ /dev/null @@ -1,17 +0,0 @@ -[{ - "HostedIn.Environment": "^EC2$", - "Operation": "GET /aws-sdk-call", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "aws.span.kind": "^LOCAL_ROOT$" -}, -{ - "HostedIn.Environment": "^EC2$", - "Operation": "GET /aws-sdk-call", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "RemoteService": "AWS.SDK.S3", - "RemoteOperation": "GetBucketLocation", - "RemoteTarget": "e2e-test-bucket-name", - "aws.span.kind": "^CLIENT$" -}] \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/aws-sdk-call-metric.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/aws-sdk-call-metric.mustache deleted file mode 100644 index cd23971e96..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/aws-sdk-call-metric.mustache +++ /dev/null @@ -1,358 +0,0 @@ -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - - diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/aws-sdk-call-trace.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/aws-sdk-call-trace.mustache deleted file mode 100644 index e882f3fbb6..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/aws-sdk-call-trace.mustache +++ /dev/null @@ -1,63 +0,0 @@ -[{ - "name": "^{{serviceName}}$", - "http": { - "request": { - "url": "^{{endpoint}}/aws-sdk-call$", - "method": "^GET$" - }, - "response": { - "status": "^200$" - } - }, - "aws": { - "account_id": "^{{accountId}}$" - }, - "annotations": { - "aws_local_service": "^{{serviceName}}$", - "HostedIn_Environment": "^EC2$", - "aws_local_operation": "^GET /aws-sdk-call$" - }, - "metadata": { - "default": { - "otel.resource.aws.hostedin.environment": "^EC2$", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t2.micro$", - "aws.span.kind": "^LOCAL_ROOT$" - } - }, - "subsegments": [ - { - "subsegments": [ - { - "name": "^S3$", - "http": { - "request": { - "url": "^https://e2e-test-bucket-name.s3.{{region}}.amazonaws.com\\?location$", - "method": "^GET$" - } - }, - "annotations": { - "HostedIn_Environment": "^EC2$", - "aws_local_service": "^{{serviceName}}$", - "aws_local_operation": "^GET /aws-sdk-call$", - "aws_remote_service": "^AWS\\.SDK\\.S3$", - "aws_remote_operation": "^GetBucketLocation$", - "aws_remote_target": "^::s3:::e2e-test-bucket-name$" - }, - "metadata": { - "default": { - "aws.span.kind": "^CLIENT$" - } - }, - "namespace": "^aws$" - } - ] - } - ] -}, -{ - "name": "^S3$", - "aws": { - "operation": "^GetBucketLocation$" - } -}] \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/client-call-log.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/client-call-log.mustache deleted file mode 100644 index c2b97aadbb..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/client-call-log.mustache +++ /dev/null @@ -1,16 +0,0 @@ -[{ - "HostedIn.Environment": "^EC2$", - "Operation": "InternalOperation", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "aws.span.kind": "^LOCAL_ROOT$" -}, -{ - "HostedIn.Environment": "^EC2$", - "Operation": "InternalOperation", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "RemoteService": "local-root-client-call", - "RemoteOperation": "GET /", - "aws.span.kind": "^CLIENT$" -}] \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/client-call-metric.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/client-call-metric.mustache deleted file mode 100644 index ba7592c0a1..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/client-call-metric.mustache +++ /dev/null @@ -1,227 +0,0 @@ -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: local-root-client-call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: local-root-client-call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: local-root-client-call \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/client-call-trace.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/client-call-trace.mustache deleted file mode 100644 index 2bf8db0315..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/client-call-trace.mustache +++ /dev/null @@ -1,56 +0,0 @@ -[{ - "name": "^{{serviceName}}$", - "annotations": { - "aws_local_service": "^{{serviceName}}$", - "HostedIn_Environment": "^EC2$", - "aws_local_operation": "^InternalOperation$" - }, - "metadata": { - "default": { - "otel.resource.aws.hostedin.environment": "^EC2$", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t2.micro$" - - } - }, - "subsegments": [ - { - "name": "^local-root-client-call$", - "http": { - "request": { - "url": "^http://local-root-client-call$", - "method": "^GET$" - } - }, - "annotations": { - "HostedIn_Environment": "^EC2$", - "aws_local_service": "^{{serviceName}}$", - "aws_local_operation": "^InternalOperation$", - "aws_remote_service": "^local-root-client-call$", - "aws_remote_operation": "GET /" - }, - "metadata": { - "default": { - "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/testing/validator/src/main/resources/expected-data-template/ec2/outgoing-http-call-log.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/outgoing-http-call-log.mustache deleted file mode 100644 index 77faab1a89..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/outgoing-http-call-log.mustache +++ /dev/null @@ -1,17 +0,0 @@ -[{ - "HostedIn.Environment": "^EC2$", - "Operation": "GET /outgoing-http-call", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "aws.span.kind": "^LOCAL_ROOT$" -}, -{ - "HostedIn.Environment": "^EC2$", - "Operation": "GET /outgoing-http-call", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "RemoteService": "www.amazon.com", - "RemoteOperation": "GET /", - "aws.span.kind": "^CLIENT$" -}] - diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/outgoing-http-call-metric.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/outgoing-http-call-metric.mustache deleted file mode 100644 index ba70060387..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/outgoing-http-call-metric.mustache +++ /dev/null @@ -1,227 +0,0 @@ -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: www.amazon.com - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: www.amazon.com - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: www.amazon.com diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/outgoing-http-call-trace.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/outgoing-http-call-trace.mustache deleted file mode 100644 index 5079428b8e..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/outgoing-http-call-trace.mustache +++ /dev/null @@ -1,59 +0,0 @@ -[{ - "name": "^{{serviceName}}$", - "http": { - "request": { - "url": "^{{endpoint}}/outgoing-http-call$", - "method": "^GET$" - }, - "response": { - "status": "^200$" - } - }, - "aws": { - "account_id": "^{{accountId}}$" - }, - "annotations": { - "aws_local_service": "^{{serviceName}}$", - "HostedIn_Environment": "^EC2$", - "aws_local_operation": "^GET /outgoing-http-call$" - }, - "metadata": { - "default": { - "otel.resource.aws.hostedin.environment": "^EC2$", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t2.micro$", - "aws.span.kind": "^LOCAL_ROOT$" - } - }, - "subsegments": [ - { - "subsegments": [ - { - "name": "^www.amazon.com$", - "http": { - "request": { - "url": "^https://www.amazon.com$", - "method": "^GET$" - } - }, - "annotations": { - "HostedIn_Environment": "^EC2$", - "aws_local_service": "^{{serviceName}}$", - "aws_local_operation": "^GET /outgoing-http-call$", - "aws_remote_service": "^www.amazon.com$", - "aws_remote_operation": "^GET /$" - }, - "metadata": { - "default": { - "aws.span.kind": "^CLIENT$" - } - }, - "namespace": "^remote$" - } - ] - } - ] -}, -{ - "name": "^www.amazon.com$" -}] diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/remote-service-log.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/remote-service-log.mustache deleted file mode 100644 index 2a3a445b0f..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/remote-service-log.mustache +++ /dev/null @@ -1,16 +0,0 @@ -[{ - "HostedIn.Environment": "^EC2$", - "Operation": "GET /remote-service", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "aws.span.kind": "^LOCAL_ROOT$" -}, -{ - "HostedIn.Environment": "^EC2$", - "Operation": "GET /remote-service", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "RemoteService": "{{remoteServiceDeploymentName}}", - "RemoteOperation": "GET /healthcheck", - "aws.span.kind": "^CLIENT$" -}] \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/remote-service-metric.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/remote-service-metric.mustache deleted file mode 100644 index 004819f2ee..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/remote-service-metric.mustache +++ /dev/null @@ -1,326 +0,0 @@ -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.Environment - value: EC2 - - - name: Operation - value: GET /healthcheck - - - name: Service - value: {{remoteServiceName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{remoteServiceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - 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: HostedIn.Environment - value: EC2 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.Environment - value: EC2 - - - name: Operation - value: GET /healthcheck - - - name: Service - value: {{remoteServiceName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{remoteServiceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - 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: HostedIn.Environment - value: EC2 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.Environment - value: EC2 - - - name: Operation - value: GET /healthcheck - - - name: Service - value: {{remoteServiceName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{remoteServiceName}} - - - name: HostedIn.Environment - value: EC2 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.Environment - value: EC2 - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: RemoteService - value: {{remoteServiceDeploymentName}} diff --git a/testing/validator/src/main/resources/expected-data-template/ec2/remote-service-trace.mustache b/testing/validator/src/main/resources/expected-data-template/ec2/remote-service-trace.mustache deleted file mode 100644 index 99a7036053..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/ec2/remote-service-trace.mustache +++ /dev/null @@ -1,88 +0,0 @@ -[{ - "name": "^{{serviceName}}$", - "http": { - "request": { - "url": "^{{endpoint}}/remote-service\\?ip=(([0-9]{1,3}.){3}[0-9]{1,3})/$", - "method": "^GET$" - }, - "response": { - "status": "^200$" - } - }, - "aws": { - "account_id": "^{{accountId}}$" - }, - "annotations": { - "aws_local_service": "^{{serviceName}}$", - "HostedIn_Environment": "^EC2$", - "aws_local_operation": "^GET /remote-service$" - }, - "metadata": { - "default": { - "otel.resource.aws.hostedin.environment": "^EC2$", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t2.micro$", - "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$" - }, - "metadata": { - "default": { - "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": { - "HostedIn_Environment": "^EC2$", - "aws_local_service": "^{{remoteServiceName}}$", - "aws_local_operation": "^GET /healthcheck$" - }, - "metadata": { - "default": { - "otel.resource.aws.hostedin.environment": "^EC2$", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^t2.micro$", - "aws.span.kind": "^LOCAL_ROOT$" - } - }, - "subsegments": [ - { - "name": "^RemoteServiceController.healthcheck$", - "annotations": { - "HostedIn_Environment": "^EC2$", - "aws_local_operation": "^GET /healthcheck$" - } - } - ] -}] - - diff --git a/testing/validator/src/main/resources/expected-data-template/eks/aws-sdk-call-log.mustache b/testing/validator/src/main/resources/expected-data-template/eks/aws-sdk-call-log.mustache deleted file mode 100644 index 19df678bbe..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/aws-sdk-call-log.mustache +++ /dev/null @@ -1,25 +0,0 @@ -[{ - "HostedIn.EKS.Cluster": "^{{platformInfo}}$", - "HostedIn.K8s.Namespace": "^{{appNamespace}}$", - "K8s.Node": "^i-[A-Za-z0-9]{17}$", - "K8s.Pod": "^sample-(remote-)?app-deployment(-[A-Za-z0-9]*)*$", - "K8s.Workload": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "Operation": "GET /aws-sdk-call", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "aws.span.kind": "^LOCAL_ROOT$" -}, -{ - "HostedIn.EKS.Cluster": "^{{platformInfo}}$", - "HostedIn.K8s.Namespace": "^{{appNamespace}}$", - "K8s.Node": "^i-[A-Za-z0-9]{17}$", - "K8s.Pod": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "K8s.Workload": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "Operation": "GET /aws-sdk-call", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "RemoteService": "AWS.SDK.S3", - "RemoteOperation": "GetBucketLocation", - "RemoteTarget": "e2e-test-bucket-name", - "aws.span.kind": "^CLIENT$" -}] \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/eks/aws-sdk-call-metric.mustache b/testing/validator/src/main/resources/expected-data-template/eks/aws-sdk-call-metric.mustache deleted file mode 100644 index cca8709915..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/aws-sdk-call-metric.mustache +++ /dev/null @@ -1,419 +0,0 @@ -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS.SDK.S3 - - - name: RemoteTarget - value: ::s3:::e2e-test-bucket-name \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/eks/aws-sdk-call-trace.mustache b/testing/validator/src/main/resources/expected-data-template/eks/aws-sdk-call-trace.mustache deleted file mode 100644 index 44d00db7a0..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/aws-sdk-call-trace.mustache +++ /dev/null @@ -1,65 +0,0 @@ -[{ - "name": "^{{serviceName}}$", - "http": { - "request": { - "url": "^{{endpoint}}/aws-sdk-call$", - "method": "^GET$" - }, - "response": { - "status": "^200$" - } - }, - "aws": { - "account_id": "^{{accountId}}$" - }, - "annotations": { - "aws_local_service": "^{{serviceName}}$", - "HostedIn_K8s_Namespace": "^{{appNamespace}}$", - "HostedIn_EKS_Cluster": "^{{platformInfo}}$", - "aws_local_operation": "^GET /aws-sdk-call$" - }, - "metadata": { - "default": { - "otel.resource.K8s.Workload": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "otel.resource.K8s.Node": "^i-[A-Za-z0-9]{17}$", - "otel.resource.K8s.Pod": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "aws.span.kind": "^LOCAL_ROOT$" - } - }, - "subsegments": [ - { - "subsegments": [ - { - "name": "^S3$", - "http": { - "request": { - "url": "^https://e2e-test-bucket-name.s3.{{region}}.amazonaws.com\\?location$", - "method": "^GET$" - } - }, - "annotations": { - "HostedIn_K8s_Namespace": "^{{appNamespace}}$", - "HostedIn_EKS_Cluster": "^{{platformInfo}}$", - "aws_local_service": "^{{serviceName}}$", - "aws_local_operation": "^GET /aws-sdk-call$", - "aws_remote_service": "^AWS\\.SDK\\.S3$", - "aws_remote_operation": "GetBucketLocation", - "aws_remote_target": "::s3:::e2e-test-bucket-name" - }, - "metadata": { - "default": { - "aws.span.kind": "^CLIENT$" - } - }, - "namespace": "^aws$" - } - ] - } - ] -}, -{ - "name": "^S3$", - "aws": { - "operation": "^GetBucketLocation$" - } -}] \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/eks/client-call-log.mustache b/testing/validator/src/main/resources/expected-data-template/eks/client-call-log.mustache deleted file mode 100644 index 663cbcb419..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/client-call-log.mustache +++ /dev/null @@ -1,35 +0,0 @@ -[{ - "HostedIn.EKS.Cluster": "^{{platformInfo}}$", - "HostedIn.K8s.Namespace": "^{{appNamespace}}$", - "K8s.Node": "^i-[A-Za-z0-9]{17}$", - "K8s.Pod": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$", - "K8s.Workload": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$", - "Operation": "InternalOperation", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "aws.span.kind": "^LOCAL_ROOT$" -}, -{ - "HostedIn.EKS.Cluster": "^{{platformInfo}}$", - "HostedIn.K8s.Namespace": "^{{appNamespace}}$", - "K8s.Node": "^i-[A-Za-z0-9]{17}$", - "K8s.Pod": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$", - "K8s.Workload": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$", - "Operation": "InternalOperation", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "aws.span.kind": "^LOCAL_ROOT$" -}, -{ - "HostedIn.EKS.Cluster": "^{{platformInfo}}$", - "HostedIn.K8s.Namespace": "^{{appNamespace}}$", - "K8s.Node": "^i-[A-Za-z0-9]{17}$", - "K8s.Pod": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$", - "K8s.Workload": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$", - "Operation": "InternalOperation", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "RemoteService": "local-root-client-call", - "RemoteOperation": "GET /", - "aws.span.kind": "^CLIENT$" -}] \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/eks/client-call-metric.mustache b/testing/validator/src/main/resources/expected-data-template/eks/client-call-metric.mustache deleted file mode 100644 index 1e765267f1..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/client-call-metric.mustache +++ /dev/null @@ -1,323 +0,0 @@ -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: GET /client-call - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: local-root-client-call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: GET /client-call - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: local-root-client-call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: GET /client-call - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Operation - value: InternalOperation - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: local-root-client-call - - - name: RemoteOperation - value: GET / - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: local-root-client-call \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/eks/client-call-trace.mustache b/testing/validator/src/main/resources/expected-data-template/eks/client-call-trace.mustache deleted file mode 100644 index bbe92619a2..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/client-call-trace.mustache +++ /dev/null @@ -1,57 +0,0 @@ -[{ - "name": "^{{serviceName}}$", - "annotations": { - "aws_local_service": "^{{serviceName}}$", - "HostedIn_K8s_Namespace": "^{{appNamespace}}$", - "HostedIn_EKS_Cluster": "^{{platformInfo}}$", - "aws_local_operation": "^InternalOperation$" - }, - "metadata": { - "default": { - "otel.resource.K8s.Workload": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "otel.resource.K8s.Node": "^i-[A-Za-z0-9]{17}$", - "otel.resource.K8s.Pod": "^sample-app-deployment(-[A-Za-z0-9]*)*$" - } - }, - "subsegments": [ - { - "name": "^local-root-client-call$", - "http": { - "request": { - "url": "^http://local-root-client-call$", - "method": "^GET$" - } - }, - "annotations": { - "HostedIn_K8s_Namespace": "^{{appNamespace}}$", - "HostedIn_EKS_Cluster": "^{{platformInfo}}$", - "aws_local_service": "^{{serviceName}}$", - "aws_local_operation": "^InternalOperation$", - "aws_remote_service": "^local-root-client-call$", - "aws_remote_operation": "GET /" - }, - "metadata": { - "default": { - "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/testing/validator/src/main/resources/expected-data-template/eks/outgoing-http-call-log.mustache b/testing/validator/src/main/resources/expected-data-template/eks/outgoing-http-call-log.mustache deleted file mode 100644 index 9aade3d2ad..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/outgoing-http-call-log.mustache +++ /dev/null @@ -1,25 +0,0 @@ -[{ - "HostedIn.EKS.Cluster": "^{{platformInfo}}$", - "HostedIn.K8s.Namespace": "^{{appNamespace}}$", - "K8s.Node": "^i-[A-Za-z0-9]{17}$", - "K8s.Pod": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "K8s.Workload": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "Operation": "GET /outgoing-http-call", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "aws.span.kind": "^LOCAL_ROOT$" -}, -{ - "HostedIn.EKS.Cluster": "^{{platformInfo}}$", - "HostedIn.K8s.Namespace": "^{{appNamespace}}$", - "K8s.Node": "^i-[A-Za-z0-9]{17}$", - "K8s.Pod": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "K8s.Workload": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "Operation": "GET /outgoing-http-call", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "RemoteService": "www.amazon.com", - "RemoteOperation": "GET /", - "aws.span.kind": "^CLIENT$" -}] - diff --git a/testing/validator/src/main/resources/expected-data-template/eks/outgoing-http-call-metric.mustache b/testing/validator/src/main/resources/expected-data-template/eks/outgoing-http-call-metric.mustache deleted file mode 100644 index e797b8140d..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/outgoing-http-call-metric.mustache +++ /dev/null @@ -1,272 +0,0 @@ -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: www.amazon.com - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: www.amazon.com - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /outgoing-http-call - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET / - - - name: RemoteService - value: www.amazon.com - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: www.amazon.com \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/eks/outgoing-http-call-trace.mustache b/testing/validator/src/main/resources/expected-data-template/eks/outgoing-http-call-trace.mustache deleted file mode 100644 index 612e795b77..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/outgoing-http-call-trace.mustache +++ /dev/null @@ -1,61 +0,0 @@ -[{ - "name": "^{{serviceName}}$", - "http": { - "request": { - "url": "^{{endpoint}}/outgoing-http-call$", - "method": "^GET$" - }, - "response": { - "status": "^200$" - } - }, - "aws": { - "account_id": "^{{accountId}}$" - }, - "annotations": { - "aws_local_service": "^{{serviceName}}$", - "HostedIn_K8s_Namespace": "^{{appNamespace}}$", - "HostedIn_EKS_Cluster": "^{{platformInfo}}$", - "aws_local_operation": "^GET /outgoing-http-call$" - }, - "metadata": { - "default": { - "otel.resource.K8s.Workload": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "otel.resource.K8s.Node": "^i-[A-Za-z0-9]{17}$", - "otel.resource.K8s.Pod": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "aws.span.kind": "^LOCAL_ROOT$" - } - }, - "subsegments": [ - { - "subsegments": [ - { - "name": "^www.amazon.com$", - "http": { - "request": { - "url": "^https://www.amazon.com$", - "method": "^GET$" - } - }, - "annotations": { - "HostedIn_K8s_Namespace": "^{{appNamespace}}$", - "HostedIn_EKS_Cluster": "^{{platformInfo}}$", - "aws_local_service": "^{{serviceName}}$", - "aws_local_operation": "^GET /outgoing-http-call$", - "aws_remote_service": "^www.amazon.com$", - "aws_remote_operation": "^GET /$" - }, - "metadata": { - "default": { - "aws.span.kind": "^CLIENT$" - } - }, - "namespace": "^remote$" - } - ] - } - ] -}, -{ - "name": "^www.amazon.com$" -}] diff --git a/testing/validator/src/main/resources/expected-data-template/eks/remote-service-log.mustache b/testing/validator/src/main/resources/expected-data-template/eks/remote-service-log.mustache deleted file mode 100644 index cb65f540a8..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/remote-service-log.mustache +++ /dev/null @@ -1,25 +0,0 @@ -[{ - "HostedIn.EKS.Cluster": "^{{platformInfo}}$", - "HostedIn.K8s.Namespace": "^{{appNamespace}}$", - "K8s.Node": "^i-[A-Za-z0-9]{17}$", - "K8s.Pod": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "K8s.Workload": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "Operation": "GET /remote-service", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "aws.span.kind": "^LOCAL_ROOT$" -}, -{ - "HostedIn.EKS.Cluster": "^{{platformInfo}}$", - "HostedIn.K8s.Namespace": "^{{appNamespace}}$", - "K8s.RemoteNamespace": "^{{appNamespace}}$", - "K8s.Node": "^i-[A-Za-z0-9]{17}$", - "K8s.Pod": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "K8s.Workload": "^sample-app-deployment(-[A-Za-z0-9]*)*$", - "Operation": "GET /remote-service", - "OTelLib": "^AwsSpanMetricsProcessor$", - "Version": "^1$", - "RemoteService": "{{remoteServiceDeploymentName}}", - "RemoteOperation": "GET /healthcheck", - "aws.span.kind": "^CLIENT$" -}] \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/eks/remote-service-metric.mustache b/testing/validator/src/main/resources/expected-data-template/eks/remote-service-metric.mustache deleted file mode 100644 index a69bb49466..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/remote-service-metric.mustache +++ /dev/null @@ -1,596 +0,0 @@ -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: Operation - value: GET /healthcheck - - - name: Service - value: {{remoteServiceDeploymentName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{remoteServiceDeploymentName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: K8s.RemoteNamespace - value: {{appNamespace}} - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - - - name: Service - value: {{serviceName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: K8s.RemoteNamespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - - - name: Service - value: {{serviceName}} - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: K8s.RemoteNamespace - value: {{appNamespace}} - - - name: Operation - value: GET /remote-service - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - - - name: Service - value: {{serviceName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: Operation - value: GET /healthcheck - - - name: Service - value: {{remoteServiceDeploymentName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{remoteServiceDeploymentName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: K8s.RemoteNamespace - value: {{appNamespace}} - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - - - name: Service - value: {{serviceName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: K8s.RemoteNamespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - - - name: Service - value: {{serviceName}} - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: K8s.RemoteNamespace - value: {{appNamespace}} - - - name: Operation - value: GET /remote-service - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - - - name: Service - value: {{serviceName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET /remote-service - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: Operation - value: GET /healthcheck - - - name: Service - value: {{remoteServiceDeploymentName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{remoteServiceDeploymentName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: K8s.RemoteNamespace - value: {{appNamespace}} - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - - - name: Service - value: {{serviceName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: K8s.RemoteNamespace - value: {{appNamespace}} - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - - - name: Service - value: {{serviceName}} - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: HostedIn.EKS.Cluster - value: {{platformInfo}} - - - name: HostedIn.K8s.Namespace - value: {{appNamespace}} - - - name: K8s.RemoteNamespace - value: {{appNamespace}} - - - name: Operation - value: GET /remote-service - - - name: RemoteOperation - value: GET /healthcheck - - - name: RemoteService - value: {{remoteServiceDeploymentName}} - - - name: Service - value: {{serviceName}} \ No newline at end of file diff --git a/testing/validator/src/main/resources/expected-data-template/eks/remote-service-trace.mustache b/testing/validator/src/main/resources/expected-data-template/eks/remote-service-trace.mustache deleted file mode 100644 index ca004a5c40..0000000000 --- a/testing/validator/src/main/resources/expected-data-template/eks/remote-service-trace.mustache +++ /dev/null @@ -1,91 +0,0 @@ -[{ - "name": "^{{serviceName}}$", - "http": { - "request": { - "url": "^{{endpoint}}/remote-service\\?ip=(([0-9]{1,3}.){3}[0-9]{1,3})/$", - "method": "^GET$" - }, - "response": { - "status": "^200$" - } - }, - "aws": { - "account_id": "^{{accountId}}$" - }, - "annotations": { - "aws_local_service": "^{{serviceName}}$", - "HostedIn_K8s_Namespace": "^{{appNamespace}}$", - "HostedIn_EKS_Cluster": "^{{platformInfo}}$", - "aws_local_operation": "^GET /remote-service$" - }, - "metadata": { - "default": { - "otel.resource.K8s.Workload": "^sample-app-deployment-{{testingId}}$", - "otel.resource.K8s.Node": "^i-[A-Za-z0-9]{17}$", - "otel.resource.K8s.Pod": "^sample-app-deployment(-[A-Za-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$" - }, - "metadata": { - "default": { - "aws.span.kind": "^CLIENT$" - } - }, - "namespace": "^remote$" - } - ] - } - ] -}, -{ - "name": "^{{remoteServiceDeploymentName}}$", - "http": { - "request": { - "url": "^http://(([0-9]{1,3}.){3}[0-9]{1,3}):8080/healthcheck$", - "method": "^GET$" - } - }, - "annotations": { - "aws_local_service": "^{{remoteServiceDeploymentName}}$", - "HostedIn_K8s_Namespace": "^{{appNamespace}}$", - "HostedIn_EKS_Cluster": "^{{platformInfo}}$", - "aws_local_operation": "^GET /healthcheck$" - }, - "metadata": { - "default": { - "otel.resource.K8s.Workload": "^{{remoteServiceDeploymentName}}$", - "otel.resource.K8s.Node": "^i-[A-Za-z0-9]{17}$", - "otel.resource.K8s.Pod": "^{{remoteServiceDeploymentName}}(-[A-Za-z0-9]*)*$", - "aws.span.kind": "^LOCAL_ROOT$" - } - }, - "subsegments": [ - { - "name": "^RemoteServiceController.healthcheck$", - "annotations": { - "HostedIn_K8s_Namespace": "^sample-app-namespace$", - "HostedIn_EKS_Cluster": "^{{platformInfo}}$", - "aws_local_operation": "^GET /healthcheck$" - } - } - ] -}] - - diff --git a/testing/validator/src/main/resources/log4j2.xml b/testing/validator/src/main/resources/log4j2.xml deleted file mode 100644 index 35a6a3ccdf..0000000000 --- a/testing/validator/src/main/resources/log4j2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/testing/validator/src/main/resources/validations/ec2/log-validation.yml b/testing/validator/src/main/resources/validations/ec2/log-validation.yml deleted file mode 100644 index 8770ee8fa6..0000000000 --- a/testing/validator/src/main/resources/validations/ec2/log-validation.yml +++ /dev/null @@ -1,25 +0,0 @@ -- - validationType: "cw-log" - httpPath: "/outgoing-http-call" - httpMethod: "get" - callingType: "http" - expectedLogStructureTemplate: "EC2_OUTGOING_HTTP_CALL_LOG" -- - validationType: "cw-log" - httpPath: "/aws-sdk-call" - httpMethod: "get" - callingType: "http" - expectedLogStructureTemplate: "EC2_AWS_SDK_CALL_LOG" -- - validationType: "cw-log" - httpPath: "/remote-service" - httpMethod: "get" - callingType: "http-with-body" - expectedLogStructureTemplate: "EC2_REMOTE_SERVICE_LOG" -- - validationType: "cw-log" - httpPath: "/client-call" - httpMethod: "get" - callingType: "http" - expectedLogStructureTemplate: "EC2_CLIENT_CALL_LOG" - diff --git a/testing/validator/src/main/resources/validations/ec2/metric-validation.yml b/testing/validator/src/main/resources/validations/ec2/metric-validation.yml deleted file mode 100644 index 98f1595ad1..0000000000 --- a/testing/validator/src/main/resources/validations/ec2/metric-validation.yml +++ /dev/null @@ -1,25 +0,0 @@ -- - validationType: "cw-metric" - httpPath: "/outgoing-http-call" - httpMethod: "get" - callingType: "http" - expectedMetricTemplate: "EC2_OUTGOING_HTTP_CALL_METRIC" -- - validationType: "cw-metric" - httpPath: "/aws-sdk-call" - httpMethod: "get" - callingType: "http" - expectedMetricTemplate: "EC2_AWS_SDK_CALL_METRIC" -- - validationType: "cw-metric" - httpPath: "/remote-service" - httpMethod: "get" - callingType: "http-with-body" - expectedMetricTemplate: "EC2_REMOTE_SERVICE_METRIC" -- - validationType: "cw-metric" - httpPath: "/client-call" - httpMethod: "get" - callingType: "http" - expectedMetricTemplate: "EC2_CLIENT_CALL_METRIC" - diff --git a/testing/validator/src/main/resources/validations/ec2/trace-validation.yml b/testing/validator/src/main/resources/validations/ec2/trace-validation.yml deleted file mode 100644 index 2486b5c3cd..0000000000 --- a/testing/validator/src/main/resources/validations/ec2/trace-validation.yml +++ /dev/null @@ -1,24 +0,0 @@ -- - validationType: "trace" - httpPath: "/outgoing-http-call" - httpMethod: "get" - callingType: "http" - expectedTraceTemplate: "EC2_OUTGOING_HTTP_CALL_TRACE" -- - validationType: "trace" - httpPath: "/aws-sdk-call" - httpMethod: "get" - callingType: "http" - expectedTraceTemplate: "EC2_AWS_SDK_CALL_TRACE" -- - validationType: "trace" - httpPath: "/remote-service" - httpMethod: "get" - callingType: "http-with-body" - expectedTraceTemplate: "EC2_REMOTE_SERVICE_TRACE" -- - validationType: "trace" - httpPath: "/client-call" - httpMethod: "get" - callingType: "http" - expectedTraceTemplate: "EC2_CLIENT_CALL_TRACE" \ No newline at end of file diff --git a/testing/validator/src/main/resources/validations/eks/log-validation.yml b/testing/validator/src/main/resources/validations/eks/log-validation.yml deleted file mode 100644 index 427ed0adb9..0000000000 --- a/testing/validator/src/main/resources/validations/eks/log-validation.yml +++ /dev/null @@ -1,24 +0,0 @@ -- - validationType: "cw-log" - httpPath: "/outgoing-http-call" - httpMethod: "get" - callingType: "http" - expectedLogStructureTemplate: "EKS_OUTGOING_HTTP_CALL_LOG" -- - validationType: "cw-log" - httpPath: "/aws-sdk-call" - httpMethod: "get" - callingType: "http" - expectedLogStructureTemplate: "EKS_AWS_SDK_CALL_LOG" -- - validationType: "cw-log" - httpPath: "/remote-service" - httpMethod: "get" - callingType: "http-with-body" - expectedLogStructureTemplate: "EKS_REMOTE_SERVICE_LOG" -- - validationType: "cw-log" - httpPath: "/client-call" - httpMethod: "get" - callingType: "http" - expectedLogStructureTemplate: "EKS_CLIENT_CALL_LOG" \ No newline at end of file diff --git a/testing/validator/src/main/resources/validations/eks/metric-validation.yml b/testing/validator/src/main/resources/validations/eks/metric-validation.yml deleted file mode 100644 index dde79819cd..0000000000 --- a/testing/validator/src/main/resources/validations/eks/metric-validation.yml +++ /dev/null @@ -1,24 +0,0 @@ -- - validationType: "cw-metric" - httpPath: "/outgoing-http-call" - httpMethod: "get" - callingType: "http" - expectedMetricTemplate: "EKS_OUTGOING_HTTP_CALL_METRIC" -- - validationType: "cw-metric" - httpPath: "/aws-sdk-call" - httpMethod: "get" - callingType: "http" - expectedMetricTemplate: "EKS_AWS_SDK_CALL_METRIC" -- - validationType: "cw-metric" - httpPath: "/remote-service" - httpMethod: "get" - callingType: "http-with-body" - expectedMetricTemplate: "EKS_REMOTE_SERVICE_METRIC" -- - validationType: "cw-metric" - httpPath: "/client-call" - httpMethod: "get" - callingType: "http" - expectedMetricTemplate: "EKS_CLIENT_CALL_METRIC" diff --git a/testing/validator/src/main/resources/validations/eks/trace-validation.yml b/testing/validator/src/main/resources/validations/eks/trace-validation.yml deleted file mode 100644 index 160b711ec5..0000000000 --- a/testing/validator/src/main/resources/validations/eks/trace-validation.yml +++ /dev/null @@ -1,24 +0,0 @@ -- - validationType: "trace" - httpPath: "/outgoing-http-call" - httpMethod: "get" - callingType: "http" - expectedTraceTemplate: "EKS_OUTGOING_HTTP_CALL_TRACE" -- - validationType: "trace" - httpPath: "/aws-sdk-call" - httpMethod: "get" - callingType: "http" - expectedTraceTemplate: "EKS_AWS_SDK_CALL_TRACE" -- - validationType: "trace" - httpPath: "/remote-service" - httpMethod: "get" - callingType: "http-with-body" - expectedTraceTemplate: "EKS_REMOTE_SERVICE_TRACE" -- - validationType: "trace" - httpPath: "/client-call" - httpMethod: "get" - callingType: "http" - expectedTraceTemplate: "EKS_CLIENT_CALL_TRACE" \ No newline at end of file diff --git a/testing/validator/src/test/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplateTest.java b/testing/validator/src/test/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplateTest.java deleted file mode 100644 index c64db6dcc6..0000000000 --- a/testing/validator/src/test/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplateTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.fileconfigs; - -import java.io.IOException; -import java.net.URL; -import org.apache.commons.io.IOUtils; -import org.junit.jupiter.api.Test; - -public class PredefinedExpectedTemplateTest { - @Test - public void ensureTemplatesAreExisting() throws IOException { - for (PredefinedExpectedTemplate predefinedExpectedTemplate : - PredefinedExpectedTemplate.values()) { - URL path = predefinedExpectedTemplate.getPath(); - // also check if tostring can return a valid filepath - IOUtils.toString(new URL(path.toString())); - } - } -} diff --git a/testing/validator/src/test/java/com/amazon/aoc/helpers/SortUtilsTest.java b/testing/validator/src/test/java/com/amazon/aoc/helpers/SortUtilsTest.java deleted file mode 100644 index 0c1d93b172..0000000000 --- a/testing/validator/src/test/java/com/amazon/aoc/helpers/SortUtilsTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.helpers; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.amazon.aoc.models.xray.Entity; -import java.util.ArrayList; -import java.util.List; -import org.junit.jupiter.api.Test; - -public class SortUtilsTest { - - @Test - public void testSingleLevelListSort() { - final List generated = generateEntities(3); - final List entities = new ArrayList<>(); - entities.add(0, generated.get(1)); - entities.add(1, generated.get(2)); - entities.add(2, generated.get(0)); - - // Verify list is unsorted - assertEquals(generated.get(1), entities.get(0)); - assertEquals(generated.get(2), entities.get(1)); - assertEquals(generated.get(0), entities.get(2)); - SortUtils.recursiveEntitySort(entities); - - assertEquals(3, entities.size()); - assertEquals(generated.get(0), entities.get(0)); - assertEquals(generated.get(1), entities.get(1)); - assertEquals(generated.get(2), entities.get(2)); - } - - /** - * Expected entity structure of this test after sorting. - * - *

ent0 ent1 ent2 | ent3 ent4 ent5 | ent6 ent7 - */ - @Test - public void testNestedEntitySort() { - final List generated = generateEntities(8); - final List topEntities = new ArrayList<>(); - final List midEntities = new ArrayList<>(); - final List bottomEntities = new ArrayList<>(); - - topEntities.add(0, generated.get(1)); - topEntities.add(1, generated.get(2)); - topEntities.add(2, generated.get(0)); - midEntities.add(0, generated.get(5)); - midEntities.add(1, generated.get(4)); - midEntities.add(2, generated.get(3)); - bottomEntities.add(0, generated.get(7)); - bottomEntities.add(1, generated.get(6)); - - generated.get(0).setSubsegments(midEntities); - generated.get(4).setSubsegments(bottomEntities); - - SortUtils.recursiveEntitySort(topEntities); - - assertEquals(3, topEntities.size()); - assertEquals(generated.get(0), topEntities.get(0)); - assertEquals(generated.get(1), topEntities.get(1)); - assertEquals(generated.get(2), topEntities.get(2)); - assertEquals(3, topEntities.get(0).getSubsegments().size()); - assertEquals(midEntities, topEntities.get(0).getSubsegments()); - assertEquals(generated.get(3), midEntities.get(0)); - assertEquals(generated.get(4), midEntities.get(1)); - assertEquals(generated.get(5), midEntities.get(2)); - assertEquals(2, midEntities.get(1).getSubsegments().size()); - assertEquals(midEntities.get(1).getSubsegments(), bottomEntities); - assertEquals(generated.get(6), bottomEntities.get(0)); - assertEquals(generated.get(7), bottomEntities.get(1)); - } - - @Test - public void testInfiniteLoop() { - Entity current = new Entity(); - List entityList = new ArrayList<>(); - entityList.add(current); - current.setSubsegments(entityList); // set up an infinite children loop - - SortUtils.recursiveEntitySort(entityList); - - // Not really testing anything, just making sure we don't infinite loop - assertEquals(1, entityList.size()); - } - - private List generateEntities(int n) { - List ret = new ArrayList<>(); - - for (int i = 0; i < n; i++) { - Entity entity = new Entity(); - entity.setStartTime(i); - ret.add(entity); - } - - return ret; - } -} diff --git a/testing/validator/src/test/java/com/amazon/aoc/validators/CWMetricValidatorTest.java b/testing/validator/src/test/java/com/amazon/aoc/validators/CWMetricValidatorTest.java deleted file mode 100644 index 2e750c703c..0000000000 --- a/testing/validator/src/test/java/com/amazon/aoc/validators/CWMetricValidatorTest.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. - * - * 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://aws.amazon.com/apache2.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. - */ - -package com.amazon.aoc.validators; - -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import com.amazon.aoc.callers.HttpCaller; -import com.amazon.aoc.exception.BaseException; -import com.amazon.aoc.fileconfigs.LocalPathExpectedTemplate; -import com.amazon.aoc.helpers.CWMetricHelper; -import com.amazon.aoc.models.Context; -import com.amazon.aoc.models.SampleAppResponse; -import com.amazon.aoc.models.ValidationConfig; -import com.amazon.aoc.services.CloudWatchService; -import com.amazonaws.services.cloudwatch.model.Metric; -import java.util.List; -import org.assertj.core.util.Lists; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledIf; - -/** - * This class covers the tests for CWMetricValidator. Tests are not run for Windows, due to file - * path differences. - */ -@DisabledIf("isWindows") -public class CWMetricValidatorTest { - private CWMetricHelper cwMetricHelper = new CWMetricHelper(); - private static final String SERVICE_DIMENSION = "Service"; - private static final String REMOTE_SERVICE_DIMENSION = "RemoteService"; - private static final String TEMPLATE_ROOT = - "file://" + System.getProperty("user.dir") + "/src/test/test-resources/"; - private static final String SERVICE_NAME = "serviceName"; - private static final String REMOTE_SERVICE_NAME = "remoteServiceName"; - private static final String REMOTE_SERVICE_DEPLOYMENT_NAME = "remoteServiceDeploymentName"; - - private Context context; - private HttpCaller httpCaller; - - static boolean isWindows() { - return System.getProperty("os.name").toLowerCase().startsWith("win"); - } - - @BeforeEach - public void setUp() throws Exception { - context = initContext(); - httpCaller = mockHttpCaller("traceId"); - } - - /** - * test validation with local file path template file. - * - * @throws Exception when test fails - */ - @Test - public void testValidationSucceedWithCustomizedFilePath() throws Exception { - ValidationConfig validationConfig = - initValidationConfig(TEMPLATE_ROOT + "endToEnd_expectedMetrics.mustache"); - runBasicValidation(validationConfig); - } - - /** - * test validation with enum template. - * - * @throws Exception when test fails - */ - @Test - public void testValidationSucceed() throws Exception { - ValidationConfig validationConfig = initValidationConfig("EKS_OUTGOING_HTTP_CALL_METRIC"); - runBasicValidation(validationConfig); - } - - @Test - public void testValidateEndToEnd_Success() throws Exception { - ValidationConfig validationConfig = - initValidationConfig(TEMPLATE_ROOT + "endToEnd_expectedMetrics.mustache"); - - List localServiceMetrics = getTestMetrics("endToEnd_localMetricsWithService"); - List remoteServiceMetrics = getTestMetrics("endToEnd_remoteMetricsWithService"); - List remoteMetricsWithRemoteApp = getTestMetrics("endToEnd_remoteMetricsWithRemoteApp"); - List remoteMetricsWithAmazon = getTestMetrics("endToEnd_remoteMetricsWithAmazon"); - List remoteMetricsWithAwsSdk = getTestMetrics("endToEnd_remoteMetricsWithAwsSdk"); - - CloudWatchService cloudWatchService = - mockCloudWatchService( - localServiceMetrics, - remoteServiceMetrics, - remoteMetricsWithRemoteApp, - remoteMetricsWithAmazon, - remoteMetricsWithAwsSdk); - - validate(validationConfig, cloudWatchService); - } - - @Test - public void testValidateEndToEnd_MissingRemoteService() throws Exception { - ValidationConfig validationConfig = - initValidationConfig(TEMPLATE_ROOT + "endToEnd_expectedMetrics.mustache"); - - List localServiceMetrics = getTestMetrics("endToEnd_localMetricsWithService"); - List remoteServiceMetrics = getTestMetrics("endToEnd_remoteMetricsWithService"); - // Skip remoteMetricsWithRemoteApp, which contains the [RemoteService] rollup. - List remoteMetricsWithRemoteApp = Lists.newArrayList(); - List remoteMetricsWithAmazon = getTestMetrics("endToEnd_remoteMetricsWithAmazon"); - List remoteMetricsWithAwsSdk = getTestMetrics("endToEnd_remoteMetricsWithAwsSdk"); - - CloudWatchService cloudWatchService = - mockCloudWatchService( - localServiceMetrics, - remoteServiceMetrics, - remoteMetricsWithRemoteApp, - remoteMetricsWithAmazon, - remoteMetricsWithAwsSdk); - - try { - validate(validationConfig, cloudWatchService); - } catch (BaseException be) { - String actualMessage = be.getMessage(); - String expectedMessage = - "toBeCheckedMetricList: {Namespace: metricNamespace,MetricName: metricName,Dimensions: [{Name: RemoteService,Value: " - + REMOTE_SERVICE_DEPLOYMENT_NAME - + "}]} is not found in"; - assertTrue(actualMessage.contains(expectedMessage), actualMessage); - } - } - - private Context initContext() { - // fake vars - String testingId = "testingId"; - String region = "region"; - String namespace = "metricNamespace"; - - // faked context - Context context = new Context(testingId, region, false, false); - context.setMetricNamespace(namespace); - context.setServiceName(SERVICE_NAME); - context.setRemoteServiceName(REMOTE_SERVICE_NAME); - context.setRemoteServiceDeploymentName(REMOTE_SERVICE_DEPLOYMENT_NAME); - return context; - } - - private HttpCaller mockHttpCaller(String traceId) throws Exception { - HttpCaller httpCaller = mock(HttpCaller.class); - SampleAppResponse sampleAppResponse = new SampleAppResponse(); - sampleAppResponse.setTraceId(traceId); - when(httpCaller.callSampleApp()).thenReturn(sampleAppResponse); - return httpCaller; - } - - private List getTestMetrics(String fileName) throws Exception { - String localServiceTemplate = TEMPLATE_ROOT + fileName + ".mustache"; - return cwMetricHelper.listExpectedMetrics( - context, new LocalPathExpectedTemplate(localServiceTemplate), httpCaller); - } - - private CloudWatchService mockCloudWatchService( - List localServiceMetrics, - List remoteServiceMetrics, - List remoteMetricsWithRemoteApp, - List remoteMetricsWithAmazon, - List remoteMetricsWithAwsSdk) { - CloudWatchService cloudWatchService = mock(CloudWatchService.class); - when(cloudWatchService.listMetrics(any(), any(), eq(SERVICE_DIMENSION), eq(SERVICE_NAME))) - .thenReturn(localServiceMetrics); - when(cloudWatchService.listMetrics( - any(), any(), eq(SERVICE_DIMENSION), eq(REMOTE_SERVICE_NAME))) - .thenReturn(remoteServiceMetrics); - when(cloudWatchService.listMetrics( - any(), any(), eq(REMOTE_SERVICE_DIMENSION), eq(REMOTE_SERVICE_DEPLOYMENT_NAME))) - .thenReturn(remoteMetricsWithRemoteApp); - when(cloudWatchService.listMetrics( - any(), any(), eq(REMOTE_SERVICE_DIMENSION), eq("www.amazon.com"))) - .thenReturn(remoteMetricsWithAmazon); - when(cloudWatchService.listMetrics( - any(), any(), eq(REMOTE_SERVICE_DIMENSION), eq("AWS.SDK.S3"))) - .thenReturn(remoteMetricsWithAwsSdk); - return cloudWatchService; - } - - private ValidationConfig initValidationConfig(String metricTemplate) { - ValidationConfig validationConfig = new ValidationConfig(); - validationConfig.setCallingType("http"); - validationConfig.setExpectedMetricTemplate(metricTemplate); - return validationConfig; - } - - private void runBasicValidation(ValidationConfig validationConfig) throws Exception { - // fake vars - String traceId = "fakedtraceid"; - - // fake and mock a cloudwatch service - List metrics = - cwMetricHelper.listExpectedMetrics( - context, validationConfig.getExpectedMetricTemplate(), httpCaller); - CloudWatchService cloudWatchService = mock(CloudWatchService.class); - - // mock listMetrics - when(cloudWatchService.listMetrics(any(), any(), any(), any())).thenReturn(metrics); - - // start validation - validate(validationConfig, cloudWatchService); - } - - private void validate(ValidationConfig validationConfig, CloudWatchService cloudWatchService) - throws Exception { - CWMetricValidator validator = new CWMetricValidator(); - validator.init( - context, validationConfig, httpCaller, validationConfig.getExpectedMetricTemplate()); - validator.setCloudWatchService(cloudWatchService); - validator.setMaxRetryCount(1); - validator.validate(); - } -} diff --git a/testing/validator/src/test/test-resources/endToEnd_expectedMetrics.mustache b/testing/validator/src/test/test-resources/endToEnd_expectedMetrics.mustache deleted file mode 100644 index 331d6620c9..0000000000 --- a/testing/validator/src/test/test-resources/endToEnd_expectedMetrics.mustache +++ /dev/null @@ -1,87 +0,0 @@ -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Operation - value: operationName - - - name: Service - value: serviceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Service - value: serviceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Operation - value: operationName - - - name: Service - value: serviceName - - - name: RemoteOperation - value: remoteOperationName - - - name: RemoteService - value: remoteServiceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Service - value: serviceName - - - name: RemoteOperation - value: remoteOperationName - - - name: RemoteService - value: remoteServiceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Service - value: serviceName - - - name: RemoteService - value: remoteServiceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Operation - value: operationName - - - name: Service - value: remoteServiceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Service - value: remoteServiceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: RemoteService - value: remoteServiceDeploymentName \ No newline at end of file diff --git a/testing/validator/src/test/test-resources/endToEnd_localMetricsWithService.mustache b/testing/validator/src/test/test-resources/endToEnd_localMetricsWithService.mustache deleted file mode 100644 index 1a1d429077..0000000000 --- a/testing/validator/src/test/test-resources/endToEnd_localMetricsWithService.mustache +++ /dev/null @@ -1,60 +0,0 @@ -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Operation - value: operationName - - - name: Service - value: serviceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Service - value: serviceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Operation - value: operationName - - - name: Service - value: serviceName - - - name: RemoteOperation - value: remoteOperationName - - - name: RemoteService - value: remoteServiceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Service - value: serviceName - - - name: RemoteOperation - value: remoteOperationName - - - name: RemoteService - value: remoteServiceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Service - value: serviceName - - - name: RemoteService - value: remoteServiceName \ No newline at end of file diff --git a/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithAmazon.mustache b/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithAmazon.mustache deleted file mode 100644 index 4415579a23..0000000000 --- a/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithAmazon.mustache +++ /dev/null @@ -1,7 +0,0 @@ -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: RemoteService - value: www.amazon.com \ No newline at end of file diff --git a/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithAwsSdk.mustache b/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithAwsSdk.mustache deleted file mode 100644 index 582051f89d..0000000000 --- a/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithAwsSdk.mustache +++ /dev/null @@ -1,7 +0,0 @@ -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: RemoteService - value: AWS.SDK.S3 \ No newline at end of file diff --git a/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithRemoteApp.mustache b/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithRemoteApp.mustache deleted file mode 100644 index 10847f3bb8..0000000000 --- a/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithRemoteApp.mustache +++ /dev/null @@ -1,7 +0,0 @@ -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: RemoteService - value: remoteServiceDeploymentName \ No newline at end of file diff --git a/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithService.mustache b/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithService.mustache deleted file mode 100644 index 51d4c5c85a..0000000000 --- a/testing/validator/src/test/test-resources/endToEnd_remoteMetricsWithService.mustache +++ /dev/null @@ -1,18 +0,0 @@ -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Operation - value: operationName - - - name: Service - value: remoteServiceName - -- - metricName: metricName - namespace: metricNamespace - dimensions: - - - name: Service - value: remoteServiceName \ No newline at end of file