Skip to content

Commit

Permalink
[E2E] Metric Schema Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
majanjua-amzn committed Apr 16, 2024
1 parent c9b7342 commit c799421
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 30 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/application-signals-python-e2e-ec2-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ permissions:
contents: read

env:
# The precense of this env var is required for use by terraform and AWS CLI commands
# The presence of this env var is required for use by terraform and AWS CLI commands
# It is not redundant
AWS_DEFAULT_REGION: ${{ inputs.aws-region }}
TEST_ACCOUNT: ${{ secrets.APP_SIGNALS_E2E_TEST_ACC }}
SAMPLE_APP_ZIP: s3://${{ secrets.E2E_TEST_BUCKET }}-prod-${{ inputs.aws-region }}/python-sample-app.zip
METRIC_NAMESPACE: AppSignals
LOG_GROUP_NAME: /aws/appsignals/generic
METRIC_NAMESPACE: ApplicationSignals
LOG_GROUP_NAME: /aws/application-signals/data
ADOT_WHEEL_NAME: ${{ inputs.staging_wheel_name }}
GET_ADOT_JAR_COMMAND: "aws s3api get-object --bucket metric-schema-changes --key aws-opentelemetry-agent.jar adot.jar"
GET_CW_AGENT_RPM_COMMAND: "aws s3api get-object --bucket private-cloudwatch-agent-apm-beta --key linux_amd64/amazon-cloudwatch-agent.rpm cw-agent.rpm"

jobs:
python-e2e-ec2-test:
Expand All @@ -43,10 +45,11 @@ jobs:
uses: actions/checkout@v4
with:
repository: aws-observability/aws-application-signals-test-framework
ref: main
ref: ga-python

- name: Set CW Agent RPM environment variable
run: echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
run: echo GET_CW_AGENT_RPM_COMMAND="aws s3api get-object --bucket private-cloudwatch-agent-apm-beta --key linux_amd64/amazon-cloudwatch-agent.rpm cw-agent.rpm" >> $GITHUB_ENV
# run: echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV

- name: Generate testing id
run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -81,12 +84,13 @@ jobs:
- name: Set Get ADOT Wheel command environment variable
working-directory: terraform/python/ec2
run: |
if [ ${{ inputs.caller-workflow-name }} == "main-build" ]; then
# Reusing the adot-main-build-staging-jar bucket to store the python wheel file
echo GET_ADOT_WHEEL_COMMAND="aws s3 cp s3://adot-main-build-staging-jar/${{ env.ADOT_WHEEL_NAME }} ./${{ env.ADOT_WHEEL_NAME }} && python3.9 -m pip install ${{ env.ADOT_WHEEL_NAME }}" >> $GITHUB_ENV
else
echo GET_ADOT_WHEEL_COMMAND="python3.9 -m pip install aws-opentelemetry-distro" >> $GITHUB_ENV
fi
echo GET_ADOT_WHEEL_COMMAND="aws s3api get-object --bucket metric-schema-changes --key aws_opentelemetry_distro-0.0.1.dev0-py3-none-any.whl adot_wheel.whl && python3.9 -m pip install adot_wheel.whl" >> $GITHUB_ENV
# if [ ${{ inputs.caller-workflow-name }} == "main-build" ]; then
# # Reusing the adot-main-build-staging-jar bucket to store the python wheel file
# echo GET_ADOT_WHEEL_COMMAND="aws s3 cp s3://adot-main-build-staging-jar/${{ env.ADOT_WHEEL_NAME }} ./${{ env.ADOT_WHEEL_NAME }} && python3.9 -m pip install ${{ env.ADOT_WHEEL_NAME }}" >> $GITHUB_ENV
# else
# echo GET_ADOT_WHEEL_COMMAND="python3.9 -m pip install aws-opentelemetry-distro" >> $GITHUB_ENV
# fi

- name: Initiate Terraform
uses: ./.github/workflows/actions/execute_and_retry
Expand Down Expand Up @@ -172,10 +176,10 @@ jobs:
- 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 /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call
curl -S -s /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call
curl -S -s /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}
curl -S -s /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call
# Validation for pulse telemetry data
- name: Validate generated EMF logs
Expand Down
38 changes: 23 additions & 15 deletions .github/workflows/application-signals-python-e2e-eks-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ permissions:
contents: read

