Skip to content

Commit b1ebea6

Browse files
committed
Refactor code
1 parent 2d30c32 commit b1ebea6

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

.github/workflows/application-signals-python-e2e-ec2-asg-test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ jobs:
4242
- uses: actions/checkout@v4
4343
with:
4444
repository: aws-observability/aws-application-signals-test-framework
45-
ref: add-ec2-platform-for-python-ga
46-
47-
- name: Set CW Agent RPM environment variable
48-
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
45+
ref: ga-python
4946

5047
- name: Generate testing id
5148
run: echo TESTING_ID="${{ github.job }}-${{ env.AWS_DEFAULT_REGION }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV
@@ -194,7 +191,7 @@ jobs:
194191
continue-on-error: true
195192
run: |
196193
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call; echo
197-
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call; echo
194+
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call?testingId=${{ env.TESTING_ID }}; echo
198195
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}; echo
199196
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call; echo
200197
@@ -210,6 +207,7 @@ jobs:
210207
- name: Validate generated EMF logs
211208
id: log-validation
212209
run: ./gradlew validator:run --args='-c python/ec2/asg/log-validation.yml
210+
--testing-id ${{ env.TESTING_ID }}
213211
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
214212
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001
215213
--region ${{ env.AWS_DEFAULT_REGION }}
@@ -228,14 +226,15 @@ jobs:
228226
id: metric-validation
229227
if: (success() || steps.log-validation.outcome == 'failure') && !cancelled()
230228
run: ./gradlew validator:run --args='-c python/ec2/asg/metric-validation.yml
229+
--testing-id ${{ env.TESTING_ID }}
231230
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
232231
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001
233232
--region ${{ env.AWS_DEFAULT_REGION }}
234233
--metric-namespace ${{ env.METRIC_NAMESPACE }}
235234
--log-group ${{ env.LOG_GROUP_NAME }}
236235
--service-name python-sample-application-${{ env.TESTING_ID }}
237236
--remote-service-name python-sample-remote-application-${{ env.TESTING_ID }}
238-
--query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }}
237+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}
239238
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
240239
--platform-info python-ec2-single-asg-${{ env.TESTING_ID }}
241240
--instance-id ${{ env.INSTANCE_ID }}
@@ -246,6 +245,7 @@ jobs:
246245
id: trace-validation
247246
if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled()
248247
run: ./gradlew validator:run --args='-c python/ec2/asg/trace-validation.yml
248+
--testing-id ${{ env.TESTING_ID }}
249249
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
250250
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001
251251
--region ${{ env.AWS_DEFAULT_REGION }}

.github/workflows/application-signals-python-e2e-ec2-default-test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ jobs:
4343
repository: aws-observability/aws-application-signals-test-framework
4444
ref: ga-python
4545

46-
- name: Set CW Agent RPM environment variable
47-
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
48-
4946
- name: Generate testing id
5047
run: echo TESTING_ID="${{ github.job }}-${{ env.AWS_DEFAULT_REGION }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV
5148

@@ -87,6 +84,7 @@ jobs:
8784
# echo GET_ADOT_WHEEL_COMMAND="python3.9 -m pip install ${{ env.ADOT_WHEEL_NAME }}==0.1.1" >> $GITHUB_ENV
8885
# fi
8986

87+
9088
- name: Initiate Terraform
9189
uses: ./.github/workflows/actions/execute_and_retry
9290
with:
@@ -197,7 +195,7 @@ jobs:
197195
--log-group ${{ env.LOG_GROUP_NAME }}
198196
--service-name python-sample-application-${{ env.TESTING_ID }}
199197
--remote-service-name python-sample-remote-application-${{ env.TESTING_ID }}
200-
--query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }}
198+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}
201199
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
202200
--instance-id ${{ env.MAIN_SERVICE_INSTANCE_ID }}
203201
--rollup'

.github/workflows/application-signals-python-e2e-eks-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- uses: actions/checkout@v4
4343
with:
4444
repository: aws-observability/aws-application-signals-test-framework
45-
ref: add-ec2-platform-for-python-ga
45+
ref: ga-python
4646

