Skip to content

Commit 83f2e00

Browse files
committed
testing pr changes
1 parent 113714c commit 83f2e00

File tree

5 files changed

+46
-18
lines changed

5 files changed

+46
-18
lines changed

.github/workflows/python-ec2-default-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ env:
4949
CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }}
5050
ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }}
5151
OTEL_SOURCE: ${{ inputs.otel-source }}
52-
SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip
52+
SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip
5353
E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}
5454
E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }}
5555
METRIC_NAMESPACE: ApplicationSignals
@@ -171,7 +171,7 @@ jobs:
171171
-var="get_adot_wheel_command=${{ env.GET_ADOT_WHEEL_COMMAND }}" \
172172
-var="language_version=${{ env.PYTHON_VERSION }}" \
173173
-var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \
174-
|| deployment_failed=1
174+
|| deployment_failed=$?
175175
if [ $deployment_failed -eq 1 ]; then
176176
echo "Terraform deployment was unsuccessful. Will attempt to retry deployment."
177177
fi

.github/workflows/python-sample-app-s3-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ jobs:
4848

4949
- name: Build Sample App Zip
5050
working-directory: sample-apps/python
51-
run: zip -r python-sample-app.zip .
51+
run: zip -r python-sample-app-delete-me.zip .
5252

5353
- name: Upload to S3
5454
working-directory: sample-apps/python
55-
run: aws s3api put-object --bucket ${{ secrets.APP_SIGNALS_E2E_EC2_JAR }}-prod-${{ matrix.aws-region }} --body ./python-sample-app.zip --key python-sample-app.zip
55+
run: aws s3api put-object --bucket ${{ secrets.APP_SIGNALS_E2E_EC2_JAR }}-prod-${{ matrix.aws-region }} --body ./python-sample-app-delete-me.zip --key python-sample-app-delete-me.zip
5656

5757
- name: Build Gen AI Sample App Zip
5858
working-directory: sample-apps/python/genai_service

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
4+
# This is a reusable workflow for running the Enablement test for App Signals.
5+
# It is meant to be called from another workflow.
6+
# Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview
7+
name: Test
8+
on:
9+
push:
10+
branches:
11+
- otel-custom-metrics-test
12+
13+
permissions:
14+
id-token: write
15+
contents: read
16+
17+
jobs:
18+
java-ec2-default:
19+
uses: ./.github/workflows/python-ec2-default-test.yml
20+
secrets: inherit
21+
with:
22+
caller-workflow-name: 'test'
23+
aws-region: 'us-east-1'
24+
25+
custom-metrics:
26+
uses: ./.github/workflows/python-ec2-default-test.yml
27+
secrets: inherit
28+
with:
29+
caller-workflow-name: 'test'
30+
aws-region: 'us-east-1'

terraform/python/ec2/default/main.tf

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ resource "null_resource" "main_service_setup" {
161161
${var.get_adot_wheel_command}
162162
163163
# Get and run the sample application with configuration
164-
aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip
165-
unzip -o python-sample-app.zip
164+
aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip
165+
unzip -o python-sample-app-delete-me.zip
166166
167167
# Export environment variables for instrumentation
168168
cd ./django_frontend_service
@@ -181,7 +181,6 @@ resource "null_resource" "main_service_setup" {
181181
export OTEL_EXPORTER_OTLP_INSECURE=true
182182
export OTEL_SERVICE_NAME=python-sample-application-${var.test_id}
183183
export OTEL_TRACES_SAMPLER=always_on
184-
export OTEL_RESOURCE_ATTRIBUTES="Service=python-sample-application-${var.test_id},Environment=ec2:default"
185184
export AWS_REGION='${var.aws_region}'
186185
python${var.language_version} manage.py migrate
187186
nohup opentelemetry-instrument python${var.language_version} manage.py runserver 0.0.0.0:8000 --noreload &
@@ -295,8 +294,8 @@ resource "null_resource" "remote_service_setup" {
295294
${var.get_adot_wheel_command}
296295
297296
# Get and run the sample application with configuration
298-
aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip
299-
unzip -o python-sample-app.zip
297+
aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip
298+
unzip -o python-sample-app-delete-me.zip
300299
301300
# Export environment variables for instrumentation
302301
cd ./django_remote_service

validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public void validate() throws Exception {
9999
validateAnyMetricExists();
100100
return;
101101
}
102-
// Query the Service, RemoteService, and RemoteTarget dimensions to ensure we
103-
// Get all metrics from all aggregations, specifically the [RemoteService] aggregation.
102+
// We will query the Service, RemoteService, and RemoteTarget dimensions to ensure we
103+
// get all metrics from all aggregations, specifically the [RemoteService] aggregation.
104104
List<String> serviceNames =
105105
Lists.newArrayList(
106106
context.getServiceName(), context.getRemoteServiceDeploymentName());
@@ -158,9 +158,9 @@ private void addMetrics(
158158
List<Metric> actualMetricList)
159159
throws Exception {
160160
for (String dimensionValue : dimensionValues) {
161-
List<Metric> foundMetrics = this.listMetricFromCloudWatch(
162-
cloudWatchService, expectedMetricList, dimensionName, dimensionValue);
163-
actualMetricList.addAll(foundMetrics);
161+
actualMetricList.addAll(
162+
this.listMetricFromCloudWatch(
163+
cloudWatchService, expectedMetricList, dimensionName, dimensionValue));
164164
}
165165
}
166166

@@ -245,10 +245,9 @@ private List<Metric> listMetricFromCloudWatch(
245245
// search by metric name
246246
List<Metric> result = new ArrayList<>();
247247
for (String metricName : metricNameMap.keySet()) {
248-
String namespace = metricNameMap.get(metricName);
249-
250-
List<Metric> metrics = cloudWatchService.listMetrics(namespace, metricName, dimensionKey, dimensionValue);
251-
result.addAll(metrics);
248+
result.addAll(
249+
cloudWatchService.listMetrics(
250+
metricNameMap.get(metricName), metricName, dimensionKey, dimensionValue));
252251
}
253252
return result;
254253
}

0 commit comments

Comments
 (0)