-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Application Signals] Improve metric schema for EKS, Native K8s, EC2 (#…
…1179) Co-authored-by: Harry <[email protected]> Co-authored-by: Lisa Guo <[email protected]>
- Loading branch information
1 parent
fb7f27f
commit 4193fa1
Showing
76 changed files
with
2,602 additions
and
1,314 deletions.
There are no files selected for viewing
168 changes: 168 additions & 0 deletions
168
.github/workflows/application-signals-java-e2e-ec2-asg-test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
## SPDX-License-Identifier: Apache-2.0 | ||
|
||
# This is a reusable workflow for running the E2E test for App Signals. | ||
# It is meant to be called from another workflow. | ||
# Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview | ||
name: App Signals Enablement E2E Testing - EC2 ASG Use Case | ||
on: | ||
workflow_call: | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
# The presence of this env var is required for use by terraform and AWS CLI commands | ||
# It is not redundant | ||
AWS_DEFAULT_REGION: us-east-1 | ||
APP_SIGNALS_E2E_TEST_ACCOUNT_ID: ${{ secrets.APP_SIGNALS_E2E_TEST_ACCOUNT_ID }} | ||
SAMPLE_APP_FRONTEND_SERVICE_JAR: "s3://aws-appsignals-sample-app-prod-us-east-1/main-service.jar" | ||
SAMPLE_APP_REMOTE_SERVICE_JAR: "s3://aws-appsignals-sample-app-prod-us-east-1/remote-service.jar" | ||
GET_ADOT_JAR_COMMAND: "aws s3 cp s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar ./adot.jar" | ||
GET_CW_AGENT_RPM_COMMAND: "aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ github.sha }}/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm ./cw-agent.rpm" | ||
METRIC_NAMESPACE: ApplicationSignals | ||
LOG_GROUP_NAME: /aws/application-signals/data | ||
|
||
jobs: | ||
e2e-ec2-single-asg-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get testing resources from aws-application-signals-test-framework | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: aws-observability/aws-application-signals-test-framework | ||
ref: add-ec2-platform-support | ||
|
||
- name: Generate testing id | ||
run: echo TESTING_ID="java-asg-${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: arn:aws:iam::${{ env.APP_SIGNALS_E2E_TEST_ACCOUNT_ID }}:role/${{ secrets.APP_SIGNALS_E2E_TEST_ROLE_NAME }} | ||
aws-region: ${{ env.AWS_DEFAULT_REGION }} | ||
|
||
- name: Set up terraform | ||
uses: hashicorp/setup-terraform@v3 | ||
with: | ||
terraform_wrapper: false | ||
|
||
- name: Deploy sample app via terraform | ||
working-directory: terraform/ec2/asg | ||
run: | | ||
terraform init | ||
terraform validate | ||
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 sample app and EC2 instance information | ||
working-directory: terraform/ec2/asg | ||
run: | | ||
main_service_instance_id=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names ec2-single-asg-${{ env.TESTING_ID }} --region ${{ env.AWS_DEFAULT_REGION }} --query "AutoScalingGroups[].Instances[0].InstanceId" --output text) | ||
main_service_public_ip=$(aws ec2 describe-instances --instance-ids $main_service_instance_id --region ${{ env.AWS_DEFAULT_REGION }} --query "Reservations[].Instances[].PublicIpAddress" --output text) | ||
main_service_private_dns_name=$(aws ec2 describe-instances --instance-ids $main_service_instance_id --region ${{ env.AWS_DEFAULT_REGION }} --query "Reservations[].Instances[].PrivateDnsName" --output text) | ||
echo "INSTANCE_ID=$main_service_instance_id" >> $GITHUB_ENV | ||
echo "MAIN_SERVICE_ENDPOINT=$main_service_public_ip:8080" >> $GITHUB_ENV | ||
echo "PRIVATE_DNS_NAME=$main_service_private_dns_name" >> $GITHUB_ENV | ||
echo "EC2_INSTANCE_AMI=$(terraform output ec2_instance_ami)" >> $GITHUB_ENV | ||
echo "REMOTE_SERVICE_IP=$(terraform output sample_app_remote_service_public_ip)" >> $GITHUB_ENV | ||
- 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 "http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call" | ||
curl -S -s "http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call?ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }}" | ||
curl -S -s "http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }}" | ||
curl -S -s "http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call" | ||
# Validation for pulse telemetry data | ||
- name: Validate generated EMF logs | ||
id: log-validation | ||
run: ./gradlew validator:run --args='-c java/ec2/asg/log-validation.yml | ||
--testing-id ${{ env.TESTING_ID }} | ||
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} | ||
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 | ||
--region ${{ env.AWS_DEFAULT_REGION }} | ||
--account-id ${{ env.APP_SIGNALS_E2E_TEST_ACCOUNT_ID }} | ||
--metric-namespace ${{ env.METRIC_NAMESPACE }} | ||
--log-group ${{ env.LOG_GROUP_NAME }} | ||
--service-name sample-application-${{ env.TESTING_ID }} | ||
--remote-service-name sample-remote-application-${{ env.TESTING_ID }} | ||
--instance-ami ${{ env.EC2_INSTANCE_AMI }} | ||
--platform-info ec2-single-asg-${{ env.TESTING_ID }} | ||
--instance-id ${{ env.INSTANCE_ID }} | ||
--private-dns-name ${{ env.PRIVATE_DNS_NAME }} | ||
--query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }} | ||
--rollup' | ||
|
||
- name: Validate generated metrics | ||
id: metric-validation | ||
if: (success() || steps.log-validation-1.outcome == 'failure') && !cancelled() | ||
run: ./gradlew validator:run --args='-c java/ec2/asg/metric-validation.yml | ||
--testing-id ${{ env.TESTING_ID }} | ||
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} | ||
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 | ||
--region ${{ env.AWS_DEFAULT_REGION }} | ||
--account-id ${{ env.APP_SIGNALS_E2E_TEST_ACCOUNT_ID }} | ||
--metric-namespace ${{ env.METRIC_NAMESPACE }} | ||
--log-group ${{ env.LOG_GROUP_NAME }} | ||
--service-name sample-application-${{ env.TESTING_ID }} | ||
--remote-service-name sample-remote-application-${{ env.TESTING_ID }} | ||
--instance-ami ${{ env.EC2_INSTANCE_AMI }} | ||
--platform-info ec2-single-asg-${{ env.TESTING_ID }} | ||
--instance-id ${{ env.INSTANCE_ID }} | ||
--private-dns-name ${{ env.PRIVATE_DNS_NAME }} | ||
--query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }} | ||
--rollup' | ||
|
||
- name: Validate generated traces | ||
id: trace-validation | ||
if: (success() || steps.log-validation-1.outcome == 'failure' || steps.metric-validation-1.outcome == 'failure') && !cancelled() | ||
run: ./gradlew validator:run --args='-c java/ec2/asg/trace-validation.yml | ||
--testing-id ${{ env.TESTING_ID }} | ||
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} | ||
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 | ||
--region ${{ env.AWS_DEFAULT_REGION }} | ||
--account-id ${{ env.APP_SIGNALS_E2E_TEST_ACCOUNT_ID }} | ||
--metric-namespace ${{ env.METRIC_NAMESPACE }} | ||
--log-group ${{ env.LOG_GROUP_NAME }} | ||
--service-name sample-application-${{ env.TESTING_ID }} | ||
--remote-service-name sample-remote-application-${{ env.TESTING_ID }} | ||
--instance-ami ${{ env.EC2_INSTANCE_AMI }} | ||
--platform-info ec2-single-asg-${{ env.TESTING_ID }} | ||
--instance-id ${{ env.INSTANCE_ID }} | ||
--private-dns-name ${{ env.PRIVATE_DNS_NAME }} | ||
--query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }} | ||
--rollup' | ||
|
||
# Clean up Procedures | ||
- name: Terraform destroy | ||
if: always() | ||
continue-on-error: true | ||
working-directory: terraform/ec2/asg | ||
run: | | ||
terraform destroy -auto-approve \ | ||
-var="test_id=${{ env.TESTING_ID }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.