Skip to content

Commit ecca007

Browse files
committed
testing pr changes
1 parent d4657c2 commit ecca007

File tree

6 files changed

+94
-15
lines changed

6 files changed

+94
-15
lines changed

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

Lines changed: 3 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
@@ -252,7 +252,8 @@ jobs:
252252
--instance-id ${{ env.MAIN_SERVICE_INSTANCE_ID }}
253253
--rollup'
254254

255-
- name: Validate CWAgent metrics
255+
#Creating a separate validation for custom metrics sent by CloudWatch Agent
256+
- name: Validate custom metrics
256257
id: cwagent-metric-validation
257258
if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled()
258259
run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml

.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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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'

sample-apps/python/django_frontend_service/frontend_service_app/views.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
#python equivalent of Meter meter = GlobalOpenTelemetry.getMeter("myMeter"); for custom metrics
2020
meter = metrics.get_meter("myMeter")
2121
custom_export_counter = meter.create_counter("custom_export_counter", unit="1", description="Custom export counter")
22-
test_histogram = meter.create_histogram("test_histogram", description="Test histogram")
22+
custom_export_histogram = meter.create_histogram("custom_export_histogram", description="Custom export histogram")
23+
custom_export_gauge = meter.create_up_down_counter("custom_export_gauge", unit="1", description="Custom export gauge")
2324

2425
should_send_local_root_client_call = False
2526
lock = threading.Lock()
@@ -57,8 +58,10 @@ def healthcheck(request):
5758
def aws_sdk_call(request):
5859

5960
# Increment counter/histogram
60-
custom_export_counter.add(1, {"operation.type": "custom_export_1"})
61-
test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"})
61+
custom_export_counter.add(1, {"Operation": "counter"})
62+
custom_export_histogram.record(random.randint(100, 1000), {"Operation": "histogram"})
63+
custom_export_gauge.add(random.randint(-10, 10), {"Operation": "gauge"})
64+
6265

6366
bucket_name = "e2e-test-bucket-name"
6467

terraform/python/ec2/default/main.tf

Lines changed: 4 additions & 4 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
@@ -294,8 +294,8 @@ resource "null_resource" "remote_service_setup" {
294294
${var.get_adot_wheel_command}
295295
296296
# Get and run the sample application with configuration
297-
aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip
298-
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
299299
300300
# Export environment variables for instrumentation
301301
cd ./django_remote_service

validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
name: service.name
1818
value: {{serviceName}}
1919
-
20-
name: operation.type
21-
value: custom_export_1
20+
name: Operation
21+
value: counter
2222
-
2323
name: host.type
2424
value: ANY_VALUE
@@ -53,7 +53,7 @@
5353
name: cloud.platform
5454
value: aws_ec2
5555
-
56-
metricName: test_histogram
56+
metricName: custom_export_histogram
5757
namespace: {{metricNamespace}}
5858
dimensions:
5959
-
@@ -69,7 +69,7 @@
6969
name: service.name
7070
value: {{serviceName}}
7171
-
72-
name: operation.type
72+
name: Operation
7373
value: histogram
7474
-
7575
name: host.type
@@ -101,6 +101,58 @@
101101
-
102102
name: telemetry.auto.version
103103
value: ANY_VALUE
104+
-
105+
name: cloud.platform
106+
value: aws_ec2
107+
-
108+
metricName: custom_export_gauge
109+
namespace: {{metricNamespace}}
110+
dimensions:
111+
-
112+
name: deployment.environment.name
113+
value: ec2:default
114+
-
115+
name: aws.local.service
116+
value: {{serviceName}}
117+
-
118+
name: cloud.region
119+
value: ANY_VALUE
120+
-
121+
name: service.name
122+
value: {{serviceName}}
123+
-
124+
name: Operation
125+
value: gauge
126+
-
127+
name: host.type
128+
value: ANY_VALUE
129+
-
130+
name: cloud.availability_zone
131+
value: ANY_VALUE
132+
-
133+
name: telemetry.sdk.name
134+
value: opentelemetry
135+
-
136+
name: telemetry.sdk.language
137+
value: python
138+
-
139+
name: cloud.provider
140+
value: aws
141+
-
142+
name: cloud.account.id
143+
value: ANY_VALUE
144+
-
145+
name: host.name
146+
value: ANY_VALUE
147+
-
148+
name: telemetry.sdk.version
149+
value: ANY_VALUE
150+
-
151+
name: host.id
152+
value: ANY_VALUE
153+
-
154+
name: telemetry.auto.version
155+
value: ANY_VALUE
104156
-
105157
name: cloud.platform
106158
value: aws_ec2

0 commit comments

Comments
 (0)