4747
- name: Download enablement script
4848
uses: ./.github/workflows/actions/execute_and_retry
@@ -285,7 +285,7 @@ jobs:
285285
--platform-info ${{ inputs.test-cluster-name }}
286286
--service-name python-application-${{ env.TESTING_ID }}
287287
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
288-
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}
288+
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}
289289
--rollup'
290290

291291
- name: Call endpoints and validate generated metrics
@@ -303,7 +303,7 @@ jobs:
303303
--service-name python-application-${{ env.TESTING_ID }}
304304
--remote-service-name python-remote-application-${{ env.TESTING_ID }}
305305
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
306-
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}
306+
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}
307307
--rollup'
308308

309309
- name: Call endpoints and validate generated traces

terraform/python/ec2/asg/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ resource "aws_launch_configuration" "launch_configuration" {
119119
120120
# Export environment variables for instrumentation
121121
cd ./django_frontend_service
122-
# Delete the requests requirement as it is installed already using rpm
122+
# Delete the requests requirement as it is installed already using rpm. Only applicable for ec2 instances
123+
# created by Auto Scaling Groups
123124
sudo sed -i '/requests/d' ./requirements.txt
124125
python3.9 -m pip install -r requirements.txt
125126
export DJANGO_SETTINGS_MODULE="django_frontend_service.settings"

validator/src/main/resources/expected-data-template/python/ec2/asg/aws-sdk-call-log.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"Version": "^1$",
1818
"RemoteService": "AWS::S3",
1919
"RemoteOperation": "GetBucketLocation",
20-
"RemoteResourceIdentifier": "^e2e-test-bucket-name$",
20+
"RemoteResourceIdentifier": "^e2e-test-bucket-name-{{testingId}}$",
2121
"RemoteResourceType": "^AWS::S3::Bucket$",
2222
"aws.span.kind": "^CLIENT$",
2323
"host.name": "^ip(-[0-9]{1,3}){4}\\.ec2\\.internal$"

validator/src/main/resources/expected-data-template/python/ec2/asg/aws-sdk-call-metric.mustache

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
value: AWS::S3
9696
-
9797
name: RemoteResourceIdentifier
98-
value: e2e-test-bucket-name
98+
value: e2e-test-bucket-name-{{testingId}}
9999
-
100100
name: RemoteResourceType
101101
value: AWS::S3::Bucket
@@ -118,7 +118,7 @@
118118
value: AWS::S3
119119
-
120120
name: RemoteResourceIdentifier
121-
value: e2e-test-bucket-name
121+
value: e2e-test-bucket-name-{{testingId}}
122122
-
123123
name: RemoteResourceType
124124
value: AWS::S3::Bucket
@@ -220,7 +220,7 @@
220220
value: AWS::S3
221221
-
222222
name: RemoteResourceIdentifier
223-
value: e2e-test-bucket-name
223+
value: e2e-test-bucket-name-{{testingId}}
224224
-
225225
name: RemoteResourceType
226226
value: AWS::S3::Bucket
@@ -243,7 +243,7 @@
243243
value: AWS::S3
244244
-
245245
name: RemoteResourceIdentifier
246-
value: e2e-test-bucket-name
246+
value: e2e-test-bucket-name-{{testingId}}
247247
-
248248
name: RemoteResourceType
249249
value: AWS::S3::Bucket
@@ -345,7 +345,7 @@
345345
value: AWS::S3
346346
-
347347
name: RemoteResourceIdentifier
348-
value: e2e-test-bucket-name
348+
value: e2e-test-bucket-name-{{testingId}}
349349
-
350350
name: RemoteResourceType
351351
value: AWS::S3::Bucket
@@ -368,7 +368,7 @@
368368
value: AWS::S3
369369
-
370370
name: RemoteResourceIdentifier
371-
value: e2e-test-bucket-name
371+
value: e2e-test-bucket-name-{{testingId}}
372372
-
373373
name: RemoteResourceType
374374
value: AWS::S3::Bucket

0 commit comments

Comments
 (0)