env:
# The precense of this env var is required for use by terraform and AWS CLI commands
# The presence of this env var is required for use by terraform and AWS CLI commands
# It is not redundant
AWS_DEFAULT_REGION: ${{ inputs.aws-region }}
METRIC_NAMESPACE: AppSignals
LOG_GROUP_NAME: /aws/appsignals/eks
METRIC_NAMESPACE: ApplicationSignals
LOG_GROUP_NAME: /aws/application-signals/data

jobs:
python-e2e-eks-test:
Expand All @@ -44,7 +44,7 @@ jobs:
- uses: actions/checkout@v4
with:
repository: aws-observability/aws-application-signals-test-framework
ref: main
ref: ga-release
fetch-depth: 0

- name: Download enablement script
Expand Down Expand Up @@ -159,13 +159,21 @@ jobs:
${{ env.PYTHON_SAMPLE_APP_NAMESPACE }} && \
aws eks update-kubeconfig --name ${{ inputs.test-cluster-name }} --region ${{ inputs.aws-region }}"
if [ "${{ inputs.caller-workflow-name }}" == "main-build" ]; then
echo "Patching staging adot image for main build:"
execute_and_retry 2 "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-python-image=${{ inputs.application-signals-adot-image }}:${{ inputs.application-signals-adot-image-tag }}\"}]'"
execute_and_retry 2 "kubectl delete pods --all -n amazon-cloudwatch"
execute_and_retry 2 "kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch"
fi
# if [ "${{ inputs.caller-workflow-name }}" == "main-build" ]; then
# echo "Patching staging adot image for main build:"
# execute_and_retry 2 "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-python-image=${{ inputs.application-signals-adot-image }}:${{ inputs.application-signals-adot-image-tag }}\"}]'"
# execute_and_retry 2 "kubectl delete pods --all -n amazon-cloudwatch"
# execute_and_retry 2 "kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch"
# fi
echo "Patching staging adot image for main build"
execute_and_retry 2 "kubectl patch deploy -namazon-cloudwatch amazon-cloudwatch-observability-controller-manager --type='json' \
-p='[{"op": \"replace\", \"path\": \"/spec/template/spec/containers/0/args/2\", \"value\": \"--auto-instrumentation-python-image=${{ inputs.application-signals-adot-image }}:${{ inputs.application-signals-adot-image-tag }}\"}]'"
execute_and_retry 2 "kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": "public.ecr.aws/y8s3a7r9/cloudwatch-agent:latest"}]'"
execute_and_retry 2 "kubectl delete pods --all -n amazon-cloudwatch"
execute_and_retry 2 "kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch"
execute_and_retry 2 "kubectl delete pods --all -n ${{ env.PYTHON_SAMPLE_APP_NAMESPACE }}"
execute_and_retry 2 "kubectl wait --for=condition=Ready --request-timeout '5m' pod --all -n ${{ env.PYTHON_SAMPLE_APP_NAMESPACE }}"
Expand Down Expand Up @@ -246,10 +254,10 @@ jobs:
- 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 /dev/null http://${{ env.APP_ENDPOINT }}/outgoing-http-call
curl -S -s /dev/null http://${{ env.APP_ENDPOINT }}/aws-sdk-call
curl -S -s /dev/null http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}
curl -S -s /dev/null http://${{ env.APP_ENDPOINT }}/client-call
# Validation for application signals telemetry data
- name: Call endpoint and validate generated EMF logs
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.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: Test
on:
push:

permissions:
id-token: write
contents: read

jobs:
e2e-ec2-test:
uses: ./.github/workflows/application-signals-python-e2e-ec2-test.yml
secrets: inherit
with:
aws-region: us-east-1
caller-workflow-name: 'test'

e2e-eks-test-1:
uses: ./.github/workflows/application-signals-python-e2e-eks-test.yml
secrets: inherit
with:
aws-region: 'us-east-1'
test-cluster-name: 'e2e-playground'
caller-workflow-name: "test"
application-signals-adot-image: '417921506511.dkr.ecr.us-east-1.amazonaws.com/aws-opentelemetry-distro/metric-schema-changes'
application-signals-adot-image-tag: 'latest'

0 comments on commit c799421

Please sign in to comment.