From f02dcb34ceaf382bc94a6fd22ed035efcfd638b8 Mon Sep 17 00:00:00 2001 From: Miqueas Herrera Date: Tue, 7 Oct 2025 12:52:50 -0700 Subject: [PATCH 01/82] Create test.yml --- .github/workflows/test.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..888d61eb0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +## SPDX-License-Identifier: Apache-2.0 + +# This is a reusable workflow for running the Enablement 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: Test +on: + push: + branches: + - otel-custom-metrics-test + +permissions: + id-token: write + contents: read + +jobs: + java-ec2-adaptive-sampling: + uses: ./.github/workflows/python-ec2-default-test.yml + secrets: inherit + with: + caller-workflow-name: 'test' From 383791c82aa17ff9856c87ae54370d744333eaf9 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 7 Oct 2025 13:27:58 -0700 Subject: [PATCH 02/82] updating custom metrics test branch --- .github/workflows/python-ec2-default-test.yml | 12 + .../ec2-requirements.txt | 1 + .../frontend_service_app/views.py | 76 +- .../amazon-cloudwatch-custom-agent.json | 22 + .../amazon-cloudwatch-custom-agent.json | 22 + .../amazon-cloudwatch-custom-agent.json | 22 + .../amazon-cloudwatch-custom-agent.json | 22 + terraform/python/ec2/default/main.tf | 11 +- terraform/python/ec2/default/variables.tf | 15 +- .../PredefinedExpectedTemplate.java | 8 + .../default/aws-otel-custom-metrics.mustache | 0 .../aws-sdk-call-custom-metrics.mustache | 958 ++++++++++++++++++ .../python/ec2/default/metric-validation.yml | 12 +- 13 files changed, 1175 insertions(+), 6 deletions(-) create mode 100644 terraform/dotnet/ec2/default/amazon-cloudwatch-custom-agent.json create mode 100644 terraform/java/ec2/default/amazon-cloudwatch-custom-agent.json create mode 100644 terraform/node/ec2/default/amazon-cloudwatch-custom-agent.json create mode 100644 terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json create mode 100644 validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache create mode 100644 validator/src/main/resources/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 4fb5aa575..609b690f3 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -32,6 +32,14 @@ on: required: false type: string default: 'github' + custom-metrics-enabled: + required: false + type: boolean + default: false + custom-metrics-config: + required: false + type: string + default: '{}' outputs: job-started: value: ${{ jobs.python-ec2-default.outputs.job-started }} @@ -49,6 +57,8 @@ env: CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} + CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} + CUSTOM_METRICS_CONFIG: ${{ inputs.custom-metrics-config }} SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} @@ -171,6 +181,8 @@ jobs: -var="get_adot_wheel_command=${{ env.GET_ADOT_WHEEL_COMMAND }}" \ -var="language_version=${{ env.PYTHON_VERSION }}" \ -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ + -var="custom_metrics_enabled=${{ env.CUSTOM_METRICS_ENABLED }}" \ + -var="custom_metrics_config=${{ env.CUSTOM_METRICS_CONFIG }}" || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then diff --git a/sample-apps/python/django_frontend_service/ec2-requirements.txt b/sample-apps/python/django_frontend_service/ec2-requirements.txt index bb91a04b1..01518b9e6 100644 --- a/sample-apps/python/django_frontend_service/ec2-requirements.txt +++ b/sample-apps/python/django_frontend_service/ec2-requirements.txt @@ -6,3 +6,4 @@ requests~=2.25.1 schedule~=1.2.1 opentelemetry-sdk==1.33.1 opentelemetry-api==1.33.1 +opentelemetry-exporter-otlp-proto-http==1.22.0 \ No newline at end of file diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 57c264f3c..2d76728c9 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -11,11 +11,78 @@ import requests import schedule from django.http import HttpResponse, JsonResponse -from opentelemetry import trace +from opentelemetry import trace, metrics from opentelemetry.trace.span import format_trace_id +from opentelemetry.sdk.metrics import MeterProvider +from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader +from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter +from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter as HTTPMetricExporter +from opentelemetry.sdk.metrics.export import ConsoleMetricsExporter +from opentelemetry.sdk.resources import Resource logger = logging.getLogger(__name__) +# Initialize custom OTEL metrics export pipeline - OTLP approach (OTEL/Span export 1) Agent based +custom_resource = Resource.create({ + "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), + "deployment.environment.name": os.getenv("DEPLOYMENT_ENV", "test"), + #"test" being over-rided by python-sample-application-${var.test_id} in main.tf + }) +custom_otlp_exporter = OTLPMetricExporter( + endpoint="http://localhost:4317", + insecure=True +) +custom_otlp_reader = PeriodicExportingMetricReader( + exporter=custom_otlp_exporter, + export_interval_millis=5000 +) + +# Initialize Console exporter - Direct output approach (OTEL export 2) Custom export pipeline +custom_console_exporter = ConsoleMetricsExporter() +custom_console_reader = PeriodicExportingMetricReader( + exporter=custom_console_exporter, + export_interval_millis=5000 +) + +# Custom Export Pipeline - HTTP Direct +resource = Resource.create({ + "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), + "deployment.environment.name": os.getenv("DEPLOYMENT_ENV", "test") + })#"test" being over-rided by python-sample-application-${var.test_id} in main.tf + +# OtlpHttpMetricExporter.builder().setEndpoint().build() +metricExporter = HTTPMetricExporter( + endpoint="http://localhost:4318/v1/metrics" +) + +# PeriodicMetricReader.builder(metricExporter).setInterval(Duration.ofSeconds(10)).build() +metricReader = PeriodicExportingMetricReader( + exporter=metricExporter, + export_interval_millis=5000 +) + +# SdkMeterProvider.builder().setResource(resource).registerMetricReader(metricReader).build() +meterProvider = MeterProvider( + resource=resource, + metric_readers=[metricReader] +) + +# meterProvider.get("myMeter") +meter = meterProvider.get_meter("myMeter") + + +# Create meter provider with both exporters +custom_meter_provider = MeterProvider( + resource=custom_resource, + metric_readers=[custom_otlp_reader, custom_console_reader] +) + +# Initialize span metrics using custom meter provider +custom_meter = custom_meter_provider.get_meter("custom-metrics") +custom_request_counter = custom_meter.create_counter("custom_requests_total", description="Total requests") +http_counter = meter.create_counter("custom_requests_total", description="Total requests") +# custom_response_time_histogram = custom_meter.create_histogram("custom_response_time", description="Response time") + should_send_local_root_client_call = False lock = threading.Lock() def run_local_root_client_call_recurring_service(): @@ -50,6 +117,13 @@ def healthcheck(request): return HttpResponse("healthcheck") def aws_sdk_call(request): + # Setup Span Attributes And Initialize Counter/Histogram To Recieve Custom Metrics + # start_time = time.time() #start histogram + custom_request_counter.add(1, {"operation.type": "aws_sdk_call"}) # Agent-based export + http_counter.add(1, {"operation.type": "aws_sdk_call"}) # Custom export pipeline + # duration = time.time() - start_time #end histogram + # custom_response_time_histogram.record(duration, {"operation.type": "aws_sdk_call"}) #record histogram + bucket_name = "e2e-test-bucket-name" # Add a unique test ID to bucketname to associate buckets to specific test runs diff --git a/terraform/dotnet/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/dotnet/ec2/default/amazon-cloudwatch-custom-agent.json new file mode 100644 index 000000000..ad8a8c2ef --- /dev/null +++ b/terraform/dotnet/ec2/default/amazon-cloudwatch-custom-agent.json @@ -0,0 +1,22 @@ +{ + "traces": { + "traces_collected": { + "application_signals": {} + } + }, + "logs": { + "metrics_collected": { + "application_signals": {} + } + }, + "metrics": { + "namespace": "CWAgent", + "metrics_collected": { + "application_signals": {}, + "otlp": { + "grpc_endpoint": "0.0.0.0:4317", + "http_endpoint": "0.0.0.0:4318" + } + } + } +} \ No newline at end of file diff --git a/terraform/java/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/java/ec2/default/amazon-cloudwatch-custom-agent.json new file mode 100644 index 000000000..ad8a8c2ef --- /dev/null +++ b/terraform/java/ec2/default/amazon-cloudwatch-custom-agent.json @@ -0,0 +1,22 @@ +{ + "traces": { + "traces_collected": { + "application_signals": {} + } + }, + "logs": { + "metrics_collected": { + "application_signals": {} + } + }, + "metrics": { + "namespace": "CWAgent", + "metrics_collected": { + "application_signals": {}, + "otlp": { + "grpc_endpoint": "0.0.0.0:4317", + "http_endpoint": "0.0.0.0:4318" + } + } + } +} \ No newline at end of file diff --git a/terraform/node/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/node/ec2/default/amazon-cloudwatch-custom-agent.json new file mode 100644 index 000000000..ad8a8c2ef --- /dev/null +++ b/terraform/node/ec2/default/amazon-cloudwatch-custom-agent.json @@ -0,0 +1,22 @@ +{ + "traces": { + "traces_collected": { + "application_signals": {} + } + }, + "logs": { + "metrics_collected": { + "application_signals": {} + } + }, + "metrics": { + "namespace": "CWAgent", + "metrics_collected": { + "application_signals": {}, + "otlp": { + "grpc_endpoint": "0.0.0.0:4317", + "http_endpoint": "0.0.0.0:4318" + } + } + } +} \ No newline at end of file diff --git a/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json new file mode 100644 index 000000000..ad8a8c2ef --- /dev/null +++ b/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json @@ -0,0 +1,22 @@ +{ + "traces": { + "traces_collected": { + "application_signals": {} + } + }, + "logs": { + "metrics_collected": { + "application_signals": {} + } + }, + "metrics": { + "namespace": "CWAgent", + "metrics_collected": { + "application_signals": {}, + "otlp": { + "grpc_endpoint": "0.0.0.0:4317", + "http_endpoint": "0.0.0.0:4318" + } + } + } +} \ No newline at end of file diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index f5f254232..3db722e6a 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -145,7 +145,7 @@ resource "null_resource" "main_service_setup" { sudo yum install ec2-instance-connect -y # Copy in CW Agent configuration - agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' + agent_config='${replace(replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' echo $agent_config > amazon-cloudwatch-agent.json # Get and run CW agent rpm @@ -170,7 +170,7 @@ resource "null_resource" "main_service_setup" { export DJANGO_SETTINGS_MODULE="django_frontend_service.settings" export OTEL_PYTHON_DISTRO="aws_distro" export OTEL_PYTHON_CONFIGURATOR="aws_configurator" - export OTEL_METRICS_EXPORTER=none + eexport OTEL_METRICS_EXPORTER=otlp export OTEL_TRACES_EXPORTER=otlp export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4315 @@ -179,6 +179,11 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on + export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id}",deployment.environment.name=${var.test_id}" + export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317 + export AWS_REGION='${var.aws_region}' + export CUSTOM_METRICS_CONFIG='${var.custom_metrics_config}' + export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' python${var.language_version} manage.py migrate nohup opentelemetry-instrument python${var.language_version} manage.py runserver 0.0.0.0:8000 --noreload & @@ -275,7 +280,7 @@ resource "null_resource" "remote_service_setup" { sudo yum install ec2-instance-connect -y # Copy in CW Agent configuration - agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' + agent_config='${replace(replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' echo $agent_config > amazon-cloudwatch-agent.json # Get and run CW agent rpm diff --git a/terraform/python/ec2/default/variables.tf b/terraform/python/ec2/default/variables.tf index ec2812438..d22ee6142 100644 --- a/terraform/python/ec2/default/variables.tf +++ b/terraform/python/ec2/default/variables.tf @@ -47,4 +47,17 @@ variable "language_version" { variable "cpu_architecture" { default = "x86_64" -} \ No newline at end of file +} + +#Adding Custom Metrics Variables + +variable "custom_metrics_enabled" { + description = "Enable custom OTEL metrics in the sample application" + type = bool + default = false +} + +variable "custom_metrics_config" { + description = "JSON configuration for custom metrics" + type = string + default = "amazon-cloudwatch-custom-agent.json" \ No newline at end of file diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index 3523f2131..46784e44d 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -210,6 +210,14 @@ public enum PredefinedExpectedTemplate implements FileConfig { PYTHON_EC2_DEFAULT_CLIENT_CALL_METRIC("/expected-data-template/python/ec2/default/client-call-metric.mustache"), PYTHON_EC2_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/python/ec2/default/client-call-trace.mustache"), +/** Python EC2 Default Custom Metrics Test Case Validations */ + PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-sdk-call-custom-metric.mustache"), + PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), + /**PYTHON_EC2_DEFAULT_OUTGOING_HTTP_CALL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/outgoing-http-call-custom-metric.mustache"), + PYTHON_EC2_DEFAULT_REMOTE_SERVICE_CUSTOM_METRIC("/expected-data-template/python/ec2/default/remote-service-custom-metric.mustache"), + PYTHON_EC2_DEFAULT_CLIENT_CALL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/client-call-custom-metric.mustache"), + PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), */ + /** Python EC2 Asg Test Case Validations */ PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_LOG("/expected-data-template/python/ec2/asg/outgoing-http-call-log.mustache"), PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_METRIC("/expected-data-template/python/ec2/asg/outgoing-http-call-metric.mustache"), diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache new file mode 100644 index 000000000..e69de29bb diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache new file mode 100644 index 000000000..3261fcc45 --- /dev/null +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache @@ -0,0 +1,958 @@ +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + +# Span Metrics For Custom Metrics +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: operation.type + value: aws_sdk_call + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: operation.type + value: aws_sdk_call + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: operation.type + value: aws_sdk_call + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + - + name: operation.type + value: aws_sdk_call + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + - + name: operation.type + value: aws_sdk_call + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: operation.type + value: aws_sdk_call + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + - + name: operation.type + value: aws_sdk_call + +- + metricName: Latency + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + - + name: operation.type + value: aws_sdk_call +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: operation.type + value: aws_sdk_call + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: operation.type + value: aws_sdk_call + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: operation.type + value: aws_sdk_call + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: operation.type + value: aws_sdk_call + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + - + name: operation.type + value: aws_sdk_call + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + - + name: operation.type + value: aws_sdk_call + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: operation.type + value: aws_sdk_call + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + - + name: operation.type + value: aws_sdk_call + +- + metricName: Error + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + - + name: operation.type + value: aws_sdk_call + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: operation.type + value: aws_sdk_call + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: operation.type + value: aws_sdk_call + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: operation.type + value: aws_sdk_call + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + - + name: operation.type + value: aws_sdk_call + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + - + name: operation.type + value: aws_sdk_call + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: operation.type + value: aws_sdk_call + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Operation + value: GET aws-sdk-call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + - + name: operation.type + value: aws_sdk_call + +- + metricName: Fault + namespace: {{metricNamespace}} + dimensions: + - + name: Service + value: {{serviceName}} + - + name: Environment + value: ec2:default + - + name: RemoteOperation + value: GetBucketLocation + - + name: RemoteService + value: AWS::S3 + - + name: RemoteResourceIdentifier + value: e2e-test-bucket-name-{{testingId}} + - + name: RemoteResourceType + value: AWS::S3::Bucket + - + name: operation.type + value: aws_sdk_call \ No newline at end of file diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index addeba20a..f7b0ff2b6 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -25,4 +25,14 @@ - validationType: "cw-metric" callingType: "none" - expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" \ No newline at end of file + expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" +- + validationType: "cw-metric" + httpPath: "aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC" +- + validationType: "cw-metric" + callingType: "none" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" \ No newline at end of file From d89c43b16915df2467dfa2912b01cf749e18392b Mon Sep 17 00:00:00 2001 From: Miqueas Herrera Date: Tue, 7 Oct 2025 13:42:58 -0700 Subject: [PATCH 03/82] Update test.yml --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 888d61eb0..3584466aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,3 +20,4 @@ jobs: secrets: inherit with: caller-workflow-name: 'test' + aws-region: 'us-west-2' From 3e1be9be7f2dc0b64464f7cca3c9f6cc8bb33cd8 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 7 Oct 2025 13:54:33 -0700 Subject: [PATCH 04/82] fixing variables.tf typo --- terraform/python/ec2/default/variables.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/variables.tf b/terraform/python/ec2/default/variables.tf index d22ee6142..a688f6371 100644 --- a/terraform/python/ec2/default/variables.tf +++ b/terraform/python/ec2/default/variables.tf @@ -60,4 +60,5 @@ variable "custom_metrics_enabled" { variable "custom_metrics_config" { description = "JSON configuration for custom metrics" type = string - default = "amazon-cloudwatch-custom-agent.json" \ No newline at end of file + default = "amazon-cloudwatch-custom-agent.json" +} \ No newline at end of file From c5f28fdda33316c3cb86a7b7be8d3043aa716456 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 7 Oct 2025 14:11:25 -0700 Subject: [PATCH 05/82] updated bash syntax error --- terraform/python/ec2/default/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/variables.tf b/terraform/python/ec2/default/variables.tf index a688f6371..273ad729a 100644 --- a/terraform/python/ec2/default/variables.tf +++ b/terraform/python/ec2/default/variables.tf @@ -60,5 +60,5 @@ variable "custom_metrics_enabled" { variable "custom_metrics_config" { description = "JSON configuration for custom metrics" type = string - default = "amazon-cloudwatch-custom-agent.json" + default = "{}" } \ No newline at end of file From 3455277f1a4c6294f14f10514ca09252cc5bf764 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 7 Oct 2025 14:12:54 -0700 Subject: [PATCH 06/82] updating tf files --- .../python/ec2/default/amazon-cloudwatch-custom-agent.json | 4 ++++ terraform/python/ec2/default/main.tf | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json index ad8a8c2ef..93e268e1a 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json @@ -1,4 +1,8 @@ { + "agent": { + "debug": true, + "region": "$REGION" + }, "traces": { "traces_collected": { "application_signals": {} diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 3db722e6a..ab5275dea 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -170,7 +170,7 @@ resource "null_resource" "main_service_setup" { export DJANGO_SETTINGS_MODULE="django_frontend_service.settings" export OTEL_PYTHON_DISTRO="aws_distro" export OTEL_PYTHON_CONFIGURATOR="aws_configurator" - eexport OTEL_METRICS_EXPORTER=otlp + export OTEL_METRICS_EXPORTER=otlp export OTEL_TRACES_EXPORTER=otlp export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4315 From ddd2993d3700599ca44fb69f4ab3ae30904f0f3a Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 7 Oct 2025 14:26:03 -0700 Subject: [PATCH 07/82] updating syntax error --- .github/workflows/python-ec2-default-test.yml | 3 +-- .../amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 609b690f3..4aece3e65 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -182,8 +182,7 @@ jobs: -var="language_version=${{ env.PYTHON_VERSION }}" \ -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ -var="custom_metrics_enabled=${{ env.CUSTOM_METRICS_ENABLED }}" \ - -var="custom_metrics_config=${{ env.CUSTOM_METRICS_CONFIG }}" - || deployment_failed=$? + -var="custom_metrics_config=${{ env.CUSTOM_METRICS_CONFIG }}" || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then echo "Terraform deployment was unsuccessful. Will attempt to retry deployment." diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index 46784e44d..071930241 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -213,11 +213,7 @@ public enum PredefinedExpectedTemplate implements FileConfig { /** Python EC2 Default Custom Metrics Test Case Validations */ PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-sdk-call-custom-metric.mustache"), PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), - /**PYTHON_EC2_DEFAULT_OUTGOING_HTTP_CALL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/outgoing-http-call-custom-metric.mustache"), - PYTHON_EC2_DEFAULT_REMOTE_SERVICE_CUSTOM_METRIC("/expected-data-template/python/ec2/default/remote-service-custom-metric.mustache"), - PYTHON_EC2_DEFAULT_CLIENT_CALL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/client-call-custom-metric.mustache"), - PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), */ - + /** Python EC2 Asg Test Case Validations */ PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_LOG("/expected-data-template/python/ec2/asg/outgoing-http-call-log.mustache"), PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_METRIC("/expected-data-template/python/ec2/asg/outgoing-http-call-metric.mustache"), From 446bd08790675fb05c3136cd7bf3cc05960b5ffc Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 7 Oct 2025 14:44:10 -0700 Subject: [PATCH 08/82] updating main service to connect to local host only if CM is enabled --- terraform/python/ec2/default/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index ab5275dea..40ea7e536 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -180,7 +180,7 @@ resource "null_resource" "main_service_setup" { export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id}",deployment.environment.name=${var.test_id}" - export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317 + ${var.custom_metrics_enabled ? "export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317" : "# Custom metrics disabled"} export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_CONFIG='${var.custom_metrics_config}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' From 75c47a20820f6523f8d27007b1bede0ce59cc0b0 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 7 Oct 2025 14:58:09 -0700 Subject: [PATCH 09/82] updating main.tf --- terraform/python/ec2/default/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 40ea7e536..42129d27e 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -170,7 +170,7 @@ resource "null_resource" "main_service_setup" { export DJANGO_SETTINGS_MODULE="django_frontend_service.settings" export OTEL_PYTHON_DISTRO="aws_distro" export OTEL_PYTHON_CONFIGURATOR="aws_configurator" - export OTEL_METRICS_EXPORTER=otlp + export OTEL_METRICS_EXPORTER=${var.custom_metrics_enabled ? "otlp" : "none"} export OTEL_TRACES_EXPORTER=otlp export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4315 @@ -179,7 +179,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on - export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id}",deployment.environment.name=${var.test_id}" + export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=${var.test_id}" ${var.custom_metrics_enabled ? "export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317" : "# Custom metrics disabled"} export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_CONFIG='${var.custom_metrics_config}' From 0c75867ab569d9f72c6b1d7573e76a276b103636 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 7 Oct 2025 15:30:07 -0700 Subject: [PATCH 10/82] updating default instance --- terraform/python/ec2/default/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 42129d27e..8e8f0500b 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -179,7 +179,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on - export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=${var.test_id}" + export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" ${var.custom_metrics_enabled ? "export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317" : "# Custom metrics disabled"} export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_CONFIG='${var.custom_metrics_config}' From e28599378a673bb282783a0fb478268a5f410b3c Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 7 Oct 2025 15:43:02 -0700 Subject: [PATCH 11/82] setting custom metrics default to true --- .github/workflows/python-ec2-default-test.yml | 2 +- .../com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java | 2 +- .../validations/python/ec2/default/metric-validation.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 4aece3e65..8664141ac 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -35,7 +35,7 @@ on: custom-metrics-enabled: required: false type: boolean - default: false + default: true custom-metrics-config: required: false type: string diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index 071930241..517bfe71c 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -211,7 +211,7 @@ public enum PredefinedExpectedTemplate implements FileConfig { PYTHON_EC2_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/python/ec2/default/client-call-trace.mustache"), /** Python EC2 Default Custom Metrics Test Case Validations */ - PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-sdk-call-custom-metric.mustache"), + PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache"), PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), /** Python EC2 Asg Test Case Validations */ diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index f7b0ff2b6..fe18ff276 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -35,4 +35,4 @@ - validationType: "cw-metric" callingType: "none" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" \ No newline at end of file + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" From dd9e778e64130337d8f7578e5ab7099584c0286f Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 8 Oct 2025 10:00:34 -0700 Subject: [PATCH 12/82] fixing cw agent --- .github/workflows/python-ec2-default-test.yml | 2 -- .../frontend_service_app/views.py | 3 +-- .../amazon-cloudwatch-custom-agent.json | 22 ------------------- .../amazon-cloudwatch-custom-agent.json | 22 ------------------- .../amazon-cloudwatch-custom-agent.json | 22 ------------------- .../amazon-cloudwatch-custom-agent.json | 6 ----- terraform/python/ec2/default/main.tf | 1 - terraform/python/ec2/default/variables.tf | 6 ----- 8 files changed, 1 insertion(+), 83 deletions(-) delete mode 100644 terraform/dotnet/ec2/default/amazon-cloudwatch-custom-agent.json delete mode 100644 terraform/java/ec2/default/amazon-cloudwatch-custom-agent.json delete mode 100644 terraform/node/ec2/default/amazon-cloudwatch-custom-agent.json diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 8664141ac..712038dd3 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -58,7 +58,6 @@ env: ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} - CUSTOM_METRICS_CONFIG: ${{ inputs.custom-metrics-config }} SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} @@ -182,7 +181,6 @@ jobs: -var="language_version=${{ env.PYTHON_VERSION }}" \ -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ -var="custom_metrics_enabled=${{ env.CUSTOM_METRICS_ENABLED }}" \ - -var="custom_metrics_config=${{ env.CUSTOM_METRICS_CONFIG }}" || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then echo "Terraform deployment was unsuccessful. Will attempt to retry deployment." diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 2d76728c9..eb21a33c1 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -81,7 +81,6 @@ custom_meter = custom_meter_provider.get_meter("custom-metrics") custom_request_counter = custom_meter.create_counter("custom_requests_total", description="Total requests") http_counter = meter.create_counter("custom_requests_total", description="Total requests") -# custom_response_time_histogram = custom_meter.create_histogram("custom_response_time", description="Response time") should_send_local_root_client_call = False lock = threading.Lock() @@ -123,7 +122,7 @@ def aws_sdk_call(request): http_counter.add(1, {"operation.type": "aws_sdk_call"}) # Custom export pipeline # duration = time.time() - start_time #end histogram # custom_response_time_histogram.record(duration, {"operation.type": "aws_sdk_call"}) #record histogram - + bucket_name = "e2e-test-bucket-name" # Add a unique test ID to bucketname to associate buckets to specific test runs diff --git a/terraform/dotnet/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/dotnet/ec2/default/amazon-cloudwatch-custom-agent.json deleted file mode 100644 index ad8a8c2ef..000000000 --- a/terraform/dotnet/ec2/default/amazon-cloudwatch-custom-agent.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "traces": { - "traces_collected": { - "application_signals": {} - } - }, - "logs": { - "metrics_collected": { - "application_signals": {} - } - }, - "metrics": { - "namespace": "CWAgent", - "metrics_collected": { - "application_signals": {}, - "otlp": { - "grpc_endpoint": "0.0.0.0:4317", - "http_endpoint": "0.0.0.0:4318" - } - } - } -} \ No newline at end of file diff --git a/terraform/java/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/java/ec2/default/amazon-cloudwatch-custom-agent.json deleted file mode 100644 index ad8a8c2ef..000000000 --- a/terraform/java/ec2/default/amazon-cloudwatch-custom-agent.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "traces": { - "traces_collected": { - "application_signals": {} - } - }, - "logs": { - "metrics_collected": { - "application_signals": {} - } - }, - "metrics": { - "namespace": "CWAgent", - "metrics_collected": { - "application_signals": {}, - "otlp": { - "grpc_endpoint": "0.0.0.0:4317", - "http_endpoint": "0.0.0.0:4318" - } - } - } -} \ No newline at end of file diff --git a/terraform/node/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/node/ec2/default/amazon-cloudwatch-custom-agent.json deleted file mode 100644 index ad8a8c2ef..000000000 --- a/terraform/node/ec2/default/amazon-cloudwatch-custom-agent.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "traces": { - "traces_collected": { - "application_signals": {} - } - }, - "logs": { - "metrics_collected": { - "application_signals": {} - } - }, - "metrics": { - "namespace": "CWAgent", - "metrics_collected": { - "application_signals": {}, - "otlp": { - "grpc_endpoint": "0.0.0.0:4317", - "http_endpoint": "0.0.0.0:4318" - } - } - } -} \ No newline at end of file diff --git a/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json index 93e268e1a..f65bfe32e 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json @@ -9,12 +9,6 @@ } }, "logs": { - "metrics_collected": { - "application_signals": {} - } - }, - "metrics": { - "namespace": "CWAgent", "metrics_collected": { "application_signals": {}, "otlp": { diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 8e8f0500b..5a6db9312 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -182,7 +182,6 @@ resource "null_resource" "main_service_setup" { export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" ${var.custom_metrics_enabled ? "export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317" : "# Custom metrics disabled"} export AWS_REGION='${var.aws_region}' - export CUSTOM_METRICS_CONFIG='${var.custom_metrics_config}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' python${var.language_version} manage.py migrate nohup opentelemetry-instrument python${var.language_version} manage.py runserver 0.0.0.0:8000 --noreload & diff --git a/terraform/python/ec2/default/variables.tf b/terraform/python/ec2/default/variables.tf index 273ad729a..2fec6628c 100644 --- a/terraform/python/ec2/default/variables.tf +++ b/terraform/python/ec2/default/variables.tf @@ -55,10 +55,4 @@ variable "custom_metrics_enabled" { description = "Enable custom OTEL metrics in the sample application" type = bool default = false -} - -variable "custom_metrics_config" { - description = "JSON configuration for custom metrics" - type = string - default = "{}" } \ No newline at end of file From a3fedbc42acb85075b39a8bf715e11cab96b168a Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 8 Oct 2025 10:40:10 -0700 Subject: [PATCH 13/82] making custom metrics conditional --- .../django_frontend_service/frontend_service_app/views.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index eb21a33c1..0b87762bd 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -117,11 +117,9 @@ def healthcheck(request): def aws_sdk_call(request): # Setup Span Attributes And Initialize Counter/Histogram To Recieve Custom Metrics - # start_time = time.time() #start histogram - custom_request_counter.add(1, {"operation.type": "aws_sdk_call"}) # Agent-based export - http_counter.add(1, {"operation.type": "aws_sdk_call"}) # Custom export pipeline - # duration = time.time() - start_time #end histogram - # custom_response_time_histogram.record(duration, {"operation.type": "aws_sdk_call"}) #record histogram + if os.getenv("CUSTOM_METRICS_ENABLED", "false").lower() == "true": + custom_request_counter.add(1, {"operation.type": "aws_sdk_call"}) # Agent-based export + http_counter.add(1, {"operation.type": "aws_sdk_call"}) # Custom export pipeline bucket_name = "e2e-test-bucket-name" From 81500c68e4c9ef213b9777e6002c8f27879e1654 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 8 Oct 2025 12:14:06 -0700 Subject: [PATCH 14/82] setting custom metrics to false --- .github/workflows/python-ec2-default-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 712038dd3..5a0b5c4ca 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -35,7 +35,7 @@ on: custom-metrics-enabled: required: false type: boolean - default: true + default: false custom-metrics-config: required: false type: string From 72c88c536a87ef4818d5f2ad03924daf2795abc6 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 8 Oct 2025 12:40:05 -0700 Subject: [PATCH 15/82] separating metric validation files --- .github/workflows/python-ec2-default-test.yml | 2 +- .../ec2/default/metric-validation-custom.yml | 32 +++++++++++++++++++ .../python/ec2/default/metric-validation.yml | 11 +------ 3 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 validator/src/main/resources/validations/python/ec2/default/metric-validation-custom.yml diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 5a0b5c4ca..fe39057cb 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -247,7 +247,7 @@ jobs: - name: Validate generated metrics id: metric-validation if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() - run: ./gradlew validator:run --args='-c python/ec2/default/metric-validation.yml + run: ./gradlew validator:run --args='-c python/ec2/default/metric-validation${{ env.CUSTOM_METRICS_ENABLED == 'true' && '-custom' || '' }}.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001 diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation-custom.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation-custom.yml new file mode 100644 index 000000000..a1a55b195 --- /dev/null +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation-custom.yml @@ -0,0 +1,32 @@ +- + validationType: "cw-metric" + httpPath: "outgoing-http-call" + httpMethod: "get" + callingType: "http" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_OUTGOING_HTTP_CALL_METRIC" +- + validationType: "cw-metric" + httpPath: "aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_SDK_CALL_METRIC" +- + validationType: "cw-metric" + httpPath: "client-call" + httpMethod: "get" + callingType: "http" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_CLIENT_CALL_METRIC" +- + validationType: "cw-metric" + callingType: "none" + expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" +- + validationType: "cw-metric" + httpPath: "aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC" +- + validationType: "cw-metric" + callingType: "none" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" \ No newline at end of file diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index fe18ff276..0491f345a 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -26,13 +26,4 @@ validationType: "cw-metric" callingType: "none" expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" -- - validationType: "cw-metric" - httpPath: "aws-sdk-call" - httpMethod: "get" - callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC" -- - validationType: "cw-metric" - callingType: "none" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" + From b0e450f0b1978060fc172d9b269c0d888a665008 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 8 Oct 2025 12:51:47 -0700 Subject: [PATCH 16/82] Revert "separating metric validation files" This reverts commit 72c88c536a87ef4818d5f2ad03924daf2795abc6. --- .github/workflows/python-ec2-default-test.yml | 2 +- .../ec2/default/metric-validation-custom.yml | 32 ------------------- .../python/ec2/default/metric-validation.yml | 11 ++++++- 3 files changed, 11 insertions(+), 34 deletions(-) delete mode 100644 validator/src/main/resources/validations/python/ec2/default/metric-validation-custom.yml diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index fe39057cb..5a0b5c4ca 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -247,7 +247,7 @@ jobs: - name: Validate generated metrics id: metric-validation if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() - run: ./gradlew validator:run --args='-c python/ec2/default/metric-validation${{ env.CUSTOM_METRICS_ENABLED == 'true' && '-custom' || '' }}.yml + run: ./gradlew validator:run --args='-c python/ec2/default/metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001 diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation-custom.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation-custom.yml deleted file mode 100644 index a1a55b195..000000000 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation-custom.yml +++ /dev/null @@ -1,32 +0,0 @@ -- - validationType: "cw-metric" - httpPath: "outgoing-http-call" - httpMethod: "get" - callingType: "http" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_OUTGOING_HTTP_CALL_METRIC" -- - validationType: "cw-metric" - httpPath: "aws-sdk-call" - httpMethod: "get" - callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_SDK_CALL_METRIC" -- - validationType: "cw-metric" - httpPath: "client-call" - httpMethod: "get" - callingType: "http" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_CLIENT_CALL_METRIC" -- - validationType: "cw-metric" - callingType: "none" - expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" -- - validationType: "cw-metric" - httpPath: "aws-sdk-call" - httpMethod: "get" - callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC" -- - validationType: "cw-metric" - callingType: "none" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" \ No newline at end of file diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index 0491f345a..fe18ff276 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -26,4 +26,13 @@ validationType: "cw-metric" callingType: "none" expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" - +- + validationType: "cw-metric" + httpPath: "aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC" +- + validationType: "cw-metric" + callingType: "none" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" From 0e3aff2f48fda78e940d87b126eb9721b4927c2d Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 8 Oct 2025 13:39:37 -0700 Subject: [PATCH 17/82] adding debugger for sql pws --- .../django_frontend_service/frontend_service_app/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 0b87762bd..cdff864b5 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -183,6 +183,13 @@ def get_xray_trace_id(): def mysql(request): logger.info("mysql received") + + # Debug log for RDS_MYSQL_CLUSTER_PASSWORD + if "RDS_MYSQL_CLUSTER_PASSWORD" in os.environ: + logger.info("RDS_MYSQL_CLUSTER_PASSWORD found in environment") + else: + logger.error("RDS_MYSQL_CLUSTER_PASSWORD NOT found in environment variables") + logger.info(f"Available environment variables: {list(os.environ.keys())}") encoded_password = os.environ["RDS_MYSQL_CLUSTER_PASSWORD"] decoded_password = base64.b64decode(encoded_password).decode('utf-8') From d070aab9e0992edd4b3c26b29f86cc3a7f38258a Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 8 Oct 2025 14:16:32 -0700 Subject: [PATCH 18/82] adding dummy MYSQL data to prevent KeyError --- .../django_frontend_service/frontend_service_app/views.py | 7 ------- terraform/python/ec2/default/main.tf | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index cdff864b5..0b87762bd 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -183,13 +183,6 @@ def get_xray_trace_id(): def mysql(request): logger.info("mysql received") - - # Debug log for RDS_MYSQL_CLUSTER_PASSWORD - if "RDS_MYSQL_CLUSTER_PASSWORD" in os.environ: - logger.info("RDS_MYSQL_CLUSTER_PASSWORD found in environment") - else: - logger.error("RDS_MYSQL_CLUSTER_PASSWORD NOT found in environment variables") - logger.info(f"Available environment variables: {list(os.environ.keys())}") encoded_password = os.environ["RDS_MYSQL_CLUSTER_PASSWORD"] decoded_password = base64.b64decode(encoded_password).decode('utf-8') diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 5a6db9312..ba3fe4246 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -183,6 +183,10 @@ resource "null_resource" "main_service_setup" { ${var.custom_metrics_enabled ? "export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317" : "# Custom metrics disabled"} export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' + export RDS_MYSQL_CLUSTER_ENDPOINT='dummy-endpoint' + export RDS_MYSQL_CLUSTER_PASSWORD='ZHVtbXk=' # base64 encoded 'dummy' + export RDS_MYSQL_CLUSTER_USERNAME='dummy-user' + export RDS_MYSQL_CLUSTER_DATABASE='dummy-db' python${var.language_version} manage.py migrate nohup opentelemetry-instrument python${var.language_version} manage.py runserver 0.0.0.0:8000 --noreload & From 67329dc8d19e482f6eac11595bdd9c95fbd3d966 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 8 Oct 2025 14:46:40 -0700 Subject: [PATCH 19/82] setting custom metrics to true --- terraform/python/ec2/default/variables.tf | 2 +- .../default/aws-otel-custom-metrics.mustache | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/variables.tf b/terraform/python/ec2/default/variables.tf index 2fec6628c..893378f3a 100644 --- a/terraform/python/ec2/default/variables.tf +++ b/terraform/python/ec2/default/variables.tf @@ -54,5 +54,5 @@ variable "cpu_architecture" { variable "custom_metrics_enabled" { description = "Enable custom OTEL metrics in the sample application" type = bool - default = false + default = true } \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index e69de29bb..cd5efb47f 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -0,0 +1,26 @@ +# OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only +- + metricName: custom_requests_total + namespace: {{customMetricNamespace}} + dimensions: + - + name: operation.type + value: aws_sdk_call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: {{testingId}} + +# Code for adding in Custom Histogram Metrics +# - +# metricName: custom_response_time +# namespace: {{customMetricNamespace}} +# dimensions: +# - +# name: operation.type +# value: aws_sdk_call +# - +# name: Service +# value: {{serviceName}} \ No newline at end of file From 59b9f1284f9d4154c22f1ffccee72f5af2be6e70 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 09:31:12 -0700 Subject: [PATCH 20/82] updating zip,validation templates, variables, and test region --- .../workflows/dotnet-ec2-adot-sigv4-test.yml | 2 +- .../java-ec2-adaptive-sampling-test.yml | 2 +- .../workflows/java-ec2-adot-sigv4-test.yml | 2 +- .../workflows/node-ec2-adot-sigv4-test.yml | 2 +- .../workflows/python-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/python-ec2-default-test.yml | 2 +- .github/workflows/python-ec2-genesis-test.yml | 2 +- .../workflows/python-sample-app-s3-deploy.yml | 4 +- .github/workflows/test.yml | 2 +- .../frontend_service_app/views.py | 13 +- sample-apps/python/genai_service/server.py | 2 +- terraform/dotnet/lambda/lambda/variables.tf | 4 +- terraform/java/lambda/lambda/variables.tf | 4 +- terraform/node/lambda/lambda/variables.tf | 4 +- terraform/python/ec2/adot-genai/variables.tf | 2 +- terraform/python/ec2/default/main.tf | 8 +- terraform/python/lambda/lambda/variables.tf | 4 +- .../src/main/java/com/amazon/aoc/App.java | 2 +- .../PredefinedExpectedTemplate.java | 3 +- .../default/aws-otel-custom-metrics.mustache | 27 +- .../aws-sdk-call-custom-metrics.mustache | 958 ------------------ 21 files changed, 46 insertions(+), 1005 deletions(-) delete mode 100644 validator/src/main/resources/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache diff --git a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml index 4096f6977..c3188707a 100644 --- a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml +++ b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml @@ -26,7 +26,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} DOTNET_VERSION: ${{ inputs.dotnet-version }} diff --git a/.github/workflows/java-ec2-adaptive-sampling-test.yml b/.github/workflows/java-ec2-adaptive-sampling-test.yml index 0172d3e37..e4ac7cba9 100644 --- a/.github/workflows/java-ec2-adaptive-sampling-test.yml +++ b/.github/workflows/java-ec2-adaptive-sampling-test.yml @@ -17,7 +17,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: us-west-2 + E2E_TEST_AWS_REGION: us-east-1 CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-main-service-v11.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-remote-service-v11.jar diff --git a/.github/workflows/java-ec2-adot-sigv4-test.yml b/.github/workflows/java-ec2-adot-sigv4-test.yml index 8a7973dcd..3aa03521d 100644 --- a/.github/workflows/java-ec2-adot-sigv4-test.yml +++ b/.github/workflows/java-ec2-adot-sigv4-test.yml @@ -34,7 +34,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' # Test uses us-west-2 in the us-east-1 accoun + E2E_TEST_AWS_REGION: 'us-east-1' # Test uses us-east-1 in the us-east-1 account CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} METRIC_NAMESPACE: ApplicationSignals JAVA_VERSION: ${{ inputs.java-version }} diff --git a/.github/workflows/node-ec2-adot-sigv4-test.yml b/.github/workflows/node-ec2-adot-sigv4-test.yml index 18d97022a..b99e59bb7 100644 --- a/.github/workflows/node-ec2-adot-sigv4-test.yml +++ b/.github/workflows/node-ec2-adot-sigv4-test.yml @@ -32,7 +32,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} NODE_VERSION: ${{ inputs.node-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-adot-sigv4-test.yml b/.github/workflows/python-ec2-adot-sigv4-test.yml index c6eca9cfb..592420d9c 100644 --- a/.github/workflows/python-ec2-adot-sigv4-test.yml +++ b/.github/workflows/python-ec2-adot-sigv4-test.yml @@ -31,7 +31,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} PYTHON_VERSION: ${{ inputs.python-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 5a0b5c4ca..62958159d 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -58,7 +58,7 @@ env: ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} - SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip + SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals diff --git a/.github/workflows/python-ec2-genesis-test.yml b/.github/workflows/python-ec2-genesis-test.yml index 3378b3837..7ed546105 100644 --- a/.github/workflows/python-ec2-genesis-test.yml +++ b/.github/workflows/python-ec2-genesis-test.yml @@ -20,7 +20,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} diff --git a/.github/workflows/python-sample-app-s3-deploy.yml b/.github/workflows/python-sample-app-s3-deploy.yml index 28e3d31bd..0a0434ee6 100644 --- a/.github/workflows/python-sample-app-s3-deploy.yml +++ b/.github/workflows/python-sample-app-s3-deploy.yml @@ -48,11 +48,11 @@ jobs: - name: Build Sample App Zip working-directory: sample-apps/python - run: zip -r python-sample-app.zip . + run: zip -r python-sample-app-delete-me.zip . - name: Upload to S3 working-directory: sample-apps/python - 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 + 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 - name: Build Gen AI Sample App Zip working-directory: sample-apps/python/genai_service diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3584466aa..f7aa4d4b2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,4 +20,4 @@ jobs: secrets: inherit with: caller-workflow-name: 'test' - aws-region: 'us-west-2' + aws-region: 'us-east-1' diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 0b87762bd..365f4b792 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -26,7 +26,7 @@ custom_resource = Resource.create({ "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), "deployment.environment.name": os.getenv("DEPLOYMENT_ENV", "test"), - #"test" being over-rided by python-sample-application-${var.test_id} in main.tf + #"test" being overridden by python-sample-application-${var.test_id} in main.tf }) custom_otlp_exporter = OTLPMetricExporter( endpoint="http://localhost:4317", @@ -48,7 +48,7 @@ resource = Resource.create({ "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), "deployment.environment.name": os.getenv("DEPLOYMENT_ENV", "test") - })#"test" being over-rided by python-sample-application-${var.test_id} in main.tf + })#"test" being overridden by python-sample-application-${var.test_id} in main.tf # OtlpHttpMetricExporter.builder().setEndpoint().build() metricExporter = HTTPMetricExporter( @@ -79,8 +79,8 @@ # Initialize span metrics using custom meter provider custom_meter = custom_meter_provider.get_meter("custom-metrics") -custom_request_counter = custom_meter.create_counter("custom_requests_total", description="Total requests") -http_counter = meter.create_counter("custom_requests_total", description="Total requests") +custom_request_counter = custom_meter.create_counter("cloud_watch_counter", description="Total requests") +http_counter = meter.create_counter("http_counter", description="Total requests") should_send_local_root_client_call = False lock = threading.Lock() @@ -117,9 +117,8 @@ def healthcheck(request): def aws_sdk_call(request): # Setup Span Attributes And Initialize Counter/Histogram To Recieve Custom Metrics - if os.getenv("CUSTOM_METRICS_ENABLED", "false").lower() == "true": - custom_request_counter.add(1, {"operation.type": "aws_sdk_call"}) # Agent-based export - http_counter.add(1, {"operation.type": "aws_sdk_call"}) # Custom export pipeline + custom_request_counter.add(1, {"operation.type": "aws_sdk_call"}) # Agent-based export + http_counter.add(1, {"operation.type": "aws_sdk_call"}) # Custom export pipeline bucket_name = "e2e-test-bucket-name" diff --git a/sample-apps/python/genai_service/server.py b/sample-apps/python/genai_service/server.py index 1ef073e9e..3247f69af 100644 --- a/sample-apps/python/genai_service/server.py +++ b/sample-apps/python/genai_service/server.py @@ -45,7 +45,7 @@ "temperature": 0.7, "max_tokens": 500 }, - region_name=os.getenv("AWS_DEFAULT_REGION", "us-west-2") + region_name=os.getenv("AWS_DEFAULT_REGION", "us-east-1") ) # Create a prompt template diff --git a/terraform/dotnet/lambda/lambda/variables.tf b/terraform/dotnet/lambda/lambda/variables.tf index 7c8102bee..5fe066321 100644 --- a/terraform/dotnet/lambda/lambda/variables.tf +++ b/terraform/dotnet/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + description = "Lambda function running region, default value is us-east-1" + default = "us-east-1" } variable "is_canary" { diff --git a/terraform/java/lambda/lambda/variables.tf b/terraform/java/lambda/lambda/variables.tf index eb8cbf91e..1adf689bd 100644 --- a/terraform/java/lambda/lambda/variables.tf +++ b/terraform/java/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + description = "Lambda function running region, default value is us-east-1" + default = "us-east-1" } variable "is_canary" { diff --git a/terraform/node/lambda/lambda/variables.tf b/terraform/node/lambda/lambda/variables.tf index b20a2e500..b7249149f 100644 --- a/terraform/node/lambda/lambda/variables.tf +++ b/terraform/node/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + description = "Lambda function running region, default value is us-east-1" + default = "us-east-1" } variable "is_canary" { diff --git a/terraform/python/ec2/adot-genai/variables.tf b/terraform/python/ec2/adot-genai/variables.tf index b8f0d21cb..3abb61f4b 100644 --- a/terraform/python/ec2/adot-genai/variables.tf +++ b/terraform/python/ec2/adot-genai/variables.tf @@ -14,7 +14,7 @@ # ------------------------------------------------------------------------- variable "aws_region" { - default = "us-west-2" + default = "us-east-1" } variable "test_id" { diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index ba3fe4246..bea110913 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -161,8 +161,8 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip - unzip -o python-sample-app.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip + unzip -o python-sample-app-delete-me.zip # Export environment variables for instrumentation cd ./django_frontend_service @@ -299,8 +299,8 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip - unzip -o python-sample-app.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip + unzip -o python-sample-app-delete-me.zip # Export environment variables for instrumentation cd ./django_remote_service diff --git a/terraform/python/lambda/lambda/variables.tf b/terraform/python/lambda/lambda/variables.tf index bf628b567..8d8dfca60 100644 --- a/terraform/python/lambda/lambda/variables.tf +++ b/terraform/python/lambda/lambda/variables.tf @@ -36,8 +36,8 @@ variable "is_canary" { variable "region" { type = string - description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + description = "Lambda function running region, default value is us-east-1" + default = "us-east-1" } variable "layer_artifacts_directory" { diff --git a/validator/src/main/java/com/amazon/aoc/App.java b/validator/src/main/java/com/amazon/aoc/App.java index 674cfb2ef..109b9d44c 100644 --- a/validator/src/main/java/com/amazon/aoc/App.java +++ b/validator/src/main/java/com/amazon/aoc/App.java @@ -97,7 +97,7 @@ public class App implements Callable { @CommandLine.Option( names = {"--region"}, - defaultValue = "us-west-2") + defaultValue = "us-east-1") private String region; @CommandLine.Option(names = {"--availability-zone"}) diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index 517bfe71c..2e2856783 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -211,9 +211,8 @@ public enum PredefinedExpectedTemplate implements FileConfig { PYTHON_EC2_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/python/ec2/default/client-call-trace.mustache"), /** Python EC2 Default Custom Metrics Test Case Validations */ - PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache"), PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), - + /** Python EC2 Asg Test Case Validations */ PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_LOG("/expected-data-template/python/ec2/asg/outgoing-http-call-log.mustache"), PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_METRIC("/expected-data-template/python/ec2/asg/outgoing-http-call-metric.mustache"), diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index cd5efb47f..6d2aaf750 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -1,6 +1,6 @@ # OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only - - metricName: custom_requests_total + metricName: cloud_watch_counter namespace: {{customMetricNamespace}} dimensions: - @@ -12,15 +12,16 @@ - name: Environment value: {{testingId}} - -# Code for adding in Custom Histogram Metrics -# - -# metricName: custom_response_time -# namespace: {{customMetricNamespace}} -# dimensions: -# - -# name: operation.type -# value: aws_sdk_call -# - -# name: Service -# value: {{serviceName}} \ No newline at end of file +- + metricName: http_counter + namespace: {{customMetricNamespace}} + dimensions: + - + name: operation.type + value: aws_sdk_call + - + name: Service + value: {{serviceName}} + - + name: Environment + value: {{testingId}} \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache deleted file mode 100644 index 3261fcc45..000000000 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-sdk-call-custom-metrics.mustache +++ /dev/null @@ -1,958 +0,0 @@ -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - -# Span Metrics For Custom Metrics -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: operation.type - value: aws_sdk_call - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: operation.type - value: aws_sdk_call - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: operation.type - value: aws_sdk_call - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - - - name: operation.type - value: aws_sdk_call - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - - - name: operation.type - value: aws_sdk_call - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: operation.type - value: aws_sdk_call - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - - - name: operation.type - value: aws_sdk_call - -- - metricName: Latency - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - - - name: operation.type - value: aws_sdk_call -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: operation.type - value: aws_sdk_call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: operation.type - value: aws_sdk_call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: operation.type - value: aws_sdk_call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: operation.type - value: aws_sdk_call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - - - name: operation.type - value: aws_sdk_call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - - - name: operation.type - value: aws_sdk_call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: operation.type - value: aws_sdk_call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - - - name: operation.type - value: aws_sdk_call - -- - metricName: Error - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - - - name: operation.type - value: aws_sdk_call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: operation.type - value: aws_sdk_call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: operation.type - value: aws_sdk_call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: operation.type - value: aws_sdk_call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - - - name: operation.type - value: aws_sdk_call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - - - name: operation.type - value: aws_sdk_call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: operation.type - value: aws_sdk_call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Operation - value: GET aws-sdk-call - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - - - name: operation.type - value: aws_sdk_call - -- - metricName: Fault - namespace: {{metricNamespace}} - dimensions: - - - name: Service - value: {{serviceName}} - - - name: Environment - value: ec2:default - - - name: RemoteOperation - value: GetBucketLocation - - - name: RemoteService - value: AWS::S3 - - - name: RemoteResourceIdentifier - value: e2e-test-bucket-name-{{testingId}} - - - name: RemoteResourceType - value: AWS::S3::Bucket - - - name: operation.type - value: aws_sdk_call \ No newline at end of file From 284c65e7781565dccb81372ea98f1bd8fb5a5e92 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 10:03:13 -0700 Subject: [PATCH 21/82] fixing typo --- terraform/python/ec2/default/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index bea110913..86dba8fef 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -145,7 +145,7 @@ resource "null_resource" "main_service_setup" { sudo yum install ec2-instance-connect -y # Copy in CW Agent configuration - agent_config='${replace(replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' + agent_config='${replace(replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' echo $agent_config > amazon-cloudwatch-agent.json # Get and run CW agent rpm From 761a7ed98046ad75fcd8a5f19d4837268b3fa146 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 10:25:38 -0700 Subject: [PATCH 22/82] updating otlp-proto dependency version --- sample-apps/python/django_frontend_service/ec2-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample-apps/python/django_frontend_service/ec2-requirements.txt b/sample-apps/python/django_frontend_service/ec2-requirements.txt index 01518b9e6..43dd3ca78 100644 --- a/sample-apps/python/django_frontend_service/ec2-requirements.txt +++ b/sample-apps/python/django_frontend_service/ec2-requirements.txt @@ -6,4 +6,4 @@ requests~=2.25.1 schedule~=1.2.1 opentelemetry-sdk==1.33.1 opentelemetry-api==1.33.1 -opentelemetry-exporter-otlp-proto-http==1.22.0 \ No newline at end of file +opentelemetry-exporter-otlp-proto-http==1.33.1 \ No newline at end of file From 02e58d5c03b79b09429d80a5d092098893ec0ef0 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 11:29:21 -0700 Subject: [PATCH 23/82] updating grpc dependency and sample app --- .../python/django_frontend_service/ec2-requirements.txt | 3 ++- .../django_frontend_service/frontend_service_app/views.py | 4 ++-- .../validations/python/ec2/default/metric-validation.yml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sample-apps/python/django_frontend_service/ec2-requirements.txt b/sample-apps/python/django_frontend_service/ec2-requirements.txt index 43dd3ca78..5aa7fbb67 100644 --- a/sample-apps/python/django_frontend_service/ec2-requirements.txt +++ b/sample-apps/python/django_frontend_service/ec2-requirements.txt @@ -6,4 +6,5 @@ requests~=2.25.1 schedule~=1.2.1 opentelemetry-sdk==1.33.1 opentelemetry-api==1.33.1 -opentelemetry-exporter-otlp-proto-http==1.33.1 \ No newline at end of file +opentelemetry-exporter-otlp-proto-http==1.33.1 +opentelemetry-exporter-otlp-proto-grpc==1.33.1 \ No newline at end of file diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 365f4b792..c056aef68 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -17,7 +17,7 @@ from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter as HTTPMetricExporter -from opentelemetry.sdk.metrics.export import ConsoleMetricsExporter +from opentelemetry.sdk.metrics.export import ConsoleMetricExporter from opentelemetry.sdk.resources import Resource logger = logging.getLogger(__name__) @@ -38,7 +38,7 @@ ) # Initialize Console exporter - Direct output approach (OTEL export 2) Custom export pipeline -custom_console_exporter = ConsoleMetricsExporter() +custom_console_exporter = ConsoleMetricExporter() custom_console_reader = PeriodicExportingMetricReader( exporter=custom_console_exporter, export_interval_millis=5000 diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index fe18ff276..0a18b0780 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -31,7 +31,7 @@ httpPath: "aws-sdk-call" httpMethod: "get" callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_SDK_CALL_CUSTOM_METRIC" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" - validationType: "cw-metric" callingType: "none" From bc4a37a1366a3ea95add8145e03cb9c836166d23 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 12:33:36 -0700 Subject: [PATCH 24/82] fixing typo in main.tf --- terraform/python/ec2/default/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 86dba8fef..47dc4b146 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -145,7 +145,7 @@ resource "null_resource" "main_service_setup" { sudo yum install ec2-instance-connect -y # Copy in CW Agent configuration - agent_config='${replace(replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' + agent_config='${replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "$REGION", var.aws_region)}' echo $agent_config > amazon-cloudwatch-agent.json # Get and run CW agent rpm From f3dbdf474c6204ff1cc5f065194c8e7927c26f3b Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 12:50:39 -0700 Subject: [PATCH 25/82] testing new grpc/http endpoints --- .../python/ec2/default/amazon-cloudwatch-custom-agent.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json index f65bfe32e..5d865d8d2 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json @@ -12,8 +12,8 @@ "metrics_collected": { "application_signals": {}, "otlp": { - "grpc_endpoint": "0.0.0.0:4317", - "http_endpoint": "0.0.0.0:4318" + "grpc_endpoint": "0.0.0.0:4315", + "http_endpoint": "0.0.0.0:4316" } } } From 3807ca9f05071f50ab32b55173a6928a986f7213 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 12:54:02 -0700 Subject: [PATCH 26/82] updating cwa --- terraform/python/ec2/default/amazon-cloudwatch-agent.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index a98a40d36..f65bfe32e 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -10,7 +10,11 @@ }, "logs": { "metrics_collected": { - "application_signals": {} + "application_signals": {}, + "otlp": { + "grpc_endpoint": "0.0.0.0:4317", + "http_endpoint": "0.0.0.0:4318" + } } } } \ No newline at end of file From 2883c2f431cf08ba3d68f12153bd8c61e9696acc Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 15:33:14 -0700 Subject: [PATCH 27/82] removing cwagent and updated views --- .../frontend_service_app/views.py | 31 +++++++--------- .../amazon-cloudwatch-custom-agent.json | 20 ---------- terraform/python/ec2/default/main.tf | 6 +-- .../default/aws-otel-custom-metrics.mustache | 37 +++++++++++++------ 4 files changed, 42 insertions(+), 52 deletions(-) delete mode 100644 terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index c056aef68..dffb3421e 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -24,8 +24,8 @@ # Initialize custom OTEL metrics export pipeline - OTLP approach (OTEL/Span export 1) Agent based custom_resource = Resource.create({ - "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), - "deployment.environment.name": os.getenv("DEPLOYMENT_ENV", "test"), + "service.name": "OTEL_SERVICE_NAME", + "deployment.environment.name": "custom_export", #"test" being overridden by python-sample-application-${var.test_id} in main.tf }) custom_otlp_exporter = OTLPMetricExporter( @@ -46,41 +46,38 @@ # Custom Export Pipeline - HTTP Direct resource = Resource.create({ - "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), - "deployment.environment.name": os.getenv("DEPLOYMENT_ENV", "test") - })#"test" being overridden by python-sample-application-${var.test_id} in main.tf + "service.name": "OTEL_SERVICE_NAME", + "deployment.environment.name": "agent_export", + }) -# OtlpHttpMetricExporter.builder().setEndpoint().build() +# Python version of 'OtlpHttpMetricExporter.builder().setEndpoint().build()' metricExporter = HTTPMetricExporter( endpoint="http://localhost:4318/v1/metrics" ) -# PeriodicMetricReader.builder(metricExporter).setInterval(Duration.ofSeconds(10)).build() +# 'Python version of 'PeriodicMetricReader.builder(metricExporter).setInterval(Duration.ofSeconds(10)).build()' metricReader = PeriodicExportingMetricReader( exporter=metricExporter, export_interval_millis=5000 ) -# SdkMeterProvider.builder().setResource(resource).registerMetricReader(metricReader).build() +# Python version of 'SdkMeterProvider.builder().setResource(resource).registerMetricReader(metricReader).build()' meterProvider = MeterProvider( resource=resource, metric_readers=[metricReader] ) -# meterProvider.get("myMeter") -meter = meterProvider.get_meter("myMeter") - - # Create meter provider with both exporters custom_meter_provider = MeterProvider( resource=custom_resource, metric_readers=[custom_otlp_reader, custom_console_reader] ) -# Initialize span metrics using custom meter provider +# Initialize counters/meters using custom meter provider. Python version of 'meterProvider.get("myMeter")' custom_meter = custom_meter_provider.get_meter("custom-metrics") -custom_request_counter = custom_meter.create_counter("cloud_watch_counter", description="Total requests") -http_counter = meter.create_counter("http_counter", description="Total requests") +meter = meterProvider.get_meter("myMeter") +custom_export_counter = custom_meter.create_counter("custom_export_counter", description="Total requests") +agent_export_counter = meter.create_counter("agent_export_counter", description="Total requests") should_send_local_root_client_call = False lock = threading.Lock() @@ -117,8 +114,8 @@ def healthcheck(request): def aws_sdk_call(request): # Setup Span Attributes And Initialize Counter/Histogram To Recieve Custom Metrics - custom_request_counter.add(1, {"operation.type": "aws_sdk_call"}) # Agent-based export - http_counter.add(1, {"operation.type": "aws_sdk_call"}) # Custom export pipeline + custom_export_counter.add(1, {"operation.type": "custom_export_1"}) # Agent-based export + agent_export_counter.add(1, {"operation.type": "agent_export_1"}) # Custom export pipeline bucket_name = "e2e-test-bucket-name" diff --git a/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json deleted file mode 100644 index 5d865d8d2..000000000 --- a/terraform/python/ec2/default/amazon-cloudwatch-custom-agent.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "agent": { - "debug": true, - "region": "$REGION" - }, - "traces": { - "traces_collected": { - "application_signals": {} - } - }, - "logs": { - "metrics_collected": { - "application_signals": {}, - "otlp": { - "grpc_endpoint": "0.0.0.0:4315", - "http_endpoint": "0.0.0.0:4316" - } - } - } -} \ No newline at end of file diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 47dc4b146..a6a61741e 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -170,7 +170,8 @@ resource "null_resource" "main_service_setup" { export DJANGO_SETTINGS_MODULE="django_frontend_service.settings" export OTEL_PYTHON_DISTRO="aws_distro" export OTEL_PYTHON_CONFIGURATOR="aws_configurator" - export OTEL_METRICS_EXPORTER=${var.custom_metrics_enabled ? "otlp" : "none"} + export OTEL_METRICS_EXPORTER=otlp + export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics export OTEL_TRACES_EXPORTER=otlp export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4315 @@ -179,8 +180,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on - export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" - ${var.custom_metrics_enabled ? "export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317" : "# Custom metrics disabled"} + export OTEL_RESOURCE_ATTRIBUTES="service.name=GOAT_Service,deployment.environment.name=GOAT_Pen" export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' export RDS_MYSQL_CLUSTER_ENDPOINT='dummy-endpoint' diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index 6d2aaf750..4097c9799 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -1,27 +1,40 @@ # OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only - - metricName: cloud_watch_counter + metricName: custom_export_counter namespace: {{customMetricNamespace}} dimensions: + - + name: deployment.environment.name + value: custom_export + - + name: telemetry.sdk.language + value: python - name: operation.type - value: aws_sdk_call + value: custom_export_1 - - name: Service - value: {{serviceName}} + name: telemetry.sdk.version + value: 1.33.1 - - name: Environment - value: {{testingId}} + name: telemetry.sdk.name + value: opentelemetry - - metricName: http_counter + metricName: agent_export_counter namespace: {{customMetricNamespace}} dimensions: + + - + name: deployment.environment.name + value: agent_export + - + name: telemetry.sdk.language + value: python - name: operation.type - value: aws_sdk_call + value: agent_export_1 - - name: Service - value: {{serviceName}} + name: telemetry.sdk.version + value: 1.33.1 - - name: Environment - value: {{testingId}} \ No newline at end of file + name: telemetry.sdk.name + value: opentelemetry \ No newline at end of file From c826fa02d7e961cd400013196ac5101ea9ca5b47 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 15:54:05 -0700 Subject: [PATCH 28/82] updating env variables --- .../frontend_service_app/views.py | 5 ++--- .../ec2/default/amazon-cloudwatch-agent.json | 15 ++++++++++----- terraform/python/ec2/default/main.tf | 6 +++--- .../ec2/default/aws-otel-custom-metrics.mustache | 7 ++++++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index dffb3421e..2d7b5285d 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -24,9 +24,8 @@ # Initialize custom OTEL metrics export pipeline - OTLP approach (OTEL/Span export 1) Agent based custom_resource = Resource.create({ - "service.name": "OTEL_SERVICE_NAME", + "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), "deployment.environment.name": "custom_export", - #"test" being overridden by python-sample-application-${var.test_id} in main.tf }) custom_otlp_exporter = OTLPMetricExporter( endpoint="http://localhost:4317", @@ -46,7 +45,7 @@ # Custom Export Pipeline - HTTP Direct resource = Resource.create({ - "service.name": "OTEL_SERVICE_NAME", + "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), "deployment.environment.name": "agent_export", }) diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index f65bfe32e..7ecb1d546 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -10,11 +10,16 @@ }, "logs": { "metrics_collected": { - "application_signals": {}, - "otlp": { - "grpc_endpoint": "0.0.0.0:4317", - "http_endpoint": "0.0.0.0:4318" - } + "application_signals": {} + } + }, + "metrics": { + "metrics_collected": { + "application_signals": {} + }, + "otlp": { + "grpc_endpoint": "0.0.0.0:4317", + "http_endpoint": "0.0.0.0:4318" } } } \ No newline at end of file diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index a6a61741e..9d83f8e50 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -180,7 +180,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on - export OTEL_RESOURCE_ATTRIBUTES="service.name=GOAT_Service,deployment.environment.name=GOAT_Pen" + export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' export RDS_MYSQL_CLUSTER_ENDPOINT='dummy-endpoint' @@ -283,8 +283,8 @@ resource "null_resource" "remote_service_setup" { sudo yum install ec2-instance-connect -y # Copy in CW Agent configuration - agent_config='${replace(replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' - echo $agent_config > amazon-cloudwatch-agent.json + agent_config='${replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "$REGION", var.aws_region)}' + echo "$agent_config" > amazon-cloudwatch-agent.json # Get and run CW agent rpm ${var.get_cw_agent_rpm_command} diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index 4097c9799..1f5d97f80 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -6,6 +6,9 @@ - name: deployment.environment.name value: custom_export + - + name: service.name + value: {{serviceName}} - name: telemetry.sdk.language value: python @@ -22,10 +25,12 @@ metricName: agent_export_counter namespace: {{customMetricNamespace}} dimensions: - - name: deployment.environment.name value: agent_export + - + name: service.name + value: {{serviceName}} - name: telemetry.sdk.language value: python From 791c36645ba3d4534d15eb646733ec050b0095d4 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 9 Oct 2025 16:06:47 -0700 Subject: [PATCH 29/82] updating cloudwatch config --- .../ec2/default/amazon-cloudwatch-agent.json | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index 7ecb1d546..f65bfe32e 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -10,16 +10,11 @@ }, "logs": { "metrics_collected": { - "application_signals": {} - } - }, - "metrics": { - "metrics_collected": { - "application_signals": {} - }, - "otlp": { - "grpc_endpoint": "0.0.0.0:4317", - "http_endpoint": "0.0.0.0:4318" + "application_signals": {}, + "otlp": { + "grpc_endpoint": "0.0.0.0:4317", + "http_endpoint": "0.0.0.0:4318" + } } } } \ No newline at end of file From 3c2cbe14efe8370235a7f4f3bc88060b8f557392 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 10 Oct 2025 08:42:26 -0700 Subject: [PATCH 30/82] adding metrics section to test metrics pipeline --- .../django_frontend_service/frontend_service_app/views.py | 4 +++- terraform/python/ec2/default/amazon-cloudwatch-agent.json | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 2d7b5285d..91e9379a1 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -51,7 +51,9 @@ # Python version of 'OtlpHttpMetricExporter.builder().setEndpoint().build()' metricExporter = HTTPMetricExporter( - endpoint="http://localhost:4318/v1/metrics" + endpoint="http://localhost:4318/v1/metrics", + headers={"Content-Type": "application/x-protobuf"}, + timeout=30 ) # 'Python version of 'PeriodicMetricReader.builder(metricExporter).setInterval(Duration.ofSeconds(10)).build()' diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index f65bfe32e..906b884d1 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -10,7 +10,11 @@ }, "logs": { "metrics_collected": { - "application_signals": {}, + "application_signals": {} + } + }, + "metrics": { + "metrics_collected": { "otlp": { "grpc_endpoint": "0.0.0.0:4317", "http_endpoint": "0.0.0.0:4318" From b8cb6c50d54e3061e3cb000d51782de085863f09 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 10 Oct 2025 09:59:07 -0700 Subject: [PATCH 31/82] updating views and cwa --- .../frontend_service_app/views.py | 35 ++++++++++--------- .../ec2/default/amazon-cloudwatch-agent.json | 6 +--- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 91e9379a1..999adc860 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -38,11 +38,18 @@ # Initialize Console exporter - Direct output approach (OTEL export 2) Custom export pipeline custom_console_exporter = ConsoleMetricExporter() +agent_console_exporter = ConsoleMetricExporter() + custom_console_reader = PeriodicExportingMetricReader( exporter=custom_console_exporter, export_interval_millis=5000 ) +agent_console_reader = PeriodicExportingMetricReader( + exporter=agent_console_exporter, + export_interval_millis=5000 +) + # Custom Export Pipeline - HTTP Direct resource = Resource.create({ "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), @@ -50,35 +57,31 @@ }) # Python version of 'OtlpHttpMetricExporter.builder().setEndpoint().build()' -metricExporter = HTTPMetricExporter( +metric_exporter = HTTPMetricExporter( endpoint="http://localhost:4318/v1/metrics", - headers={"Content-Type": "application/x-protobuf"}, - timeout=30 ) # 'Python version of 'PeriodicMetricReader.builder(metricExporter).setInterval(Duration.ofSeconds(10)).build()' -metricReader = PeriodicExportingMetricReader( - exporter=metricExporter, +metric_reader = PeriodicExportingMetricReader( + exporter=metric_exporter, export_interval_millis=5000 ) -# Python version of 'SdkMeterProvider.builder().setResource(resource).registerMetricReader(metricReader).build()' -meterProvider = MeterProvider( - resource=resource, - metric_readers=[metricReader] -) - -# Create meter provider with both exporters +# Create meter provider with both exporters Python version of 'SdkMeterProvider.builder().setResource(resource).registerMetricReader(metricReader).build()' custom_meter_provider = MeterProvider( resource=custom_resource, metric_readers=[custom_otlp_reader, custom_console_reader] ) +agent_meter_provider = MeterProvider( + resource=resource, + metric_readers=[metric_reader, agent_console_reader] +) # Initialize counters/meters using custom meter provider. Python version of 'meterProvider.get("myMeter")' custom_meter = custom_meter_provider.get_meter("custom-metrics") -meter = meterProvider.get_meter("myMeter") +agent_meter = agent_meter_provider.get_meter("agent-metrics") custom_export_counter = custom_meter.create_counter("custom_export_counter", description="Total requests") -agent_export_counter = meter.create_counter("agent_export_counter", description="Total requests") +agent_export_counter = agent_meter.create_counter("agent_export_counter", description="Total requests") should_send_local_root_client_call = False lock = threading.Lock() @@ -115,8 +118,8 @@ def healthcheck(request): def aws_sdk_call(request): # Setup Span Attributes And Initialize Counter/Histogram To Recieve Custom Metrics - custom_export_counter.add(1, {"operation.type": "custom_export_1"}) # Agent-based export - agent_export_counter.add(1, {"operation.type": "agent_export_1"}) # Custom export pipeline + custom_export_counter.add(1, {"operation.type": "custom_export_1"}) # Custom export + agent_export_counter.add(1, {"operation.type": "agent_export_1"}) # Agent export pipeline bucket_name = "e2e-test-bucket-name" diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index 906b884d1..f65bfe32e 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -10,11 +10,7 @@ }, "logs": { "metrics_collected": { - "application_signals": {} - } - }, - "metrics": { - "metrics_collected": { + "application_signals": {}, "otlp": { "grpc_endpoint": "0.0.0.0:4317", "http_endpoint": "0.0.0.0:4318" From 9cfa435a44ef3c1c4cdfa6b1e68e80de4de0e614 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 10 Oct 2025 10:47:38 -0700 Subject: [PATCH 32/82] removing global variable --- terraform/python/ec2/default/main.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 9d83f8e50..57800e773 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -171,13 +171,12 @@ resource "null_resource" "main_service_setup" { export OTEL_PYTHON_DISTRO="aws_distro" export OTEL_PYTHON_CONFIGURATOR="aws_configurator" export OTEL_METRICS_EXPORTER=otlp - export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics export OTEL_TRACES_EXPORTER=otlp export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4315 export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4315 export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc - export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc + export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" From f616720fdb4d1c2526e6a4ec8402b2ea76e34234 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 10 Oct 2025 12:11:28 -0700 Subject: [PATCH 33/82] changing global variable to http to test exporter --- terraform/python/ec2/default/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 57800e773..1c5eb61d7 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -176,6 +176,7 @@ resource "null_resource" "main_service_setup" { export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4315 export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4315 export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc + export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=http/protobuf export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on From b4356ba49b04bfec810b5a57d7b46096bf62c391 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 10 Oct 2025 15:08:50 -0700 Subject: [PATCH 34/82] adding gauge/histogram and modifying export structure --- .github/workflows/test.yml | 11 +++- .../frontend_service_app/views.py | 55 +++++++------------ terraform/python/ec2/default/main.tf | 8 +-- terraform/python/ec2/default/variables.tf | 2 +- .../default/aws-otel-custom-metrics.mustache | 31 +++++++++-- 5 files changed, 61 insertions(+), 46 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f7aa4d4b2..47f9aa497 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,9 +15,18 @@ permissions: contents: read jobs: - java-ec2-adaptive-sampling: + java-ec2-default: uses: ./.github/workflows/python-ec2-default-test.yml secrets: inherit with: caller-workflow-name: 'test' aws-region: 'us-east-1' + custom-metrics-enabled: false + + custom-metrics: + uses: ./.github/workflows/python-ec2-default-test.yml + secrets: inherit + with: + caller-workflow-name: 'test' + aws-region: 'us-east-1' + custom-metrics-enabled: true diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 999adc860..eb8673510 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -19,13 +19,16 @@ from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter as HTTPMetricExporter from opentelemetry.sdk.metrics.export import ConsoleMetricExporter from opentelemetry.sdk.resources import Resource +from opentelemetry.sdk.metrics import Observation +import random logger = logging.getLogger(__name__) +test_gauge_memory = 512.0 #global variable for test gauge # Initialize custom OTEL metrics export pipeline - OTLP approach (OTEL/Span export 1) Agent based custom_resource = Resource.create({ "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), - "deployment.environment.name": "custom_export", + "deployment.environment.name": "ec2:default", }) custom_otlp_exporter = OTLPMetricExporter( endpoint="http://localhost:4317", @@ -38,50 +41,30 @@ # Initialize Console exporter - Direct output approach (OTEL export 2) Custom export pipeline custom_console_exporter = ConsoleMetricExporter() -agent_console_exporter = ConsoleMetricExporter() custom_console_reader = PeriodicExportingMetricReader( exporter=custom_console_exporter, export_interval_millis=5000 ) -agent_console_reader = PeriodicExportingMetricReader( - exporter=agent_console_exporter, - export_interval_millis=5000 -) - -# Custom Export Pipeline - HTTP Direct -resource = Resource.create({ - "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), - "deployment.environment.name": "agent_export", - }) - -# Python version of 'OtlpHttpMetricExporter.builder().setEndpoint().build()' -metric_exporter = HTTPMetricExporter( - endpoint="http://localhost:4318/v1/metrics", -) - -# 'Python version of 'PeriodicMetricReader.builder(metricExporter).setInterval(Duration.ofSeconds(10)).build()' -metric_reader = PeriodicExportingMetricReader( - exporter=metric_exporter, - export_interval_millis=5000 -) - # Create meter provider with both exporters Python version of 'SdkMeterProvider.builder().setResource(resource).registerMetricReader(metricReader).build()' custom_meter_provider = MeterProvider( resource=custom_resource, metric_readers=[custom_otlp_reader, custom_console_reader] ) -agent_meter_provider = MeterProvider( - resource=resource, - metric_readers=[metric_reader, agent_console_reader] -) + # Initialize counters/meters using custom meter provider. Python version of 'meterProvider.get("myMeter")' -custom_meter = custom_meter_provider.get_meter("custom-metrics") -agent_meter = agent_meter_provider.get_meter("agent-metrics") -custom_export_counter = custom_meter.create_counter("custom_export_counter", description="Total requests") -agent_export_counter = agent_meter.create_counter("agent_export_counter", description="Total requests") +custom_meter = custom_meter_provider.get_meter("custom-metrics") #Create custom_meter +custom_export_counter = custom_meter.create_counter("custom_export_counter", description="Total requests") #Create custom exporter counter +test_histogram = custom_meter.create_histogram("test_histogram", description="Request payload size", unit="bytes") #Create histogram + #Create gauge +test_gauge = custom_meter.create_observable_gauge( + name="test_gauge", + description="test gauge memory", + unit="MB", + callbacks=[lambda: [Observation(test_gauge_memory, {})]] +) should_send_local_root_client_call = False lock = threading.Lock() @@ -117,9 +100,13 @@ def healthcheck(request): return HttpResponse("healthcheck") def aws_sdk_call(request): - # Setup Span Attributes And Initialize Counter/Histogram To Recieve Custom Metrics + # Setup Span Attributes And Initialize Counter/Gauge/Histogram To Recieve Custom Metrics + global test_gauge_memory #Call memory variable into api to be updated + + start_time = time.time() #Begin histogram custom_export_counter.add(1, {"operation.type": "custom_export_1"}) # Custom export - agent_export_counter.add(1, {"operation.type": "agent_export_1"}) # Agent export pipeline + test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) #Record histogram + test_gauge_memory = random.uniform(400.0, 800.0) #Call gauge bucket_name = "e2e-test-bucket-name" diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 1c5eb61d7..34ab97c62 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -145,7 +145,7 @@ resource "null_resource" "main_service_setup" { sudo yum install ec2-instance-connect -y # Copy in CW Agent configuration - agent_config='${replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "$REGION", var.aws_region)}' + agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' echo $agent_config > amazon-cloudwatch-agent.json # Get and run CW agent rpm @@ -176,8 +176,8 @@ resource "null_resource" "main_service_setup" { export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4315 export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4315 export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc - export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=http/protobuf - export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics + export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc + export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317 export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" @@ -283,7 +283,7 @@ resource "null_resource" "remote_service_setup" { sudo yum install ec2-instance-connect -y # Copy in CW Agent configuration - agent_config='${replace(file(var.custom_metrics_enabled ? "./amazon-cloudwatch-custom-agent.json" : "./amazon-cloudwatch-agent.json"), "$REGION", var.aws_region)}' + agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}' echo "$agent_config" > amazon-cloudwatch-agent.json # Get and run CW agent rpm diff --git a/terraform/python/ec2/default/variables.tf b/terraform/python/ec2/default/variables.tf index 893378f3a..2fec6628c 100644 --- a/terraform/python/ec2/default/variables.tf +++ b/terraform/python/ec2/default/variables.tf @@ -54,5 +54,5 @@ variable "cpu_architecture" { variable "custom_metrics_enabled" { description = "Enable custom OTEL metrics in the sample application" type = bool - default = true + default = false } \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index 1f5d97f80..afdf02375 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -1,11 +1,11 @@ # OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only - metricName: custom_export_counter - namespace: {{customMetricNamespace}} + namespace: {{CWAgent}} dimensions: - name: deployment.environment.name - value: custom_export + value: ec2:default - name: service.name value: {{serviceName}} @@ -22,12 +22,12 @@ name: telemetry.sdk.name value: opentelemetry - - metricName: agent_export_counter - namespace: {{customMetricNamespace}} + metricName: test_histogram + namespace: {{CWAgent}} dimensions: - name: deployment.environment.name - value: agent_export + value: ec2:default - name: service.name value: {{serviceName}} @@ -36,7 +36,26 @@ value: python - name: operation.type - value: agent_export_1 + value: histogram + - + name: telemetry.sdk.version + value: 1.33.1 + - + name: telemetry.sdk.name + value: opentelemetry +- + metricName: test_gauge + namespace: {{CWAgent}} + dimensions: + - + name: deployment.environment.name + value: ec2:default + - + name: service.name + value: {{serviceName}} + - + name: telemetry.sdk.language + value: python - name: telemetry.sdk.version value: 1.33.1 From 801286c03570412198ed207985f8c07dff21bfbc Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 13 Oct 2025 09:49:58 -0700 Subject: [PATCH 35/82] updating views, metric-val, and default test --- .github/workflows/python-ec2-default-test.yml | 4 ---- .../frontend_service_app/views.py | 17 +++-------------- .../python/ec2/default/metric-validation.yml | 6 +----- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 62958159d..a1a1d0966 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -36,10 +36,6 @@ on: required: false type: boolean default: false - custom-metrics-config: - required: false - type: string - default: '{}' outputs: job-started: value: ${{ jobs.python-ec2-default.outputs.job-started }} diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index eb8673510..88245ee2c 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -16,14 +16,11 @@ from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter -from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter as HTTPMetricExporter from opentelemetry.sdk.metrics.export import ConsoleMetricExporter from opentelemetry.sdk.resources import Resource -from opentelemetry.sdk.metrics import Observation import random logger = logging.getLogger(__name__) -test_gauge_memory = 512.0 #global variable for test gauge # Initialize custom OTEL metrics export pipeline - OTLP approach (OTEL/Span export 1) Agent based custom_resource = Resource.create({ @@ -57,14 +54,8 @@ # Initialize counters/meters using custom meter provider. Python version of 'meterProvider.get("myMeter")' custom_meter = custom_meter_provider.get_meter("custom-metrics") #Create custom_meter custom_export_counter = custom_meter.create_counter("custom_export_counter", description="Total requests") #Create custom exporter counter -test_histogram = custom_meter.create_histogram("test_histogram", description="Request payload size", unit="bytes") #Create histogram - #Create gauge -test_gauge = custom_meter.create_observable_gauge( - name="test_gauge", - description="test gauge memory", - unit="MB", - callbacks=[lambda: [Observation(test_gauge_memory, {})]] -) +test_histogram = custom_meter.create_histogram("test_histogram", description="Request payload size") #Create histogram +test_gauge = custom_meter.create_gauge("test_gauge", description="test gauge memory") #Create synchronous gauge should_send_local_root_client_call = False lock = threading.Lock() @@ -101,12 +92,10 @@ def healthcheck(request): def aws_sdk_call(request): # Setup Span Attributes And Initialize Counter/Gauge/Histogram To Recieve Custom Metrics - global test_gauge_memory #Call memory variable into api to be updated - start_time = time.time() #Begin histogram custom_export_counter.add(1, {"operation.type": "custom_export_1"}) # Custom export test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) #Record histogram - test_gauge_memory = random.uniform(400.0, 800.0) #Call gauge + test_gauge.record(100.0, {"operation.type": "gauge"}) #Record gauge bucket_name = "e2e-test-bucket-name" diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index 0a18b0780..6dbaf8dc1 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -31,8 +31,4 @@ httpPath: "aws-sdk-call" httpMethod: "get" callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" -- - validationType: "cw-metric" - callingType: "none" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" \ No newline at end of file From 50d9ebd87663bc4f8b056b4a4d9fb27cf926c1ac Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 09:06:24 -0700 Subject: [PATCH 36/82] removing broken gauge, fixing typo --- .../frontend_service_app/views.py | 2 -- .../default/aws-otel-custom-metrics.mustache | 23 ++----------------- .../python/ec2/default/metric-validation.yml | 2 +- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 88245ee2c..97767fa40 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -55,7 +55,6 @@ custom_meter = custom_meter_provider.get_meter("custom-metrics") #Create custom_meter custom_export_counter = custom_meter.create_counter("custom_export_counter", description="Total requests") #Create custom exporter counter test_histogram = custom_meter.create_histogram("test_histogram", description="Request payload size") #Create histogram -test_gauge = custom_meter.create_gauge("test_gauge", description="test gauge memory") #Create synchronous gauge should_send_local_root_client_call = False lock = threading.Lock() @@ -95,7 +94,6 @@ def aws_sdk_call(request): start_time = time.time() #Begin histogram custom_export_counter.add(1, {"operation.type": "custom_export_1"}) # Custom export test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) #Record histogram - test_gauge.record(100.0, {"operation.type": "gauge"}) #Record gauge bucket_name = "e2e-test-bucket-name" diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index afdf02375..ce21500d4 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -1,7 +1,7 @@ # OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only - metricName: custom_export_counter - namespace: {{CWAgent}} + namespace: {{ApplicationSignals}} dimensions: - name: deployment.environment.name @@ -23,7 +23,7 @@ value: opentelemetry - metricName: test_histogram - namespace: {{CWAgent}} + namespace: {{ApplicationSignals}} dimensions: - name: deployment.environment.name @@ -40,25 +40,6 @@ - name: telemetry.sdk.version value: 1.33.1 - - - name: telemetry.sdk.name - value: opentelemetry -- - metricName: test_gauge - namespace: {{CWAgent}} - dimensions: - - - name: deployment.environment.name - value: ec2:default - - - name: service.name - value: {{serviceName}} - - - name: telemetry.sdk.language - value: python - - - name: telemetry.sdk.version - value: 1.33.1 - name: telemetry.sdk.name value: opentelemetry \ No newline at end of file diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index 6dbaf8dc1..645a5cf81 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -31,4 +31,4 @@ httpPath: "aws-sdk-call" httpMethod: "get" callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" \ No newline at end of file + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" \ No newline at end of file From a9e2febddfb6dde8e022a43867e1fdeaa0beeb52 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 09:30:55 -0700 Subject: [PATCH 37/82] updating predefined template and metric validation name to standards --- .../amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java | 2 +- .../python/ec2/default/aws-otel-custom-metrics.mustache | 4 ++-- .../validations/python/ec2/default/metric-validation.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index 2e2856783..9113058e9 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -211,7 +211,7 @@ public enum PredefinedExpectedTemplate implements FileConfig { PYTHON_EC2_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/python/ec2/default/client-call-trace.mustache"), /** Python EC2 Default Custom Metrics Test Case Validations */ - PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), + PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), /** Python EC2 Asg Test Case Validations */ PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_LOG("/expected-data-template/python/ec2/asg/outgoing-http-call-log.mustache"), diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index ce21500d4..04b882b6c 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -1,7 +1,7 @@ # OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only - metricName: custom_export_counter - namespace: {{ApplicationSignals}} + namespace: {{CWAgent}} dimensions: - name: deployment.environment.name @@ -23,7 +23,7 @@ value: opentelemetry - metricName: test_histogram - namespace: {{ApplicationSignals}} + namespace: {{CWAgent}} dimensions: - name: deployment.environment.name diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index 645a5cf81..6dbaf8dc1 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -31,4 +31,4 @@ httpPath: "aws-sdk-call" httpMethod: "get" callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRICS" \ No newline at end of file + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" \ No newline at end of file From 92e8620a943493c948ce5f6f9f092e813d624550 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 09:45:53 -0700 Subject: [PATCH 38/82] reverting back to last passing commit --- .github/workflows/python-ec2-default-test.yml | 4 ++++ .../django_frontend_service/frontend_service_app/views.py | 7 ++++++- .../validations/python/ec2/default/metric-validation.yml | 6 +++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index a1a1d0966..62958159d 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -36,6 +36,10 @@ on: required: false type: boolean default: false + custom-metrics-config: + required: false + type: string + default: '{}' outputs: job-started: value: ${{ jobs.python-ec2-default.outputs.job-started }} diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 97767fa40..2341e5800 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -16,11 +16,14 @@ from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter +from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter as HTTPMetricExporter from opentelemetry.sdk.metrics.export import ConsoleMetricExporter from opentelemetry.sdk.resources import Resource +from opentelemetry.sdk.metrics import Observation import random logger = logging.getLogger(__name__) +test_gauge_memory = 512.0 #global variable for test gauge # Initialize custom OTEL metrics export pipeline - OTLP approach (OTEL/Span export 1) Agent based custom_resource = Resource.create({ @@ -54,7 +57,7 @@ # Initialize counters/meters using custom meter provider. Python version of 'meterProvider.get("myMeter")' custom_meter = custom_meter_provider.get_meter("custom-metrics") #Create custom_meter custom_export_counter = custom_meter.create_counter("custom_export_counter", description="Total requests") #Create custom exporter counter -test_histogram = custom_meter.create_histogram("test_histogram", description="Request payload size") #Create histogram +test_histogram = custom_meter.create_histogram("test_histogram", description="Request payload size", unit="bytes") #Create histogram should_send_local_root_client_call = False lock = threading.Lock() @@ -91,6 +94,8 @@ def healthcheck(request): def aws_sdk_call(request): # Setup Span Attributes And Initialize Counter/Gauge/Histogram To Recieve Custom Metrics + global test_gauge_memory #Call memory variable into api to be updated + start_time = time.time() #Begin histogram custom_export_counter.add(1, {"operation.type": "custom_export_1"}) # Custom export test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) #Record histogram diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index 6dbaf8dc1..52ea67eb8 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -31,4 +31,8 @@ httpPath: "aws-sdk-call" httpMethod: "get" callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" \ No newline at end of file + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" +- + validationType: "cw-metric" + callingType: "none" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" From effd5d6911f343f7cd5aa90ba656bb1cad2286f7 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 10:33:31 -0700 Subject: [PATCH 39/82] adding telemetry.status to resource --- .../django_frontend_service/frontend_service_app/views.py | 1 + .../validations/python/ec2/default/metric-validation.yml | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 2341e5800..685b83d5f 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -29,6 +29,7 @@ custom_resource = Resource.create({ "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), "deployment.environment.name": "ec2:default", + "telemetry.source": "EC2", }) custom_otlp_exporter = OTLPMetricExporter( endpoint="http://localhost:4317", diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index 52ea67eb8..839000a3b 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -32,7 +32,3 @@ httpMethod: "get" callingType: "http-with-query" expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" -- - validationType: "cw-metric" - callingType: "none" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" From ce893f221354e62a8a34189b9bbde1252a314b0c Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 10:44:02 -0700 Subject: [PATCH 40/82] updating namespace --- .../python/ec2/default/aws-otel-custom-metrics.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index 04b882b6c..ce21500d4 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -1,7 +1,7 @@ # OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only - metricName: custom_export_counter - namespace: {{CWAgent}} + namespace: {{ApplicationSignals}} dimensions: - name: deployment.environment.name @@ -23,7 +23,7 @@ value: opentelemetry - metricName: test_histogram - namespace: {{CWAgent}} + namespace: {{ApplicationSignals}} dimensions: - name: deployment.environment.name From c3b25d074474c0b45945c5e398c30390a251129e Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 11:31:24 -0700 Subject: [PATCH 41/82] removing custom export pipeline --- .../ec2-requirements.txt | 2 - .../frontend_service_app/views.py | 55 ++----------------- sample-apps/python/genai_service/server.py | 2 +- 3 files changed, 6 insertions(+), 53 deletions(-) diff --git a/sample-apps/python/django_frontend_service/ec2-requirements.txt b/sample-apps/python/django_frontend_service/ec2-requirements.txt index 5aa7fbb67..bb91a04b1 100644 --- a/sample-apps/python/django_frontend_service/ec2-requirements.txt +++ b/sample-apps/python/django_frontend_service/ec2-requirements.txt @@ -6,5 +6,3 @@ requests~=2.25.1 schedule~=1.2.1 opentelemetry-sdk==1.33.1 opentelemetry-api==1.33.1 -opentelemetry-exporter-otlp-proto-http==1.33.1 -opentelemetry-exporter-otlp-proto-grpc==1.33.1 \ No newline at end of file diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 685b83d5f..4bbe0402b 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -13,52 +13,12 @@ from django.http import HttpResponse, JsonResponse from opentelemetry import trace, metrics from opentelemetry.trace.span import format_trace_id -from opentelemetry.sdk.metrics import MeterProvider -from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader -from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter -from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter as HTTPMetricExporter -from opentelemetry.sdk.metrics.export import ConsoleMetricExporter -from opentelemetry.sdk.resources import Resource -from opentelemetry.sdk.metrics import Observation -import random logger = logging.getLogger(__name__) -test_gauge_memory = 512.0 #global variable for test gauge - -# Initialize custom OTEL metrics export pipeline - OTLP approach (OTEL/Span export 1) Agent based -custom_resource = Resource.create({ - "service.name": os.getenv("OTEL_SERVICE_NAME", "python-sample-application"), - "deployment.environment.name": "ec2:default", - "telemetry.source": "EC2", - }) -custom_otlp_exporter = OTLPMetricExporter( - endpoint="http://localhost:4317", - insecure=True -) -custom_otlp_reader = PeriodicExportingMetricReader( - exporter=custom_otlp_exporter, - export_interval_millis=5000 -) - -# Initialize Console exporter - Direct output approach (OTEL export 2) Custom export pipeline -custom_console_exporter = ConsoleMetricExporter() - -custom_console_reader = PeriodicExportingMetricReader( - exporter=custom_console_exporter, - export_interval_millis=5000 -) - -# Create meter provider with both exporters Python version of 'SdkMeterProvider.builder().setResource(resource).registerMetricReader(metricReader).build()' -custom_meter_provider = MeterProvider( - resource=custom_resource, - metric_readers=[custom_otlp_reader, custom_console_reader] -) - - -# Initialize counters/meters using custom meter provider. Python version of 'meterProvider.get("myMeter")' -custom_meter = custom_meter_provider.get_meter("custom-metrics") #Create custom_meter -custom_export_counter = custom_meter.create_counter("custom_export_counter", description="Total requests") #Create custom exporter counter -test_histogram = custom_meter.create_histogram("test_histogram", description="Request payload size", unit="bytes") #Create histogram + +#python equivalent of Meter meter = GlobalOpenTelemetry.getMeter("myMeter"); +meter = metrics.get_meter("myMeter") +agent_export_counter = meter.create_counter("agent_export_counter", unit="1", description="Agent export counter") should_send_local_root_client_call = False lock = threading.Lock() @@ -94,12 +54,7 @@ def healthcheck(request): return HttpResponse("healthcheck") def aws_sdk_call(request): - # Setup Span Attributes And Initialize Counter/Gauge/Histogram To Recieve Custom Metrics - global test_gauge_memory #Call memory variable into api to be updated - - start_time = time.time() #Begin histogram - custom_export_counter.add(1, {"operation.type": "custom_export_1"}) # Custom export - test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) #Record histogram + agent_export_counter.add(1, {"operation_type": "custom_counter"}) bucket_name = "e2e-test-bucket-name" diff --git a/sample-apps/python/genai_service/server.py b/sample-apps/python/genai_service/server.py index 3247f69af..1ef073e9e 100644 --- a/sample-apps/python/genai_service/server.py +++ b/sample-apps/python/genai_service/server.py @@ -45,7 +45,7 @@ "temperature": 0.7, "max_tokens": 500 }, - region_name=os.getenv("AWS_DEFAULT_REGION", "us-east-1") + region_name=os.getenv("AWS_DEFAULT_REGION", "us-west-2") ) # Create a prompt template From f83f427557ef1f8dc52cba217305a1db9b96bde2 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 11:52:07 -0700 Subject: [PATCH 42/82] updating views --- .../frontend_service_app/views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 4bbe0402b..183dac833 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -5,7 +5,7 @@ import base64 import threading import time - +import random import boto3 import pymysql import requests @@ -18,7 +18,8 @@ #python equivalent of Meter meter = GlobalOpenTelemetry.getMeter("myMeter"); meter = metrics.get_meter("myMeter") -agent_export_counter = meter.create_counter("agent_export_counter", unit="1", description="Agent export counter") +custom_export_counter = meter.create_counter("custom_export_counter", unit="1", description="Custom export counter") +test_histogram = meter.create_histogram("test_histogram", description="Test histogram", unit="bytes") should_send_local_root_client_call = False lock = threading.Lock() @@ -54,8 +55,8 @@ def healthcheck(request): return HttpResponse("healthcheck") def aws_sdk_call(request): - agent_export_counter.add(1, {"operation_type": "custom_counter"}) - + custom_export_counter.add(1, {"operation.type": "custom_export_1"}) + test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) bucket_name = "e2e-test-bucket-name" # Add a unique test ID to bucketname to associate buckets to specific test runs From 79f9a0928d75a16d0ca9ff8d7d72e1cbfff4e869 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 12:21:47 -0700 Subject: [PATCH 43/82] updating traffic generator to hit custom endpoints --- .../django_frontend_service/django_frontend_service/urls.py | 2 ++ .../django_frontend_service/frontend_service_app/views.py | 2 ++ sample-apps/traffic-generator/index.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/sample-apps/python/django_frontend_service/django_frontend_service/urls.py b/sample-apps/python/django_frontend_service/django_frontend_service/urls.py index a099782b5..3a742e9fd 100644 --- a/sample-apps/python/django_frontend_service/django_frontend_service/urls.py +++ b/sample-apps/python/django_frontend_service/django_frontend_service/urls.py @@ -10,4 +10,6 @@ path('remote-service', views.downstream_service), path('client-call', views.async_service), path('mysql', views.mysql), + path('custom-export-counter', views.custom_export_counter_endpoint), + path('test-histogram', views.test_histogram_endpoint), ] diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 183dac833..6dfe7149c 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -55,8 +55,10 @@ def healthcheck(request): return HttpResponse("healthcheck") def aws_sdk_call(request): + logger.info("Recording custom metrics in aws_sdk_call") custom_export_counter.add(1, {"operation.type": "custom_export_1"}) test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) + logger.info("Custom metrics recorded successfully") bucket_name = "e2e-test-bucket-name" # Add a unique test ID to bucketname to associate buckets to specific test runs diff --git a/sample-apps/traffic-generator/index.js b/sample-apps/traffic-generator/index.js index 7ba051126..4c11eb555 100644 --- a/sample-apps/traffic-generator/index.js +++ b/sample-apps/traffic-generator/index.js @@ -44,6 +44,8 @@ const trafficGenerator = async (interval) => { `http://${mainEndpoint}/remote-service?ip=${remoteEndpoint}&testingId=${id}`, `http://${mainEndpoint}/client-call`, `http://${mainEndpoint}/mysql`, + `http://${mainEndpoint}/custom-export-counter`, + `http://${mainEndpoint}/test-histogram`, ]; await sendRequests(urls); From 29c32d629de7fde7877e4b4e78c2d8c10cbbea6e Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 14:00:28 -0700 Subject: [PATCH 44/82] updating according to public docs. --- .../django_frontend_service/django_frontend_service/urls.py | 2 -- .../django_frontend_service/frontend_service_app/views.py | 5 ++--- sample-apps/traffic-generator/index.js | 2 -- terraform/python/ec2/default/amazon-cloudwatch-agent.json | 4 ---- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/sample-apps/python/django_frontend_service/django_frontend_service/urls.py b/sample-apps/python/django_frontend_service/django_frontend_service/urls.py index 3a742e9fd..a099782b5 100644 --- a/sample-apps/python/django_frontend_service/django_frontend_service/urls.py +++ b/sample-apps/python/django_frontend_service/django_frontend_service/urls.py @@ -10,6 +10,4 @@ path('remote-service', views.downstream_service), path('client-call', views.async_service), path('mysql', views.mysql), - path('custom-export-counter', views.custom_export_counter_endpoint), - path('test-histogram', views.test_histogram_endpoint), ] diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 6dfe7149c..9846a056c 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -19,7 +19,7 @@ #python equivalent of Meter meter = GlobalOpenTelemetry.getMeter("myMeter"); meter = metrics.get_meter("myMeter") custom_export_counter = meter.create_counter("custom_export_counter", unit="1", description="Custom export counter") -test_histogram = meter.create_histogram("test_histogram", description="Test histogram", unit="bytes") +test_histogram = meter.create_histogram("test_histogram", description="Test histogram") should_send_local_root_client_call = False lock = threading.Lock() @@ -55,10 +55,9 @@ def healthcheck(request): return HttpResponse("healthcheck") def aws_sdk_call(request): - logger.info("Recording custom metrics in aws_sdk_call") custom_export_counter.add(1, {"operation.type": "custom_export_1"}) test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) - logger.info("Custom metrics recorded successfully") + bucket_name = "e2e-test-bucket-name" # Add a unique test ID to bucketname to associate buckets to specific test runs diff --git a/sample-apps/traffic-generator/index.js b/sample-apps/traffic-generator/index.js index 4c11eb555..7ba051126 100644 --- a/sample-apps/traffic-generator/index.js +++ b/sample-apps/traffic-generator/index.js @@ -44,8 +44,6 @@ const trafficGenerator = async (interval) => { `http://${mainEndpoint}/remote-service?ip=${remoteEndpoint}&testingId=${id}`, `http://${mainEndpoint}/client-call`, `http://${mainEndpoint}/mysql`, - `http://${mainEndpoint}/custom-export-counter`, - `http://${mainEndpoint}/test-histogram`, ]; await sendRequests(urls); diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index f65bfe32e..22c1eb736 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -1,8 +1,4 @@ { - "agent": { - "debug": true, - "region": "$REGION" - }, "traces": { "traces_collected": { "application_signals": {} From 7153eaf96c60f15a29aeababd1d73ec23750a793 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 14:30:34 -0700 Subject: [PATCH 45/82] testing new cwa config --- terraform/python/ec2/default/amazon-cloudwatch-agent.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index 22c1eb736..edca855ac 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -4,13 +4,17 @@ "application_signals": {} } }, - "logs": { + "metrics": { "metrics_collected": { - "application_signals": {}, "otlp": { "grpc_endpoint": "0.0.0.0:4317", "http_endpoint": "0.0.0.0:4318" } } + }, + "logs": { + "metrics_collected": { + "application_signals": {} + } } } \ No newline at end of file From 1c5f429841119d10ba441c545d813e54a53fd43e Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 15:22:10 -0700 Subject: [PATCH 46/82] reverting cwagent and adding logging to metric validator --- terraform/python/ec2/default/amazon-cloudwatch-agent.json | 8 ++------ .../java/com/amazon/aoc/validators/CWMetricValidator.java | 3 +++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index edca855ac..22c1eb736 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -4,17 +4,13 @@ "application_signals": {} } }, - "metrics": { + "logs": { "metrics_collected": { + "application_signals": {}, "otlp": { "grpc_endpoint": "0.0.0.0:4317", "http_endpoint": "0.0.0.0:4318" } } - }, - "logs": { - "metrics_collected": { - "application_signals": {} - } } } \ No newline at end of file diff --git a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java index dca2d964f..49fcb7f25 100644 --- a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java +++ b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java @@ -101,9 +101,12 @@ public void validate() throws Exception { } // We will query the Service, RemoteService, and RemoteTarget dimensions to ensure we // get all metrics from all aggregations, specifically the [RemoteService] aggregation. + log.info("DEBUG: context.getServiceName() = {}", context.getServiceName()); + log.info("DEBUG: context.getMetricNamespace() = {}", context.getMetricNamespace()); List serviceNames = Lists.newArrayList( context.getServiceName(), context.getRemoteServiceDeploymentName()); + log.info("DEBUG: serviceNames = {}", serviceNames); List remoteServiceNames = Lists.newArrayList(context.getRemoteServiceDeploymentName()); List remoteTargetNames = Lists.newArrayList(); From 710b4c30a59f1aaba7077fc52b0f1369b2bb5ea0 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 15:43:40 -0700 Subject: [PATCH 47/82] adding more log debuggers --- .../java/com/amazon/aoc/validators/CWMetricValidator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java index 49fcb7f25..356aabe99 100644 --- a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java +++ b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java @@ -161,9 +161,11 @@ private void addMetrics( List actualMetricList) throws Exception { for (String dimensionValue : dimensionValues) { - actualMetricList.addAll( - this.listMetricFromCloudWatch( - cloudWatchService, expectedMetricList, dimensionName, dimensionValue)); + log.info("DEBUG: Querying CloudWatch for dimension {}={}", dimensionName, dimensionValue); + List foundMetrics = this.listMetricFromCloudWatch( + cloudWatchService, expectedMetricList, dimensionName, dimensionValue); + log.info("DEBUG: Found {} metrics for {}={}", foundMetrics.size(), dimensionName, dimensionValue); + actualMetricList.addAll(foundMetrics); } } From 0a29d7e3af00125efc4ce286ccc62a248469dc70 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 18:13:46 -0700 Subject: [PATCH 48/82] adjusting otlp metrics end point for test --- .../frontend_service_app/views.py | 15 +++++++++++++++ terraform/python/ec2/default/main.tf | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 9846a056c..205908a2a 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -55,8 +55,23 @@ def healthcheck(request): return HttpResponse("healthcheck") def aws_sdk_call(request): + # Debug OTEL configuration + logger.info(f"OTEL_EXPORTER_OTLP_METRICS_PROTOCOL: {os.getenv('OTEL_EXPORTER_OTLP_METRICS_PROTOCOL')}") + logger.info(f"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: {os.getenv('OTEL_EXPORTER_OTLP_METRICS_ENDPOINT')}") + + # Debug metric provider + provider = metrics.get_meter_provider() + logger.info(f"MeterProvider type: {type(provider).__name__}") + if hasattr(provider, '_readers'): + logger.info(f"Active metric readers: {len(provider._readers)}") + for reader in provider._readers: + logger.info(f"Reader type: {type(reader).__name__}") + if hasattr(reader, '_exporter'): + logger.info(f"Exporter type: {type(reader._exporter).__name__}") + custom_export_counter.add(1, {"operation.type": "custom_export_1"}) test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) + logger.info("Custom metrics recorded") bucket_name = "e2e-test-bucket-name" diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 34ab97c62..93aa38bb8 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -177,7 +177,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4315 export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc - export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317 + export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=localhost:4317 export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" From e2e01a8f7965061058e07bf48a6367dcea5bd0f0 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 14 Oct 2025 18:26:26 -0700 Subject: [PATCH 49/82] making grpc unecrypted --- terraform/python/ec2/default/main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 93aa38bb8..c8b744e23 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -177,7 +177,8 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4315 export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc - export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=localhost:4317 + export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317 + export OTEL_EXPORTER_OTLP_INSECURE=true export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" From 5d84db692404e2ddc9d22740f1d966e6f2d7655a Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 15 Oct 2025 12:57:46 -0700 Subject: [PATCH 50/82] Revert "making grpc unecrypted" This reverts commit e2e01a8f7965061058e07bf48a6367dcea5bd0f0. --- terraform/python/ec2/default/main.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index c8b744e23..93aa38bb8 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -177,8 +177,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4315 export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc - export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4317 - export OTEL_EXPORTER_OTLP_INSECURE=true + export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=localhost:4317 export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" From 9a649bc005344174eb71a4439023706d9012114d Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 15 Oct 2025 13:22:59 -0700 Subject: [PATCH 51/82] attempt to revert back to test id-18514948781-1549-2067 --- terraform/python/ec2/default/main.tf | 1 + .../python/ec2/default/aws-otel-custom-metrics.mustache | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 93aa38bb8..bfddd39ed 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -178,6 +178,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=localhost:4317 + export OTEL_EXPORTER_OTLP_INSECURE=true export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index ce21500d4..04b882b6c 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -1,7 +1,7 @@ # OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only - metricName: custom_export_counter - namespace: {{ApplicationSignals}} + namespace: {{CWAgent}} dimensions: - name: deployment.environment.name @@ -23,7 +23,7 @@ value: opentelemetry - metricName: test_histogram - namespace: {{ApplicationSignals}} + namespace: {{CWAgent}} dimensions: - name: deployment.environment.name From a4ba51dfa402eb32a0c7fa8a02c06a2fd254ecfe Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 15 Oct 2025 15:30:50 -0700 Subject: [PATCH 52/82] adding validator for CWAgent --- .github/workflows/python-ec2-default-test.yml | 21 +++++++++++++++++-- .../aoc/validators/CWMetricValidator.java | 4 ++-- .../ec2/default/custom-metric-validation.yml | 6 ++++++ .../python/ec2/default/metric-validation.yml | 6 ------ 4 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 62958159d..a49c79ec7 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -261,9 +261,26 @@ jobs: --instance-id ${{ env.MAIN_SERVICE_INSTANCE_ID }} --rollup' + - name: Validate CWAgent metrics + id: cwagent-metric-validation + if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() + run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml + --testing-id ${{ env.TESTING_ID }} + --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} + --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001 + --region ${{ env.E2E_TEST_AWS_REGION }} + --metric-namespace CWAgent + --log-group ${{ env.LOG_GROUP_NAME }} + --service-name python-sample-application-${{ env.TESTING_ID }} + --remote-service-name python-sample-remote-application-${{ env.TESTING_ID }} + --query-string ip=${{ env.REMOTE_SERVICE_IP }} + --instance-ami ${{ env.EC2_INSTANCE_AMI }} + --instance-id ${{ env.MAIN_SERVICE_INSTANCE_ID }} + --rollup' + - name: Validate generated traces id: trace-validation - if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled() + if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || steps.cwagent-metric-validation.outcome == 'failure') && !cancelled() run: ./gradlew validator:run --args='-c python/ec2/default/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} @@ -290,7 +307,7 @@ jobs: if: always() id: validation-result run: | - if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then + if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.cwagent-metric-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then echo "validation-result=success" >> $GITHUB_OUTPUT else echo "validation-result=failure" >> $GITHUB_OUTPUT diff --git a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java index 356aabe99..332ef7f6b 100644 --- a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java +++ b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java @@ -99,8 +99,8 @@ public void validate() throws Exception { validateAnyMetricExists(); return; } - // We will query the Service, RemoteService, and RemoteTarget dimensions to ensure we - // get all metrics from all aggregations, specifically the [RemoteService] aggregation. + // Query the Service, RemoteService, and RemoteTarget dimensions to ensure we + // Get all metrics from all aggregations, specifically the [RemoteService] aggregation. log.info("DEBUG: context.getServiceName() = {}", context.getServiceName()); log.info("DEBUG: context.getMetricNamespace() = {}", context.getMetricNamespace()); List serviceNames = diff --git a/validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml new file mode 100644 index 000000000..4513a9405 --- /dev/null +++ b/validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml @@ -0,0 +1,6 @@ +- + validationType: "cw-metric" + httpPath: "aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index 839000a3b..e2b2b63fa 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -26,9 +26,3 @@ validationType: "cw-metric" callingType: "none" expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" -- - validationType: "cw-metric" - httpPath: "aws-sdk-call" - httpMethod: "get" - callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" From dd6c12ce640e0ebb4e909355d90e3ed9de50c0f6 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 15 Oct 2025 15:54:29 -0700 Subject: [PATCH 53/82] testing out single validator file --- .github/workflows/python-ec2-default-test.yml | 2 +- .../validations/python/ec2/default/metric-validation.yml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index a49c79ec7..81ac2c0cf 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -264,7 +264,7 @@ jobs: - name: Validate CWAgent metrics id: cwagent-metric-validation if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() - run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml + run: ./gradlew validator:run --args='-c python/ec2/default/metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001 diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index e2b2b63fa..6dbaf8dc1 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -26,3 +26,9 @@ validationType: "cw-metric" callingType: "none" expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" +- + validationType: "cw-metric" + httpPath: "aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" \ No newline at end of file From f0f890d8417789cd19333cd09f1d085c013f5272 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 07:49:07 -0700 Subject: [PATCH 54/82] reverting back to separate validation files --- .github/workflows/python-ec2-default-test.yml | 2 +- .../validations/python/ec2/default/metric-validation.yml | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 81ac2c0cf..a49c79ec7 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -264,7 +264,7 @@ jobs: - name: Validate CWAgent metrics id: cwagent-metric-validation if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() - run: ./gradlew validator:run --args='-c python/ec2/default/metric-validation.yml + run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001 diff --git a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml index 6dbaf8dc1..addeba20a 100644 --- a/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml +++ b/validator/src/main/resources/validations/python/ec2/default/metric-validation.yml @@ -25,10 +25,4 @@ - validationType: "cw-metric" callingType: "none" - expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" -- - validationType: "cw-metric" - httpPath: "aws-sdk-call" - httpMethod: "get" - callingType: "http-with-query" - expectedMetricTemplate: "PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" \ No newline at end of file + expectedMetricTemplate: "PYTHON_RUNTIME_METRIC" \ No newline at end of file From b6bab9e7ded5ec16cdf07d925ce5185e0b24c223 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 08:11:31 -0700 Subject: [PATCH 55/82] updating dimension value of custom_export_counter --- .../python/ec2/default/aws-otel-custom-metrics.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index 04b882b6c..1c574ba39 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -5,7 +5,7 @@ dimensions: - name: deployment.environment.name - value: ec2:default + value: custom_export - name: service.name value: {{serviceName}} From 34087f44674e447aa5b3a9c589ead841351aa430 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 09:07:37 -0700 Subject: [PATCH 56/82] updating validation dimensions --- .../default/aws-otel-custom-metrics.mustache | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index 1c574ba39..cf77a2b67 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -3,9 +3,39 @@ metricName: custom_export_counter namespace: {{CWAgent}} dimensions: + - + name: aws.local.service + value: {{serviceName}} + - + name: cloud.region + value: us-east-1 + - + name: host.type + value: t3.micro + - + name: cloud.availability_zone + value: us-east-1d + - + name: cloud.provider + value: aws + - + name: cloud.account.id + value: 654654176582 + - + name: host.name + value: ANY_VALUE + - + name: host.id + value: ANY_VALUE + - + name: telemetry.auto.version + value: ANY_VALUE + - + name: cloud.platform + value: ANY_VALUE - name: deployment.environment.name - value: custom_export + value: ec2:default - name: service.name value: {{serviceName}} @@ -25,6 +55,36 @@ metricName: test_histogram namespace: {{CWAgent}} dimensions: + - + name: aws.local.service + value: {{serviceName}} + - + name: cloud.region + value: us-east-1 + - + name: host.type + value: t3.micro + - + name: cloud.availability_zone + value: us-east-1d + - + name: cloud.provider + value: aws + - + name: cloud.account.id + value: 654654176582 + - + name: host.name + value: ANY_VALUE + - + name: host.id + value: ANY_VALUE + - + name: telemetry.auto.version + value: ANY_VALUE + - + name: cloud.platform + value: ANY_VALUE - name: deployment.environment.name value: ec2:default From 1f74499b02b50990cc1aef2f70fad5067fd89d6e Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 09:42:37 -0700 Subject: [PATCH 57/82] adding debug loggers --- .../com/amazon/aoc/validators/CWMetricValidator.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java index 332ef7f6b..966f432e6 100644 --- a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java +++ b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java @@ -250,9 +250,12 @@ private List listMetricFromCloudWatch( // search by metric name List result = new ArrayList<>(); for (String metricName : metricNameMap.keySet()) { - result.addAll( - cloudWatchService.listMetrics( - metricNameMap.get(metricName), metricName, dimensionKey, dimensionValue)); + String namespace = metricNameMap.get(metricName); + log.info("DEBUG: CloudWatch Query - Namespace: {}, MetricName: {}, DimensionKey: {}, DimensionValue: {}", + namespace, metricName, dimensionKey, dimensionValue); + List metrics = cloudWatchService.listMetrics(namespace, metricName, dimensionKey, dimensionValue); + log.info("DEBUG: CloudWatch Query Result - Found {} metrics", metrics.size()); + result.addAll(metrics); } return result; } From db6fda5c83f937ca4141b3f8377e97516e55ea58 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 09:52:45 -0700 Subject: [PATCH 58/82] updating validation template --- .../python/ec2/default/aws-otel-custom-metrics.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index cf77a2b67..4564fa599 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -1,7 +1,7 @@ # OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only - metricName: custom_export_counter - namespace: {{CWAgent}} + namespace: CWAgent dimensions: - name: aws.local.service @@ -53,7 +53,7 @@ value: opentelemetry - metricName: test_histogram - namespace: {{CWAgent}} + namespace: CWAgent dimensions: - name: aws.local.service From ea96f6e3c0af16b9aa9149dba17c44085383acf9 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 10:28:39 -0700 Subject: [PATCH 59/82] updating service.name attribute to Service --- terraform/python/ec2/default/main.tf | 2 +- .../default/aws-otel-custom-metrics.mustache | 64 +------------------ 2 files changed, 3 insertions(+), 63 deletions(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index bfddd39ed..ab139692c 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -181,7 +181,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_INSECURE=true export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on - export OTEL_RESOURCE_ATTRIBUTES="service.name=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" + export OTEL_RESOURCE_ATTRIBUTES="Service=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' export RDS_MYSQL_CLUSTER_ENDPOINT='dummy-endpoint' diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index 4564fa599..b4160de98 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -3,41 +3,11 @@ metricName: custom_export_counter namespace: CWAgent dimensions: - - - name: aws.local.service - value: {{serviceName}} - - - name: cloud.region - value: us-east-1 - - - name: host.type - value: t3.micro - - - name: cloud.availability_zone - value: us-east-1d - - - name: cloud.provider - value: aws - - - name: cloud.account.id - value: 654654176582 - - - name: host.name - value: ANY_VALUE - - - name: host.id - value: ANY_VALUE - - - name: telemetry.auto.version - value: ANY_VALUE - - - name: cloud.platform - value: ANY_VALUE - name: deployment.environment.name value: ec2:default - - name: service.name + name: Service value: {{serviceName}} - name: telemetry.sdk.language @@ -55,41 +25,11 @@ metricName: test_histogram namespace: CWAgent dimensions: - - - name: aws.local.service - value: {{serviceName}} - - - name: cloud.region - value: us-east-1 - - - name: host.type - value: t3.micro - - - name: cloud.availability_zone - value: us-east-1d - - - name: cloud.provider - value: aws - - - name: cloud.account.id - value: 654654176582 - - - name: host.name - value: ANY_VALUE - - - name: host.id - value: ANY_VALUE - - - name: telemetry.auto.version - value: ANY_VALUE - - - name: cloud.platform - value: ANY_VALUE - name: deployment.environment.name value: ec2:default - - name: service.name + name: Service value: {{serviceName}} - name: telemetry.sdk.language From f360d974e2e4554037bc8bb85cfa6224906ddba4 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 10:30:31 -0700 Subject: [PATCH 60/82] updating service.name attribute to Service --- terraform/python/ec2/default/main.tf | 2 +- .../python/ec2/default/aws-otel-custom-metrics.mustache | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index ab139692c..9acc47dc6 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -181,7 +181,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_INSECURE=true export OTEL_SERVICE_NAME=python-sample-application-${var.test_id} export OTEL_TRACES_SAMPLER=always_on - export OTEL_RESOURCE_ATTRIBUTES="Service=python-sample-application-${var.test_id},deployment.environment.name=ec2:default" + export OTEL_RESOURCE_ATTRIBUTES="Service=python-sample-application-${var.test_id},Environment=ec2:default" export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' export RDS_MYSQL_CLUSTER_ENDPOINT='dummy-endpoint' diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index b4160de98..963d841c8 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -4,7 +4,7 @@ namespace: CWAgent dimensions: - - name: deployment.environment.name + name: Environment value: ec2:default - name: Service @@ -26,7 +26,7 @@ namespace: CWAgent dimensions: - - name: deployment.environment.name + name: Environment value: ec2:default - name: Service From 523e41b3c38db1c9fddfd942e8b15ebe36e730b5 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 10:54:38 -0700 Subject: [PATCH 61/82] updating val templates with temp values for testing --- .../default/aws-otel-custom-metrics.mustache | 84 +++++++++++++++++-- 1 file changed, 75 insertions(+), 9 deletions(-) diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index 963d841c8..f7a739376 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -10,17 +10,50 @@ name: Service value: {{serviceName}} - - name: telemetry.sdk.language - value: python + name: aws.local.service + value: {{serviceName}} + - + name: cloud.account.id + value: ANY_VALUE + - + name: cloud.availability_zone + value: ANY_VALUE + - + name: cloud.platform + value: ANY_VALUE + - + name: cloud.provider + value: aws + - + name: cloud.region + value: us-east-1 + - + name: host.id + value: ANY_VALUE + - + name: host.name + value: ANY_VALUE + - + name: host.type + value: ANY_VALUE - name: operation.type value: custom_export_1 - - name: telemetry.sdk.version - value: 1.33.1 + name: service.name + value: {{serviceName}} + - + name: telemetry.auto.version + value: ANY_VALUE + - + name: telemetry.sdk.language + value: python - name: telemetry.sdk.name value: opentelemetry + - + name: telemetry.sdk.version + value: 1.33.1 - metricName: test_histogram namespace: CWAgent @@ -32,14 +65,47 @@ name: Service value: {{serviceName}} - - name: telemetry.sdk.language - value: python + name: aws.local.service + value: {{serviceName}} + - + name: cloud.account.id + value: ANY_VALUE + - + name: cloud.availability_zone + value: ANY_VALUE + - + name: cloud.platform + value: ANY_VALUE + - + name: cloud.provider + value: aws + - + name: cloud.region + value: us-east-1 + - + name: host.id + value: ANY_VALUE + - + name: host.name + value: ANY_VALUE + - + name: host.type + value: ANY_VALUE - name: operation.type value: histogram - - name: telemetry.sdk.version - value: 1.33.1 + name: service.name + value: {{serviceName}} + - + name: telemetry.auto.version + value: ANY_VALUE + - + name: telemetry.sdk.language + value: python - name: telemetry.sdk.name - value: opentelemetry \ No newline at end of file + value: opentelemetry + - + name: telemetry.sdk.version + value: 1.33.1 \ No newline at end of file From 9149f84bab8b042c65f293923183c81d6eb226b6 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 11:31:17 -0700 Subject: [PATCH 62/82] removing debuggers/loggers --- .../frontend_service_app/views.py | 17 ++--------------- .../aoc/validators/CWMetricValidator.java | 9 +-------- .../default/aws-otel-custom-metrics.mustache | 1 + 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/sample-apps/python/django_frontend_service/frontend_service_app/views.py b/sample-apps/python/django_frontend_service/frontend_service_app/views.py index 205908a2a..bd49bdb99 100644 --- a/sample-apps/python/django_frontend_service/frontend_service_app/views.py +++ b/sample-apps/python/django_frontend_service/frontend_service_app/views.py @@ -16,7 +16,7 @@ logger = logging.getLogger(__name__) -#python equivalent of Meter meter = GlobalOpenTelemetry.getMeter("myMeter"); +#python equivalent of Meter meter = GlobalOpenTelemetry.getMeter("myMeter"); for custom metrics meter = metrics.get_meter("myMeter") custom_export_counter = meter.create_counter("custom_export_counter", unit="1", description="Custom export counter") test_histogram = meter.create_histogram("test_histogram", description="Test histogram") @@ -55,23 +55,10 @@ def healthcheck(request): return HttpResponse("healthcheck") def aws_sdk_call(request): - # Debug OTEL configuration - logger.info(f"OTEL_EXPORTER_OTLP_METRICS_PROTOCOL: {os.getenv('OTEL_EXPORTER_OTLP_METRICS_PROTOCOL')}") - logger.info(f"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: {os.getenv('OTEL_EXPORTER_OTLP_METRICS_ENDPOINT')}") - - # Debug metric provider - provider = metrics.get_meter_provider() - logger.info(f"MeterProvider type: {type(provider).__name__}") - if hasattr(provider, '_readers'): - logger.info(f"Active metric readers: {len(provider._readers)}") - for reader in provider._readers: - logger.info(f"Reader type: {type(reader).__name__}") - if hasattr(reader, '_exporter'): - logger.info(f"Exporter type: {type(reader._exporter).__name__}") + # Increment counter/histogram custom_export_counter.add(1, {"operation.type": "custom_export_1"}) test_histogram.record(random.randint(100, 1000), {"operation.type": "histogram"}) - logger.info("Custom metrics recorded") bucket_name = "e2e-test-bucket-name" diff --git a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java index 966f432e6..67ebf8eb6 100644 --- a/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java +++ b/validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java @@ -101,12 +101,9 @@ public void validate() throws Exception { } // Query the Service, RemoteService, and RemoteTarget dimensions to ensure we // Get all metrics from all aggregations, specifically the [RemoteService] aggregation. - log.info("DEBUG: context.getServiceName() = {}", context.getServiceName()); - log.info("DEBUG: context.getMetricNamespace() = {}", context.getMetricNamespace()); List serviceNames = Lists.newArrayList( context.getServiceName(), context.getRemoteServiceDeploymentName()); - log.info("DEBUG: serviceNames = {}", serviceNames); List remoteServiceNames = Lists.newArrayList(context.getRemoteServiceDeploymentName()); List remoteTargetNames = Lists.newArrayList(); @@ -161,10 +158,8 @@ private void addMetrics( List actualMetricList) throws Exception { for (String dimensionValue : dimensionValues) { - log.info("DEBUG: Querying CloudWatch for dimension {}={}", dimensionName, dimensionValue); List foundMetrics = this.listMetricFromCloudWatch( cloudWatchService, expectedMetricList, dimensionName, dimensionValue); - log.info("DEBUG: Found {} metrics for {}={}", foundMetrics.size(), dimensionName, dimensionValue); actualMetricList.addAll(foundMetrics); } } @@ -251,10 +246,8 @@ private List listMetricFromCloudWatch( List result = new ArrayList<>(); for (String metricName : metricNameMap.keySet()) { String namespace = metricNameMap.get(metricName); - log.info("DEBUG: CloudWatch Query - Namespace: {}, MetricName: {}, DimensionKey: {}, DimensionValue: {}", - namespace, metricName, dimensionKey, dimensionValue); + List metrics = cloudWatchService.listMetrics(namespace, metricName, dimensionKey, dimensionValue); - log.info("DEBUG: CloudWatch Query Result - Found {} metrics", metrics.size()); result.addAll(metrics); } return result; diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index f7a739376..d57f04cf9 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -1,4 +1,5 @@ # OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only +# ANY_VALUE defines a string to = 'ANY_VALUE' to pass validation testing - metricName: custom_export_counter namespace: CWAgent From 567e84cf9f697c06532f0219222fdeea53566691 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 11:35:50 -0700 Subject: [PATCH 63/82] removing dead code --- .github/workflows/python-ec2-default-test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index a49c79ec7..da126198d 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -36,10 +36,6 @@ on: required: false type: boolean default: false - custom-metrics-config: - required: false - type: string - default: '{}' outputs: job-started: value: ${{ jobs.python-ec2-default.outputs.job-started }} From fc77459eda02ee63f814abd6bb8e17dfc31a1009 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 13:38:15 -0700 Subject: [PATCH 64/82] deleting 'delete-me' file and removing test.yml file --- .github/workflows/python-ec2-default-test.yml | 2 +- .../workflows/python-sample-app-s3-deploy.yml | 4 +-- .github/workflows/test.yml | 32 ------------------- terraform/python/ec2/default/main.tf | 8 ++--- 4 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index da126198d..51304177f 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -54,7 +54,7 @@ env: ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} - SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip + SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals diff --git a/.github/workflows/python-sample-app-s3-deploy.yml b/.github/workflows/python-sample-app-s3-deploy.yml index 0a0434ee6..28e3d31bd 100644 --- a/.github/workflows/python-sample-app-s3-deploy.yml +++ b/.github/workflows/python-sample-app-s3-deploy.yml @@ -48,11 +48,11 @@ jobs: - name: Build Sample App Zip working-directory: sample-apps/python - run: zip -r python-sample-app-delete-me.zip . + run: zip -r python-sample-app.zip . - name: Upload to S3 working-directory: sample-apps/python - 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 + 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 - name: Build Gen AI Sample App Zip working-directory: sample-apps/python/genai_service diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 47f9aa497..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,32 +0,0 @@ -## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -## SPDX-License-Identifier: Apache-2.0 - -# This is a reusable workflow for running the Enablement 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: Test -on: - push: - branches: - - otel-custom-metrics-test - -permissions: - id-token: write - contents: read - -jobs: - java-ec2-default: - uses: ./.github/workflows/python-ec2-default-test.yml - secrets: inherit - with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' - custom-metrics-enabled: false - - custom-metrics: - uses: ./.github/workflows/python-ec2-default-test.yml - secrets: inherit - with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' - custom-metrics-enabled: true diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 9acc47dc6..3b3798e56 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -161,8 +161,8 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip - unzip -o python-sample-app-delete-me.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip + unzip -o python-sample-app.zip # Export environment variables for instrumentation cd ./django_frontend_service @@ -300,8 +300,8 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip - unzip -o python-sample-app-delete-me.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip + unzip -o python-sample-app.zip # Export environment variables for instrumentation cd ./django_remote_service From 3359c0beb693c76da64e0977dded8d0016722187 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 16 Oct 2025 15:59:28 -0700 Subject: [PATCH 65/82] adding in test files, and testing PR changes --- .../workflows/dotnet-ec2-adot-sigv4-test.yml | 2 +- .../java-ec2-adaptive-sampling-test.yml | 2 +- .../workflows/java-ec2-adot-sigv4-test.yml | 2 +- .../workflows/node-ec2-adot-sigv4-test.yml | 2 +- .../workflows/python-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/python-ec2-default-test.yml | 8 +++-- .github/workflows/python-ec2-genesis-test.yml | 2 +- .../workflows/python-sample-app-s3-deploy.yml | 4 +-- .github/workflows/test.yml | 32 +++++++++++++++++++ terraform/dotnet/lambda/lambda/variables.tf | 4 +-- terraform/java/lambda/lambda/variables.tf | 4 +-- terraform/node/lambda/lambda/variables.tf | 4 +-- terraform/python/ec2/adot-genai/variables.tf | 2 +- .../ec2/default/amazon-cloudwatch-agent.json | 4 +++ terraform/python/ec2/default/main.tf | 12 +++---- .../PredefinedExpectedTemplate.java | 4 +-- .../aws-otel-custom-metrics.mustache | 16 +++++----- .../custom-metric-validation.yml | 0 18 files changed, 70 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/test.yml rename validator/src/main/resources/expected-data-template/python/ec2/{default => custom-metrics}/aws-otel-custom-metrics.mustache (92%) rename validator/src/main/resources/{validations/python/ec2/default => expected-data-template/python/ec2/custom-metrics}/custom-metric-validation.yml (100%) diff --git a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml index c3188707a..4096f6977 100644 --- a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml +++ b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml @@ -26,7 +26,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} DOTNET_VERSION: ${{ inputs.dotnet-version }} diff --git a/.github/workflows/java-ec2-adaptive-sampling-test.yml b/.github/workflows/java-ec2-adaptive-sampling-test.yml index e4ac7cba9..0172d3e37 100644 --- a/.github/workflows/java-ec2-adaptive-sampling-test.yml +++ b/.github/workflows/java-ec2-adaptive-sampling-test.yml @@ -17,7 +17,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: us-east-1 + E2E_TEST_AWS_REGION: us-west-2 CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-main-service-v11.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-remote-service-v11.jar diff --git a/.github/workflows/java-ec2-adot-sigv4-test.yml b/.github/workflows/java-ec2-adot-sigv4-test.yml index 3aa03521d..ab42a5a38 100644 --- a/.github/workflows/java-ec2-adot-sigv4-test.yml +++ b/.github/workflows/java-ec2-adot-sigv4-test.yml @@ -34,7 +34,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' # Test uses us-east-1 in the us-east-1 account + E2E_TEST_AWS_REGION: 'us-west-2' # Test uses us-west-2 in the us-east-1 account CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} METRIC_NAMESPACE: ApplicationSignals JAVA_VERSION: ${{ inputs.java-version }} diff --git a/.github/workflows/node-ec2-adot-sigv4-test.yml b/.github/workflows/node-ec2-adot-sigv4-test.yml index b99e59bb7..18d97022a 100644 --- a/.github/workflows/node-ec2-adot-sigv4-test.yml +++ b/.github/workflows/node-ec2-adot-sigv4-test.yml @@ -32,7 +32,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} NODE_VERSION: ${{ inputs.node-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-adot-sigv4-test.yml b/.github/workflows/python-ec2-adot-sigv4-test.yml index 592420d9c..c6eca9cfb 100644 --- a/.github/workflows/python-ec2-adot-sigv4-test.yml +++ b/.github/workflows/python-ec2-adot-sigv4-test.yml @@ -31,7 +31,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} PYTHON_VERSION: ${{ inputs.python-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 51304177f..6b5467437 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -54,7 +54,7 @@ env: ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} - SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip + SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -177,6 +177,7 @@ jobs: -var="language_version=${{ env.PYTHON_VERSION }}" \ -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ -var="custom_metrics_enabled=${{ env.CUSTOM_METRICS_ENABLED }}" \ + || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then echo "Terraform deployment was unsuccessful. Will attempt to retry deployment." @@ -259,7 +260,7 @@ jobs: - name: Validate CWAgent metrics id: cwagent-metric-validation - if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() + if: (success() || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.log-validation.outcome == 'failure')) && !cancelled() run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} @@ -276,7 +277,8 @@ jobs: - name: Validate generated traces id: trace-validation - if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || steps.cwagent-metric-validation.outcome == 'failure') && !cancelled() + if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.cwagent-metric-validation.outcome == 'failure')) && !cancelled() + run: ./gradlew validator:run --args='-c python/ec2/default/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} diff --git a/.github/workflows/python-ec2-genesis-test.yml b/.github/workflows/python-ec2-genesis-test.yml index 7ed546105..3378b3837 100644 --- a/.github/workflows/python-ec2-genesis-test.yml +++ b/.github/workflows/python-ec2-genesis-test.yml @@ -20,7 +20,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} diff --git a/.github/workflows/python-sample-app-s3-deploy.yml b/.github/workflows/python-sample-app-s3-deploy.yml index 28e3d31bd..0a0434ee6 100644 --- a/.github/workflows/python-sample-app-s3-deploy.yml +++ b/.github/workflows/python-sample-app-s3-deploy.yml @@ -48,11 +48,11 @@ jobs: - name: Build Sample App Zip working-directory: sample-apps/python - run: zip -r python-sample-app.zip . + run: zip -r python-sample-app-delete-me.zip . - name: Upload to S3 working-directory: sample-apps/python - 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 + 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 - name: Build Gen AI Sample App Zip working-directory: sample-apps/python/genai_service diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..678e437ab --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +## SPDX-License-Identifier: Apache-2.0 + +# This is a reusable workflow for running the Enablement 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: Test +on: + push: + branches: + - otel-custom-metrics-test + +permissions: + id-token: write + contents: read + +jobs: + java-ec2-default: + uses: ./.github/workflows/python-ec2-default-test.yml + secrets: inherit + with: + caller-workflow-name: 'test' + aws-region: 'us-east-1' + custom-metrics-enabled: false + + custom-metrics: + uses: ./.github/workflows/python-ec2-default-test.yml + secrets: inherit + with: + caller-workflow-name: 'test' + aws-region: 'us-east-1' + custom-metrics-enabled: true \ No newline at end of file diff --git a/terraform/dotnet/lambda/lambda/variables.tf b/terraform/dotnet/lambda/lambda/variables.tf index 5fe066321..7c8102bee 100644 --- a/terraform/dotnet/lambda/lambda/variables.tf +++ b/terraform/dotnet/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-east-1" - default = "us-east-1" + description = "Lambda function running region, default value is us-west-2" + default = "us-west-2" } variable "is_canary" { diff --git a/terraform/java/lambda/lambda/variables.tf b/terraform/java/lambda/lambda/variables.tf index 1adf689bd..eb8cbf91e 100644 --- a/terraform/java/lambda/lambda/variables.tf +++ b/terraform/java/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-east-1" - default = "us-east-1" + description = "Lambda function running region, default value is us-west-2" + default = "us-west-2" } variable "is_canary" { diff --git a/terraform/node/lambda/lambda/variables.tf b/terraform/node/lambda/lambda/variables.tf index b7249149f..b20a2e500 100644 --- a/terraform/node/lambda/lambda/variables.tf +++ b/terraform/node/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-east-1" - default = "us-east-1" + description = "Lambda function running region, default value is us-west-2" + default = "us-west-2" } variable "is_canary" { diff --git a/terraform/python/ec2/adot-genai/variables.tf b/terraform/python/ec2/adot-genai/variables.tf index 3abb61f4b..b8f0d21cb 100644 --- a/terraform/python/ec2/adot-genai/variables.tf +++ b/terraform/python/ec2/adot-genai/variables.tf @@ -14,7 +14,7 @@ # ------------------------------------------------------------------------- variable "aws_region" { - default = "us-east-1" + default = "us-west-2" } variable "test_id" { diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index 22c1eb736..f65bfe32e 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -1,4 +1,8 @@ { + "agent": { + "debug": true, + "region": "$REGION" + }, "traces": { "traces_collected": { "application_signals": {} diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 3b3798e56..bd581fd53 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -161,8 +161,8 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip - unzip -o python-sample-app.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip + unzip -o python-sample-app-delete-me.zip # Export environment variables for instrumentation cd ./django_frontend_service @@ -184,10 +184,6 @@ resource "null_resource" "main_service_setup" { export OTEL_RESOURCE_ATTRIBUTES="Service=python-sample-application-${var.test_id},Environment=ec2:default" export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' - export RDS_MYSQL_CLUSTER_ENDPOINT='dummy-endpoint' - export RDS_MYSQL_CLUSTER_PASSWORD='ZHVtbXk=' # base64 encoded 'dummy' - export RDS_MYSQL_CLUSTER_USERNAME='dummy-user' - export RDS_MYSQL_CLUSTER_DATABASE='dummy-db' python${var.language_version} manage.py migrate nohup opentelemetry-instrument python${var.language_version} manage.py runserver 0.0.0.0:8000 --noreload & @@ -300,8 +296,8 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip - unzip -o python-sample-app.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip + unzip -o python-sample-app-delete-me.zip # Export environment variables for instrumentation cd ./django_remote_service diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index 9113058e9..a316a12ba 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -210,8 +210,8 @@ public enum PredefinedExpectedTemplate implements FileConfig { PYTHON_EC2_DEFAULT_CLIENT_CALL_METRIC("/expected-data-template/python/ec2/default/client-call-metric.mustache"), PYTHON_EC2_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/python/ec2/default/client-call-trace.mustache"), -/** Python EC2 Default Custom Metrics Test Case Validations */ - PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), + /** Python EC2 Default Custom Metrics Test Case Validations */ + PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache"), /** Python EC2 Asg Test Case Validations */ PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_LOG("/expected-data-template/python/ec2/asg/outgoing-http-call-log.mustache"), diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache similarity index 92% rename from validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache rename to validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache index d57f04cf9..ed7614248 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache @@ -15,13 +15,13 @@ value: {{serviceName}} - name: cloud.account.id - value: ANY_VALUE + value: 654654176582 - name: cloud.availability_zone value: ANY_VALUE - name: cloud.platform - value: ANY_VALUE + value: aws_ec2 - name: cloud.provider value: aws @@ -36,7 +36,7 @@ value: ANY_VALUE - name: host.type - value: ANY_VALUE + value: t3.micro - name: operation.type value: custom_export_1 @@ -54,7 +54,7 @@ value: opentelemetry - name: telemetry.sdk.version - value: 1.33.1 + value: ANY_VALUE - metricName: test_histogram namespace: CWAgent @@ -70,13 +70,13 @@ value: {{serviceName}} - name: cloud.account.id - value: ANY_VALUE + value: 654654176582 - name: cloud.availability_zone value: ANY_VALUE - name: cloud.platform - value: ANY_VALUE + value: aws_ec2 - name: cloud.provider value: aws @@ -91,7 +91,7 @@ value: ANY_VALUE - name: host.type - value: ANY_VALUE + value: t3.micro - name: operation.type value: histogram @@ -109,4 +109,4 @@ value: opentelemetry - name: telemetry.sdk.version - value: 1.33.1 \ No newline at end of file + value: ANY_VALUE \ No newline at end of file diff --git a/validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/custom-metric-validation.yml similarity index 100% rename from validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml rename to validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/custom-metric-validation.yml From 2883bbeca05f936cdf532977bf14d0705c92030b Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 17 Oct 2025 08:02:46 -0700 Subject: [PATCH 66/82] adding in test files, and testing PR changes --- .github/workflows/python-ec2-default-test.yml | 4 ++-- terraform/python/lambda/lambda/variables.tf | 4 ++-- validator/src/main/java/com/amazon/aoc/App.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 6b5467437..ed556f010 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -278,7 +278,6 @@ jobs: - name: Validate generated traces id: trace-validation if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.cwagent-metric-validation.outcome == 'failure')) && !cancelled() - run: ./gradlew validator:run --args='-c python/ec2/default/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} @@ -305,7 +304,8 @@ jobs: if: always() id: validation-result run: | - if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.cwagent-metric-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then + if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ env.CUSTOM_METRICS_ENABLED }}" = "true" ] && [ "${{ steps.cwagent-metric-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then + echo "validation-result=success" >> $GITHUB_OUTPUT else echo "validation-result=failure" >> $GITHUB_OUTPUT diff --git a/terraform/python/lambda/lambda/variables.tf b/terraform/python/lambda/lambda/variables.tf index 8d8dfca60..bf628b567 100644 --- a/terraform/python/lambda/lambda/variables.tf +++ b/terraform/python/lambda/lambda/variables.tf @@ -36,8 +36,8 @@ variable "is_canary" { variable "region" { type = string - description = "Lambda function running region, default value is us-east-1" - default = "us-east-1" + description = "Lambda function running region, default value is us-west-2" + default = "us-west-2" } variable "layer_artifacts_directory" { diff --git a/validator/src/main/java/com/amazon/aoc/App.java b/validator/src/main/java/com/amazon/aoc/App.java index 109b9d44c..674cfb2ef 100644 --- a/validator/src/main/java/com/amazon/aoc/App.java +++ b/validator/src/main/java/com/amazon/aoc/App.java @@ -97,7 +97,7 @@ public class App implements Callable { @CommandLine.Option( names = {"--region"}, - defaultValue = "us-east-1") + defaultValue = "us-west-2") private String region; @CommandLine.Option(names = {"--availability-zone"}) From b1b9e7a922d12505499e9e93524e25589e3b0b7b Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 17 Oct 2025 09:13:52 -0700 Subject: [PATCH 67/82] testing region changes --- .github/workflows/dotnet-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/java-ec2-adaptive-sampling-test.yml | 2 +- .github/workflows/java-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/node-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/python-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/python-ec2-genesis-test.yml | 2 +- terraform/dotnet/lambda/lambda/variables.tf | 2 +- terraform/java/lambda/lambda/variables.tf | 2 +- terraform/node/lambda/lambda/variables.tf | 2 +- terraform/python/ec2/adot-genai/variables.tf | 2 +- terraform/python/lambda/lambda/variables.tf | 2 +- validator/src/main/java/com/amazon/aoc/App.java | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml index 4096f6977..c3188707a 100644 --- a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml +++ b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml @@ -26,7 +26,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} DOTNET_VERSION: ${{ inputs.dotnet-version }} diff --git a/.github/workflows/java-ec2-adaptive-sampling-test.yml b/.github/workflows/java-ec2-adaptive-sampling-test.yml index 0172d3e37..e4ac7cba9 100644 --- a/.github/workflows/java-ec2-adaptive-sampling-test.yml +++ b/.github/workflows/java-ec2-adaptive-sampling-test.yml @@ -17,7 +17,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: us-west-2 + E2E_TEST_AWS_REGION: us-east-1 CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-main-service-v11.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-remote-service-v11.jar diff --git a/.github/workflows/java-ec2-adot-sigv4-test.yml b/.github/workflows/java-ec2-adot-sigv4-test.yml index ab42a5a38..1d48fb3f5 100644 --- a/.github/workflows/java-ec2-adot-sigv4-test.yml +++ b/.github/workflows/java-ec2-adot-sigv4-test.yml @@ -34,7 +34,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' # Test uses us-west-2 in the us-east-1 account + E2E_TEST_AWS_REGION: 'us-east-1' # Test uses us-west-2 in the us-east-1 account CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} METRIC_NAMESPACE: ApplicationSignals JAVA_VERSION: ${{ inputs.java-version }} diff --git a/.github/workflows/node-ec2-adot-sigv4-test.yml b/.github/workflows/node-ec2-adot-sigv4-test.yml index 18d97022a..b99e59bb7 100644 --- a/.github/workflows/node-ec2-adot-sigv4-test.yml +++ b/.github/workflows/node-ec2-adot-sigv4-test.yml @@ -32,7 +32,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} NODE_VERSION: ${{ inputs.node-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-adot-sigv4-test.yml b/.github/workflows/python-ec2-adot-sigv4-test.yml index c6eca9cfb..592420d9c 100644 --- a/.github/workflows/python-ec2-adot-sigv4-test.yml +++ b/.github/workflows/python-ec2-adot-sigv4-test.yml @@ -31,7 +31,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} PYTHON_VERSION: ${{ inputs.python-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-genesis-test.yml b/.github/workflows/python-ec2-genesis-test.yml index 3378b3837..7ed546105 100644 --- a/.github/workflows/python-ec2-genesis-test.yml +++ b/.github/workflows/python-ec2-genesis-test.yml @@ -20,7 +20,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} diff --git a/terraform/dotnet/lambda/lambda/variables.tf b/terraform/dotnet/lambda/lambda/variables.tf index 7c8102bee..513f67d2b 100644 --- a/terraform/dotnet/lambda/lambda/variables.tf +++ b/terraform/dotnet/lambda/lambda/variables.tf @@ -31,7 +31,7 @@ variable "architecture" { variable "region" { type = string description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + default = "us-east-1" } variable "is_canary" { diff --git a/terraform/java/lambda/lambda/variables.tf b/terraform/java/lambda/lambda/variables.tf index eb8cbf91e..515be993d 100644 --- a/terraform/java/lambda/lambda/variables.tf +++ b/terraform/java/lambda/lambda/variables.tf @@ -31,7 +31,7 @@ variable "architecture" { variable "region" { type = string description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + default = "us-east-1" } variable "is_canary" { diff --git a/terraform/node/lambda/lambda/variables.tf b/terraform/node/lambda/lambda/variables.tf index b20a2e500..6caee6b37 100644 --- a/terraform/node/lambda/lambda/variables.tf +++ b/terraform/node/lambda/lambda/variables.tf @@ -31,7 +31,7 @@ variable "architecture" { variable "region" { type = string description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + default = "us-east-1" } variable "is_canary" { diff --git a/terraform/python/ec2/adot-genai/variables.tf b/terraform/python/ec2/adot-genai/variables.tf index b8f0d21cb..3abb61f4b 100644 --- a/terraform/python/ec2/adot-genai/variables.tf +++ b/terraform/python/ec2/adot-genai/variables.tf @@ -14,7 +14,7 @@ # ------------------------------------------------------------------------- variable "aws_region" { - default = "us-west-2" + default = "us-east-1" } variable "test_id" { diff --git a/terraform/python/lambda/lambda/variables.tf b/terraform/python/lambda/lambda/variables.tf index bf628b567..bea261ef6 100644 --- a/terraform/python/lambda/lambda/variables.tf +++ b/terraform/python/lambda/lambda/variables.tf @@ -36,7 +36,7 @@ variable "is_canary" { variable "region" { type = string - description = "Lambda function running region, default value is us-west-2" + description = "Lambda function running region, default value is us-east-1" default = "us-west-2" } diff --git a/validator/src/main/java/com/amazon/aoc/App.java b/validator/src/main/java/com/amazon/aoc/App.java index 674cfb2ef..109b9d44c 100644 --- a/validator/src/main/java/com/amazon/aoc/App.java +++ b/validator/src/main/java/com/amazon/aoc/App.java @@ -97,7 +97,7 @@ public class App implements Callable { @CommandLine.Option( names = {"--region"}, - defaultValue = "us-west-2") + defaultValue = "us-east-1") private String region; @CommandLine.Option(names = {"--availability-zone"}) From e45846833ab5b0d48faf1549604dc67830873d41 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 17 Oct 2025 09:44:56 -0700 Subject: [PATCH 68/82] swapping region to us-west-2 --- .github/workflows/dotnet-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/java-ec2-adaptive-sampling-test.yml | 2 +- .github/workflows/java-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/node-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/python-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/python-ec2-genesis-test.yml | 2 +- .github/workflows/test.yml | 4 ++-- terraform/dotnet/lambda/lambda/variables.tf | 2 +- terraform/java/lambda/lambda/variables.tf | 2 +- terraform/node/lambda/lambda/variables.tf | 2 +- terraform/python/ec2/adot-genai/variables.tf | 2 +- terraform/python/lambda/lambda/variables.tf | 2 +- validator/src/main/java/com/amazon/aoc/App.java | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml index c3188707a..4096f6977 100644 --- a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml +++ b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml @@ -26,7 +26,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} DOTNET_VERSION: ${{ inputs.dotnet-version }} diff --git a/.github/workflows/java-ec2-adaptive-sampling-test.yml b/.github/workflows/java-ec2-adaptive-sampling-test.yml index e4ac7cba9..0172d3e37 100644 --- a/.github/workflows/java-ec2-adaptive-sampling-test.yml +++ b/.github/workflows/java-ec2-adaptive-sampling-test.yml @@ -17,7 +17,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: us-east-1 + E2E_TEST_AWS_REGION: us-west-2 CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-main-service-v11.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-remote-service-v11.jar diff --git a/.github/workflows/java-ec2-adot-sigv4-test.yml b/.github/workflows/java-ec2-adot-sigv4-test.yml index 1d48fb3f5..ab42a5a38 100644 --- a/.github/workflows/java-ec2-adot-sigv4-test.yml +++ b/.github/workflows/java-ec2-adot-sigv4-test.yml @@ -34,7 +34,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' # Test uses us-west-2 in the us-east-1 account + E2E_TEST_AWS_REGION: 'us-west-2' # Test uses us-west-2 in the us-east-1 account CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} METRIC_NAMESPACE: ApplicationSignals JAVA_VERSION: ${{ inputs.java-version }} diff --git a/.github/workflows/node-ec2-adot-sigv4-test.yml b/.github/workflows/node-ec2-adot-sigv4-test.yml index b99e59bb7..18d97022a 100644 --- a/.github/workflows/node-ec2-adot-sigv4-test.yml +++ b/.github/workflows/node-ec2-adot-sigv4-test.yml @@ -32,7 +32,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} NODE_VERSION: ${{ inputs.node-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-adot-sigv4-test.yml b/.github/workflows/python-ec2-adot-sigv4-test.yml index 592420d9c..c6eca9cfb 100644 --- a/.github/workflows/python-ec2-adot-sigv4-test.yml +++ b/.github/workflows/python-ec2-adot-sigv4-test.yml @@ -31,7 +31,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} PYTHON_VERSION: ${{ inputs.python-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-genesis-test.yml b/.github/workflows/python-ec2-genesis-test.yml index 7ed546105..3378b3837 100644 --- a/.github/workflows/python-ec2-genesis-test.yml +++ b/.github/workflows/python-ec2-genesis-test.yml @@ -20,7 +20,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 678e437ab..d5732ab2e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: secrets: inherit with: caller-workflow-name: 'test' - aws-region: 'us-east-1' + aws-region: 'us-west-2' custom-metrics-enabled: false custom-metrics: @@ -28,5 +28,5 @@ jobs: secrets: inherit with: caller-workflow-name: 'test' - aws-region: 'us-east-1' + aws-region: 'us-west-2' custom-metrics-enabled: true \ No newline at end of file diff --git a/terraform/dotnet/lambda/lambda/variables.tf b/terraform/dotnet/lambda/lambda/variables.tf index 513f67d2b..7c8102bee 100644 --- a/terraform/dotnet/lambda/lambda/variables.tf +++ b/terraform/dotnet/lambda/lambda/variables.tf @@ -31,7 +31,7 @@ variable "architecture" { variable "region" { type = string description = "Lambda function running region, default value is us-west-2" - default = "us-east-1" + default = "us-west-2" } variable "is_canary" { diff --git a/terraform/java/lambda/lambda/variables.tf b/terraform/java/lambda/lambda/variables.tf index 515be993d..eb8cbf91e 100644 --- a/terraform/java/lambda/lambda/variables.tf +++ b/terraform/java/lambda/lambda/variables.tf @@ -31,7 +31,7 @@ variable "architecture" { variable "region" { type = string description = "Lambda function running region, default value is us-west-2" - default = "us-east-1" + default = "us-west-2" } variable "is_canary" { diff --git a/terraform/node/lambda/lambda/variables.tf b/terraform/node/lambda/lambda/variables.tf index 6caee6b37..b20a2e500 100644 --- a/terraform/node/lambda/lambda/variables.tf +++ b/terraform/node/lambda/lambda/variables.tf @@ -31,7 +31,7 @@ variable "architecture" { variable "region" { type = string description = "Lambda function running region, default value is us-west-2" - default = "us-east-1" + default = "us-west-2" } variable "is_canary" { diff --git a/terraform/python/ec2/adot-genai/variables.tf b/terraform/python/ec2/adot-genai/variables.tf index 3abb61f4b..b8f0d21cb 100644 --- a/terraform/python/ec2/adot-genai/variables.tf +++ b/terraform/python/ec2/adot-genai/variables.tf @@ -14,7 +14,7 @@ # ------------------------------------------------------------------------- variable "aws_region" { - default = "us-east-1" + default = "us-west-2" } variable "test_id" { diff --git a/terraform/python/lambda/lambda/variables.tf b/terraform/python/lambda/lambda/variables.tf index bea261ef6..377c04831 100644 --- a/terraform/python/lambda/lambda/variables.tf +++ b/terraform/python/lambda/lambda/variables.tf @@ -36,7 +36,7 @@ variable "is_canary" { variable "region" { type = string - description = "Lambda function running region, default value is us-east-1" + description = "Lambda function running region, default value is us-west-2 default = "us-west-2" } diff --git a/validator/src/main/java/com/amazon/aoc/App.java b/validator/src/main/java/com/amazon/aoc/App.java index 109b9d44c..674cfb2ef 100644 --- a/validator/src/main/java/com/amazon/aoc/App.java +++ b/validator/src/main/java/com/amazon/aoc/App.java @@ -97,7 +97,7 @@ public class App implements Callable { @CommandLine.Option( names = {"--region"}, - defaultValue = "us-east-1") + defaultValue = "us-west-2") private String region; @CommandLine.Option(names = {"--availability-zone"}) From 6e55891ffae1603b5e1e65b4adc61a593a2fd91f Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 17 Oct 2025 14:33:01 -0700 Subject: [PATCH 69/82] Revert " adding in test files, and testing PR changes" This reverts commit 3359c0beb693c76da64e0977dded8d0016722187. --- .../workflows/dotnet-ec2-adot-sigv4-test.yml | 2 +- .../java-ec2-adaptive-sampling-test.yml | 2 +- .../workflows/java-ec2-adot-sigv4-test.yml | 2 +- .../workflows/node-ec2-adot-sigv4-test.yml | 2 +- .../workflows/python-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/python-ec2-default-test.yml | 8 ++--- .github/workflows/python-ec2-genesis-test.yml | 2 +- .../workflows/python-sample-app-s3-deploy.yml | 4 +-- .github/workflows/test.yml | 32 ------------------- terraform/dotnet/lambda/lambda/variables.tf | 4 +-- terraform/java/lambda/lambda/variables.tf | 4 +-- terraform/node/lambda/lambda/variables.tf | 4 +-- terraform/python/ec2/adot-genai/variables.tf | 2 +- .../ec2/default/amazon-cloudwatch-agent.json | 4 --- terraform/python/ec2/default/main.tf | 12 ++++--- .../PredefinedExpectedTemplate.java | 4 +-- .../aws-otel-custom-metrics.mustache | 16 +++++----- .../ec2/default}/custom-metric-validation.yml | 0 18 files changed, 36 insertions(+), 70 deletions(-) delete mode 100644 .github/workflows/test.yml rename validator/src/main/resources/expected-data-template/python/ec2/{custom-metrics => default}/aws-otel-custom-metrics.mustache (92%) rename validator/src/main/resources/{expected-data-template/python/ec2/custom-metrics => validations/python/ec2/default}/custom-metric-validation.yml (100%) diff --git a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml index 4096f6977..c3188707a 100644 --- a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml +++ b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml @@ -26,7 +26,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} DOTNET_VERSION: ${{ inputs.dotnet-version }} diff --git a/.github/workflows/java-ec2-adaptive-sampling-test.yml b/.github/workflows/java-ec2-adaptive-sampling-test.yml index 0172d3e37..e4ac7cba9 100644 --- a/.github/workflows/java-ec2-adaptive-sampling-test.yml +++ b/.github/workflows/java-ec2-adaptive-sampling-test.yml @@ -17,7 +17,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: us-west-2 + E2E_TEST_AWS_REGION: us-east-1 CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-main-service-v11.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-remote-service-v11.jar diff --git a/.github/workflows/java-ec2-adot-sigv4-test.yml b/.github/workflows/java-ec2-adot-sigv4-test.yml index ab42a5a38..3aa03521d 100644 --- a/.github/workflows/java-ec2-adot-sigv4-test.yml +++ b/.github/workflows/java-ec2-adot-sigv4-test.yml @@ -34,7 +34,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' # Test uses us-west-2 in the us-east-1 account + E2E_TEST_AWS_REGION: 'us-east-1' # Test uses us-east-1 in the us-east-1 account CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} METRIC_NAMESPACE: ApplicationSignals JAVA_VERSION: ${{ inputs.java-version }} diff --git a/.github/workflows/node-ec2-adot-sigv4-test.yml b/.github/workflows/node-ec2-adot-sigv4-test.yml index 18d97022a..b99e59bb7 100644 --- a/.github/workflows/node-ec2-adot-sigv4-test.yml +++ b/.github/workflows/node-ec2-adot-sigv4-test.yml @@ -32,7 +32,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} NODE_VERSION: ${{ inputs.node-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-adot-sigv4-test.yml b/.github/workflows/python-ec2-adot-sigv4-test.yml index c6eca9cfb..592420d9c 100644 --- a/.github/workflows/python-ec2-adot-sigv4-test.yml +++ b/.github/workflows/python-ec2-adot-sigv4-test.yml @@ -31,7 +31,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} PYTHON_VERSION: ${{ inputs.python-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 6b5467437..51304177f 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -54,7 +54,7 @@ env: ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} - SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip + SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -177,7 +177,6 @@ jobs: -var="language_version=${{ env.PYTHON_VERSION }}" \ -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ -var="custom_metrics_enabled=${{ env.CUSTOM_METRICS_ENABLED }}" \ - || deployment_failed=$? if [ $deployment_failed -eq 1 ]; then echo "Terraform deployment was unsuccessful. Will attempt to retry deployment." @@ -260,7 +259,7 @@ jobs: - name: Validate CWAgent metrics id: cwagent-metric-validation - if: (success() || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.log-validation.outcome == 'failure')) && !cancelled() + if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} @@ -277,8 +276,7 @@ jobs: - name: Validate generated traces id: trace-validation - if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.cwagent-metric-validation.outcome == 'failure')) && !cancelled() - + if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || steps.cwagent-metric-validation.outcome == 'failure') && !cancelled() run: ./gradlew validator:run --args='-c python/ec2/default/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} diff --git a/.github/workflows/python-ec2-genesis-test.yml b/.github/workflows/python-ec2-genesis-test.yml index 3378b3837..7ed546105 100644 --- a/.github/workflows/python-ec2-genesis-test.yml +++ b/.github/workflows/python-ec2-genesis-test.yml @@ -20,7 +20,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' + E2E_TEST_AWS_REGION: 'us-east-1' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} diff --git a/.github/workflows/python-sample-app-s3-deploy.yml b/.github/workflows/python-sample-app-s3-deploy.yml index 0a0434ee6..28e3d31bd 100644 --- a/.github/workflows/python-sample-app-s3-deploy.yml +++ b/.github/workflows/python-sample-app-s3-deploy.yml @@ -48,11 +48,11 @@ jobs: - name: Build Sample App Zip working-directory: sample-apps/python - run: zip -r python-sample-app-delete-me.zip . + run: zip -r python-sample-app.zip . - name: Upload to S3 working-directory: sample-apps/python - 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 + 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 - name: Build Gen AI Sample App Zip working-directory: sample-apps/python/genai_service diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 678e437ab..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,32 +0,0 @@ -## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -## SPDX-License-Identifier: Apache-2.0 - -# This is a reusable workflow for running the Enablement 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: Test -on: - push: - branches: - - otel-custom-metrics-test - -permissions: - id-token: write - contents: read - -jobs: - java-ec2-default: - uses: ./.github/workflows/python-ec2-default-test.yml - secrets: inherit - with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' - custom-metrics-enabled: false - - custom-metrics: - uses: ./.github/workflows/python-ec2-default-test.yml - secrets: inherit - with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' - custom-metrics-enabled: true \ No newline at end of file diff --git a/terraform/dotnet/lambda/lambda/variables.tf b/terraform/dotnet/lambda/lambda/variables.tf index 7c8102bee..5fe066321 100644 --- a/terraform/dotnet/lambda/lambda/variables.tf +++ b/terraform/dotnet/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + description = "Lambda function running region, default value is us-east-1" + default = "us-east-1" } variable "is_canary" { diff --git a/terraform/java/lambda/lambda/variables.tf b/terraform/java/lambda/lambda/variables.tf index eb8cbf91e..1adf689bd 100644 --- a/terraform/java/lambda/lambda/variables.tf +++ b/terraform/java/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + description = "Lambda function running region, default value is us-east-1" + default = "us-east-1" } variable "is_canary" { diff --git a/terraform/node/lambda/lambda/variables.tf b/terraform/node/lambda/lambda/variables.tf index b20a2e500..b7249149f 100644 --- a/terraform/node/lambda/lambda/variables.tf +++ b/terraform/node/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-west-2" - default = "us-west-2" + description = "Lambda function running region, default value is us-east-1" + default = "us-east-1" } variable "is_canary" { diff --git a/terraform/python/ec2/adot-genai/variables.tf b/terraform/python/ec2/adot-genai/variables.tf index b8f0d21cb..3abb61f4b 100644 --- a/terraform/python/ec2/adot-genai/variables.tf +++ b/terraform/python/ec2/adot-genai/variables.tf @@ -14,7 +14,7 @@ # ------------------------------------------------------------------------- variable "aws_region" { - default = "us-west-2" + default = "us-east-1" } variable "test_id" { diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index f65bfe32e..22c1eb736 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -1,8 +1,4 @@ { - "agent": { - "debug": true, - "region": "$REGION" - }, "traces": { "traces_collected": { "application_signals": {} diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index bd581fd53..3b3798e56 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -161,8 +161,8 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip - unzip -o python-sample-app-delete-me.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip + unzip -o python-sample-app.zip # Export environment variables for instrumentation cd ./django_frontend_service @@ -184,6 +184,10 @@ resource "null_resource" "main_service_setup" { export OTEL_RESOURCE_ATTRIBUTES="Service=python-sample-application-${var.test_id},Environment=ec2:default" export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' + export RDS_MYSQL_CLUSTER_ENDPOINT='dummy-endpoint' + export RDS_MYSQL_CLUSTER_PASSWORD='ZHVtbXk=' # base64 encoded 'dummy' + export RDS_MYSQL_CLUSTER_USERNAME='dummy-user' + export RDS_MYSQL_CLUSTER_DATABASE='dummy-db' python${var.language_version} manage.py migrate nohup opentelemetry-instrument python${var.language_version} manage.py runserver 0.0.0.0:8000 --noreload & @@ -296,8 +300,8 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip - unzip -o python-sample-app-delete-me.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip + unzip -o python-sample-app.zip # Export environment variables for instrumentation cd ./django_remote_service diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index a316a12ba..9113058e9 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -210,8 +210,8 @@ public enum PredefinedExpectedTemplate implements FileConfig { PYTHON_EC2_DEFAULT_CLIENT_CALL_METRIC("/expected-data-template/python/ec2/default/client-call-metric.mustache"), PYTHON_EC2_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/python/ec2/default/client-call-trace.mustache"), - /** Python EC2 Default Custom Metrics Test Case Validations */ - PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache"), +/** Python EC2 Default Custom Metrics Test Case Validations */ + PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), /** Python EC2 Asg Test Case Validations */ PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_LOG("/expected-data-template/python/ec2/asg/outgoing-http-call-log.mustache"), diff --git a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache similarity index 92% rename from validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache rename to validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index ed7614248..d57f04cf9 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -15,13 +15,13 @@ value: {{serviceName}} - name: cloud.account.id - value: 654654176582 + value: ANY_VALUE - name: cloud.availability_zone value: ANY_VALUE - name: cloud.platform - value: aws_ec2 + value: ANY_VALUE - name: cloud.provider value: aws @@ -36,7 +36,7 @@ value: ANY_VALUE - name: host.type - value: t3.micro + value: ANY_VALUE - name: operation.type value: custom_export_1 @@ -54,7 +54,7 @@ value: opentelemetry - name: telemetry.sdk.version - value: ANY_VALUE + value: 1.33.1 - metricName: test_histogram namespace: CWAgent @@ -70,13 +70,13 @@ value: {{serviceName}} - name: cloud.account.id - value: 654654176582 + value: ANY_VALUE - name: cloud.availability_zone value: ANY_VALUE - name: cloud.platform - value: aws_ec2 + value: ANY_VALUE - name: cloud.provider value: aws @@ -91,7 +91,7 @@ value: ANY_VALUE - name: host.type - value: t3.micro + value: ANY_VALUE - name: operation.type value: histogram @@ -109,4 +109,4 @@ value: opentelemetry - name: telemetry.sdk.version - value: ANY_VALUE \ No newline at end of file + value: 1.33.1 \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/custom-metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml similarity index 100% rename from validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/custom-metric-validation.yml rename to validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml From c840ace518fa566a77f2b00fb6f0fd1787811776 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 17 Oct 2025 14:51:15 -0700 Subject: [PATCH 70/82] adding in test files, and testing PR changes --- .../java-ec2-adaptive-sampling-test.yml | 2 +- .../workflows/java-ec2-adot-sigv4-test.yml | 2 +- .../workflows/python-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/python-ec2-default-test.yml | 10 +++--- .github/workflows/python-ec2-genesis-test.yml | 2 +- .../workflows/python-sample-app-s3-deploy.yml | 4 +-- .github/workflows/test.yml | 32 +++++++++++++++++++ terraform/dotnet/lambda/lambda/variables.tf | 4 +-- terraform/java/lambda/lambda/variables.tf | 4 +-- terraform/node/lambda/lambda/variables.tf | 4 +-- .../ec2/default/amazon-cloudwatch-agent.json | 4 +++ terraform/python/ec2/default/main.tf | 12 +++---- terraform/python/lambda/lambda/variables.tf | 4 +-- .../src/main/java/com/amazon/aoc/App.java | 2 +- .../PredefinedExpectedTemplate.java | 4 +-- .../aws-otel-custom-metrics.mustache | 12 +++---- .../custom-metric-validation.yml | 0 17 files changed, 68 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/test.yml rename validator/src/main/resources/expected-data-template/python/ec2/{default => custom-metrics}/aws-otel-custom-metrics.mustache (93%) rename validator/src/main/resources/{validations/python/ec2/default => expected-data-template/python/ec2/custom-metrics}/custom-metric-validation.yml (100%) diff --git a/.github/workflows/java-ec2-adaptive-sampling-test.yml b/.github/workflows/java-ec2-adaptive-sampling-test.yml index e4ac7cba9..0172d3e37 100644 --- a/.github/workflows/java-ec2-adaptive-sampling-test.yml +++ b/.github/workflows/java-ec2-adaptive-sampling-test.yml @@ -17,7 +17,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: us-east-1 + E2E_TEST_AWS_REGION: us-west-2 CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-main-service-v11.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-us-west-2-adap/java-remote-service-v11.jar diff --git a/.github/workflows/java-ec2-adot-sigv4-test.yml b/.github/workflows/java-ec2-adot-sigv4-test.yml index 3aa03521d..53b9b7945 100644 --- a/.github/workflows/java-ec2-adot-sigv4-test.yml +++ b/.github/workflows/java-ec2-adot-sigv4-test.yml @@ -34,7 +34,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' # Test uses us-east-1 in the us-east-1 account + E2E_TEST_AWS_REGION: 'us-west-2' # Test uses us-east-1 in the us-east-1 account CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} METRIC_NAMESPACE: ApplicationSignals JAVA_VERSION: ${{ inputs.java-version }} diff --git a/.github/workflows/python-ec2-adot-sigv4-test.yml b/.github/workflows/python-ec2-adot-sigv4-test.yml index 592420d9c..c6eca9cfb 100644 --- a/.github/workflows/python-ec2-adot-sigv4-test.yml +++ b/.github/workflows/python-ec2-adot-sigv4-test.yml @@ -31,7 +31,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} PYTHON_VERSION: ${{ inputs.python-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 51304177f..2c7acfc4e 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -54,7 +54,7 @@ env: ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} - SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip + SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -177,7 +177,7 @@ jobs: -var="language_version=${{ env.PYTHON_VERSION }}" \ -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ -var="custom_metrics_enabled=${{ env.CUSTOM_METRICS_ENABLED }}" \ - + || deployment_failed=1 if [ $deployment_failed -eq 1 ]; then echo "Terraform deployment was unsuccessful. Will attempt to retry deployment." fi @@ -259,7 +259,7 @@ jobs: - name: Validate CWAgent metrics id: cwagent-metric-validation - if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() + if: (success() || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.log-validation.outcome == 'failure')) && !cancelled() run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} @@ -276,7 +276,7 @@ jobs: - name: Validate generated traces id: trace-validation - if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || steps.cwagent-metric-validation.outcome == 'failure') && !cancelled() + if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.cwagent-metric-validation.outcome == 'failure')) && !cancelled() run: ./gradlew validator:run --args='-c python/ec2/default/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} @@ -303,7 +303,7 @@ jobs: if: always() id: validation-result run: | - if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.cwagent-metric-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then + if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ env.CUSTOM_METRICS_ENABLED }}" = "true" ] && [ "${{ steps.cwagent-metric-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then echo "validation-result=success" >> $GITHUB_OUTPUT else echo "validation-result=failure" >> $GITHUB_OUTPUT diff --git a/.github/workflows/python-ec2-genesis-test.yml b/.github/workflows/python-ec2-genesis-test.yml index 7ed546105..3378b3837 100644 --- a/.github/workflows/python-ec2-genesis-test.yml +++ b/.github/workflows/python-ec2-genesis-test.yml @@ -20,7 +20,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} diff --git a/.github/workflows/python-sample-app-s3-deploy.yml b/.github/workflows/python-sample-app-s3-deploy.yml index 28e3d31bd..0a0434ee6 100644 --- a/.github/workflows/python-sample-app-s3-deploy.yml +++ b/.github/workflows/python-sample-app-s3-deploy.yml @@ -48,11 +48,11 @@ jobs: - name: Build Sample App Zip working-directory: sample-apps/python - run: zip -r python-sample-app.zip . + run: zip -r python-sample-app-delete-me.zip . - name: Upload to S3 working-directory: sample-apps/python - 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 + 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 - name: Build Gen AI Sample App Zip working-directory: sample-apps/python/genai_service diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..678e437ab --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +## SPDX-License-Identifier: Apache-2.0 + +# This is a reusable workflow for running the Enablement 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: Test +on: + push: + branches: + - otel-custom-metrics-test + +permissions: + id-token: write + contents: read + +jobs: + java-ec2-default: + uses: ./.github/workflows/python-ec2-default-test.yml + secrets: inherit + with: + caller-workflow-name: 'test' + aws-region: 'us-east-1' + custom-metrics-enabled: false + + custom-metrics: + uses: ./.github/workflows/python-ec2-default-test.yml + secrets: inherit + with: + caller-workflow-name: 'test' + aws-region: 'us-east-1' + custom-metrics-enabled: true \ No newline at end of file diff --git a/terraform/dotnet/lambda/lambda/variables.tf b/terraform/dotnet/lambda/lambda/variables.tf index 5fe066321..7c8102bee 100644 --- a/terraform/dotnet/lambda/lambda/variables.tf +++ b/terraform/dotnet/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-east-1" - default = "us-east-1" + description = "Lambda function running region, default value is us-west-2" + default = "us-west-2" } variable "is_canary" { diff --git a/terraform/java/lambda/lambda/variables.tf b/terraform/java/lambda/lambda/variables.tf index 1adf689bd..eb8cbf91e 100644 --- a/terraform/java/lambda/lambda/variables.tf +++ b/terraform/java/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-east-1" - default = "us-east-1" + description = "Lambda function running region, default value is us-west-2" + default = "us-west-2" } variable "is_canary" { diff --git a/terraform/node/lambda/lambda/variables.tf b/terraform/node/lambda/lambda/variables.tf index b7249149f..b20a2e500 100644 --- a/terraform/node/lambda/lambda/variables.tf +++ b/terraform/node/lambda/lambda/variables.tf @@ -30,8 +30,8 @@ variable "architecture" { variable "region" { type = string - description = "Lambda function running region, default value is us-east-1" - default = "us-east-1" + description = "Lambda function running region, default value is us-west-2" + default = "us-west-2" } variable "is_canary" { diff --git a/terraform/python/ec2/default/amazon-cloudwatch-agent.json b/terraform/python/ec2/default/amazon-cloudwatch-agent.json index 22c1eb736..f65bfe32e 100644 --- a/terraform/python/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/python/ec2/default/amazon-cloudwatch-agent.json @@ -1,4 +1,8 @@ { + "agent": { + "debug": true, + "region": "$REGION" + }, "traces": { "traces_collected": { "application_signals": {} diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 3b3798e56..bd581fd53 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -161,8 +161,8 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip - unzip -o python-sample-app.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip + unzip -o python-sample-app-delete-me.zip # Export environment variables for instrumentation cd ./django_frontend_service @@ -184,10 +184,6 @@ resource "null_resource" "main_service_setup" { export OTEL_RESOURCE_ATTRIBUTES="Service=python-sample-application-${var.test_id},Environment=ec2:default" export AWS_REGION='${var.aws_region}' export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' - export RDS_MYSQL_CLUSTER_ENDPOINT='dummy-endpoint' - export RDS_MYSQL_CLUSTER_PASSWORD='ZHVtbXk=' # base64 encoded 'dummy' - export RDS_MYSQL_CLUSTER_USERNAME='dummy-user' - export RDS_MYSQL_CLUSTER_DATABASE='dummy-db' python${var.language_version} manage.py migrate nohup opentelemetry-instrument python${var.language_version} manage.py runserver 0.0.0.0:8000 --noreload & @@ -300,8 +296,8 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip - unzip -o python-sample-app.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip + unzip -o python-sample-app-delete-me.zip # Export environment variables for instrumentation cd ./django_remote_service diff --git a/terraform/python/lambda/lambda/variables.tf b/terraform/python/lambda/lambda/variables.tf index 8d8dfca60..bf628b567 100644 --- a/terraform/python/lambda/lambda/variables.tf +++ b/terraform/python/lambda/lambda/variables.tf @@ -36,8 +36,8 @@ variable "is_canary" { variable "region" { type = string - description = "Lambda function running region, default value is us-east-1" - default = "us-east-1" + description = "Lambda function running region, default value is us-west-2" + default = "us-west-2" } variable "layer_artifacts_directory" { diff --git a/validator/src/main/java/com/amazon/aoc/App.java b/validator/src/main/java/com/amazon/aoc/App.java index 109b9d44c..674cfb2ef 100644 --- a/validator/src/main/java/com/amazon/aoc/App.java +++ b/validator/src/main/java/com/amazon/aoc/App.java @@ -97,7 +97,7 @@ public class App implements Callable { @CommandLine.Option( names = {"--region"}, - defaultValue = "us-east-1") + defaultValue = "us-west-2") private String region; @CommandLine.Option(names = {"--availability-zone"}) diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index 9113058e9..e785f07f0 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -210,8 +210,8 @@ public enum PredefinedExpectedTemplate implements FileConfig { PYTHON_EC2_DEFAULT_CLIENT_CALL_METRIC("/expected-data-template/python/ec2/default/client-call-metric.mustache"), PYTHON_EC2_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/python/ec2/default/client-call-trace.mustache"), -/** Python EC2 Default Custom Metrics Test Case Validations */ - PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), + /** Python EC2 Default Custom Metrics Test Case Validations */ + PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache"), /** Python EC2 Asg Test Case Validations */ PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_LOG("/expected-data-template/python/ec2/asg/outgoing-http-call-log.mustache"), diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache similarity index 93% rename from validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache rename to validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache index d57f04cf9..d92da9c8f 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache @@ -15,13 +15,13 @@ value: {{serviceName}} - name: cloud.account.id - value: ANY_VALUE + value: 654654176582 - name: cloud.availability_zone value: ANY_VALUE - name: cloud.platform - value: ANY_VALUE + value: aws_ec2 - name: cloud.provider value: aws @@ -36,7 +36,7 @@ value: ANY_VALUE - name: host.type - value: ANY_VALUE + value: t3.micro - name: operation.type value: custom_export_1 @@ -70,13 +70,13 @@ value: {{serviceName}} - name: cloud.account.id - value: ANY_VALUE + value: 654654176582 - name: cloud.availability_zone value: ANY_VALUE - name: cloud.platform - value: ANY_VALUE + value: aws_ec2 - name: cloud.provider value: aws @@ -91,7 +91,7 @@ value: ANY_VALUE - name: host.type - value: ANY_VALUE + value: t3.micro - name: operation.type value: histogram diff --git a/validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/custom-metric-validation.yml similarity index 100% rename from validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml rename to validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/custom-metric-validation.yml From 3d7b835e8db3e33e36cb3a7e3b7165a345ef2f3e Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 17 Oct 2025 15:22:03 -0700 Subject: [PATCH 71/82] updated test region --- .github/workflows/java-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/node-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/test.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/java-ec2-adot-sigv4-test.yml b/.github/workflows/java-ec2-adot-sigv4-test.yml index 53b9b7945..ab42a5a38 100644 --- a/.github/workflows/java-ec2-adot-sigv4-test.yml +++ b/.github/workflows/java-ec2-adot-sigv4-test.yml @@ -34,7 +34,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-west-2' # Test uses us-east-1 in the us-east-1 account + E2E_TEST_AWS_REGION: 'us-west-2' # Test uses us-west-2 in the us-east-1 account CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} METRIC_NAMESPACE: ApplicationSignals JAVA_VERSION: ${{ inputs.java-version }} diff --git a/.github/workflows/node-ec2-adot-sigv4-test.yml b/.github/workflows/node-ec2-adot-sigv4-test.yml index b99e59bb7..18d97022a 100644 --- a/.github/workflows/node-ec2-adot-sigv4-test.yml +++ b/.github/workflows/node-ec2-adot-sigv4-test.yml @@ -32,7 +32,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} NODE_VERSION: ${{ inputs.node-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d5732ab2e..678e437ab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: secrets: inherit with: caller-workflow-name: 'test' - aws-region: 'us-west-2' + aws-region: 'us-east-1' custom-metrics-enabled: false custom-metrics: @@ -28,5 +28,5 @@ jobs: secrets: inherit with: caller-workflow-name: 'test' - aws-region: 'us-west-2' + aws-region: 'us-east-1' custom-metrics-enabled: true \ No newline at end of file From ee3b35798240c796de939d5334103ddd7b877caa Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 17 Oct 2025 15:34:10 -0700 Subject: [PATCH 72/82] updating validator run path --- .github/workflows/python-ec2-default-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 2c7acfc4e..c3d84d1b0 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -260,7 +260,7 @@ jobs: - name: Validate CWAgent metrics id: cwagent-metric-validation if: (success() || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.log-validation.outcome == 'failure')) && !cancelled() - run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml + run: ./gradlew validator:run --args='-c python/ec2/custom-metrics/custom-metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001 From 5fe3e7a42d07806d16d2c87b936deafdc9384df1 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Fri, 17 Oct 2025 15:44:36 -0700 Subject: [PATCH 73/82] moved custom-metric-validation file location --- .../python/ec2/custom-metrics/custom-metric-validation.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename validator/src/main/resources/{expected-data-template => validations}/python/ec2/custom-metrics/custom-metric-validation.yml (100%) diff --git a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/custom-metric-validation.yml b/validator/src/main/resources/validations/python/ec2/custom-metrics/custom-metric-validation.yml similarity index 100% rename from validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/custom-metric-validation.yml rename to validator/src/main/resources/validations/python/ec2/custom-metrics/custom-metric-validation.yml From 3985b9be42963d500b6c12af756baf784d75f36a Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 20 Oct 2025 07:10:30 -0700 Subject: [PATCH 74/82] removing test file and deleting delete-me files --- .github/workflows/python-ec2-default-test.yml | 2 +- .../workflows/python-sample-app-s3-deploy.yml | 4 +-- .github/workflows/test.yml | 32 ------------------- terraform/python/ec2/default/main.tf | 8 ++--- 4 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index c3d84d1b0..9525d8439 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -54,7 +54,7 @@ env: ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} - SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip + SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals diff --git a/.github/workflows/python-sample-app-s3-deploy.yml b/.github/workflows/python-sample-app-s3-deploy.yml index 0a0434ee6..28e3d31bd 100644 --- a/.github/workflows/python-sample-app-s3-deploy.yml +++ b/.github/workflows/python-sample-app-s3-deploy.yml @@ -48,11 +48,11 @@ jobs: - name: Build Sample App Zip working-directory: sample-apps/python - run: zip -r python-sample-app-delete-me.zip . + run: zip -r python-sample-app.zip . - name: Upload to S3 working-directory: sample-apps/python - 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 + 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 - name: Build Gen AI Sample App Zip working-directory: sample-apps/python/genai_service diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 678e437ab..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,32 +0,0 @@ -## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -## SPDX-License-Identifier: Apache-2.0 - -# This is a reusable workflow for running the Enablement 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: Test -on: - push: - branches: - - otel-custom-metrics-test - -permissions: - id-token: write - contents: read - -jobs: - java-ec2-default: - uses: ./.github/workflows/python-ec2-default-test.yml - secrets: inherit - with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' - custom-metrics-enabled: false - - custom-metrics: - uses: ./.github/workflows/python-ec2-default-test.yml - secrets: inherit - with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' - custom-metrics-enabled: true \ No newline at end of file diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index bd581fd53..46fe1ecc3 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -161,8 +161,8 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip - unzip -o python-sample-app-delete-me.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip + unzip -o python-sample-app.zip # Export environment variables for instrumentation cd ./django_frontend_service @@ -296,8 +296,8 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip - unzip -o python-sample-app-delete-me.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip + unzip -o python-sample-app.zip # Export environment variables for instrumentation cd ./django_remote_service From 12f6e21f9ee5e289e985fad0dc846b1b1bc19a16 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 20 Oct 2025 07:20:26 -0700 Subject: [PATCH 75/82] updating sdk.version --- .github/workflows/dotnet-ec2-adot-sigv4-test.yml | 2 +- .../python/ec2/custom-metrics/aws-otel-custom-metrics.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml index c3188707a..4096f6977 100644 --- a/.github/workflows/dotnet-ec2-adot-sigv4-test.yml +++ b/.github/workflows/dotnet-ec2-adot-sigv4-test.yml @@ -26,7 +26,7 @@ permissions: contents: read env: - E2E_TEST_AWS_REGION: 'us-east-1' + E2E_TEST_AWS_REGION: 'us-west-2' E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} DOTNET_VERSION: ${{ inputs.dotnet-version }} diff --git a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache index d92da9c8f..05b854ab0 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache @@ -54,7 +54,7 @@ value: opentelemetry - name: telemetry.sdk.version - value: 1.33.1 + value: ANY_VALUE - metricName: test_histogram namespace: CWAgent From a2c40410762d4ca3244890a2f6151bc5e49e059a Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 20 Oct 2025 07:21:03 -0700 Subject: [PATCH 76/82] updating sdk.version --- .../python/ec2/custom-metrics/aws-otel-custom-metrics.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache index 05b854ab0..ed7614248 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache @@ -109,4 +109,4 @@ value: opentelemetry - name: telemetry.sdk.version - value: 1.33.1 \ No newline at end of file + value: ANY_VALUE \ No newline at end of file From e1717f119ea82ce3b7ab7aa0cbd02f4b9f53b513 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 20 Oct 2025 10:10:09 -0700 Subject: [PATCH 77/82] testing 2nd round pr updates --- .github/workflows/python-ec2-default-test.yml | 11 ++++--- .../workflows/python-sample-app-s3-deploy.yml | 4 +-- .github/workflows/test.yml | 30 +++++++++++++++++++ terraform/python/ec2/adot-genai/variables.tf | 2 +- terraform/python/ec2/default/main.tf | 9 +++--- terraform/python/ec2/default/variables.tf | 8 ----- .../PredefinedExpectedTemplate.java | 2 +- .../aws-otel-custom-metrics.mustache | 12 ++++---- .../custom-metric-validation.yml | 0 9 files changed, 49 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/test.yml rename validator/src/main/resources/expected-data-template/python/ec2/{custom-metrics => default}/aws-otel-custom-metrics.mustache (93%) rename validator/src/main/resources/validations/python/ec2/{custom-metrics => default}/custom-metric-validation.yml (100%) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 9525d8439..21f039a59 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -54,7 +54,7 @@ env: ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} - SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip + SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -176,7 +176,6 @@ jobs: -var="get_adot_wheel_command=${{ env.GET_ADOT_WHEEL_COMMAND }}" \ -var="language_version=${{ env.PYTHON_VERSION }}" \ -var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \ - -var="custom_metrics_enabled=${{ env.CUSTOM_METRICS_ENABLED }}" \ || deployment_failed=1 if [ $deployment_failed -eq 1 ]; then echo "Terraform deployment was unsuccessful. Will attempt to retry deployment." @@ -259,8 +258,8 @@ jobs: - name: Validate CWAgent metrics id: cwagent-metric-validation - if: (success() || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.log-validation.outcome == 'failure')) && !cancelled() - run: ./gradlew validator:run --args='-c python/ec2/custom-metrics/custom-metric-validation.yml + if: (success() || ( steps.log-validation.outcome == 'failure') && !cancelled() + run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001 @@ -276,7 +275,7 @@ jobs: - name: Validate generated traces id: trace-validation - if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || (env.CUSTOM_METRICS_ENABLED == 'true' && steps.cwagent-metric-validation.outcome == 'failure')) && !cancelled() + if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || (steps.cwagent-metric-validation.outcome == 'failure') && !cancelled() run: ./gradlew validator:run --args='-c python/ec2/default/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} @@ -303,7 +302,7 @@ jobs: if: always() id: validation-result run: | - if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ env.CUSTOM_METRICS_ENABLED }}" = "true" ] && [ "${{ steps.cwagent-metric-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then + if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.cwagent-metric-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then echo "validation-result=success" >> $GITHUB_OUTPUT else echo "validation-result=failure" >> $GITHUB_OUTPUT diff --git a/.github/workflows/python-sample-app-s3-deploy.yml b/.github/workflows/python-sample-app-s3-deploy.yml index 28e3d31bd..0a0434ee6 100644 --- a/.github/workflows/python-sample-app-s3-deploy.yml +++ b/.github/workflows/python-sample-app-s3-deploy.yml @@ -48,11 +48,11 @@ jobs: - name: Build Sample App Zip working-directory: sample-apps/python - run: zip -r python-sample-app.zip . + run: zip -r python-sample-app-delete-me.zip . - name: Upload to S3 working-directory: sample-apps/python - 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 + 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 - name: Build Gen AI Sample App Zip working-directory: sample-apps/python/genai_service diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..a992e8e00 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +## SPDX-License-Identifier: Apache-2.0 + +# This is a reusable workflow for running the Enablement 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: Test +on: + push: + branches: + - otel-custom-metrics-test + +permissions: + id-token: write + contents: read + +jobs: + java-ec2-default: + uses: ./.github/workflows/python-ec2-default-test.yml + secrets: inherit + with: + caller-workflow-name: 'test' + aws-region: 'us-east-1' + + custom-metrics: + uses: ./.github/workflows/python-ec2-default-test.yml + secrets: inherit + with: + caller-workflow-name: 'test' + aws-region: 'us-east-1' diff --git a/terraform/python/ec2/adot-genai/variables.tf b/terraform/python/ec2/adot-genai/variables.tf index 3abb61f4b..b8f0d21cb 100644 --- a/terraform/python/ec2/adot-genai/variables.tf +++ b/terraform/python/ec2/adot-genai/variables.tf @@ -14,7 +14,7 @@ # ------------------------------------------------------------------------- variable "aws_region" { - default = "us-east-1" + default = "us-west-2" } variable "test_id" { diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 46fe1ecc3..75250bdcd 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -161,8 +161,8 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip - unzip -o python-sample-app.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip + unzip -o python-sample-app-delete-me.zip # Export environment variables for instrumentation cd ./django_frontend_service @@ -183,7 +183,6 @@ resource "null_resource" "main_service_setup" { export OTEL_TRACES_SAMPLER=always_on export OTEL_RESOURCE_ATTRIBUTES="Service=python-sample-application-${var.test_id},Environment=ec2:default" export AWS_REGION='${var.aws_region}' - export CUSTOM_METRICS_ENABLED='${var.custom_metrics_enabled}' python${var.language_version} manage.py migrate nohup opentelemetry-instrument python${var.language_version} manage.py runserver 0.0.0.0:8000 --noreload & @@ -296,8 +295,8 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip - unzip -o python-sample-app.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip + unzip -o python-sample-app-delete-me.zip # Export environment variables for instrumentation cd ./django_remote_service diff --git a/terraform/python/ec2/default/variables.tf b/terraform/python/ec2/default/variables.tf index 2fec6628c..ec2812438 100644 --- a/terraform/python/ec2/default/variables.tf +++ b/terraform/python/ec2/default/variables.tf @@ -47,12 +47,4 @@ variable "language_version" { variable "cpu_architecture" { default = "x86_64" -} - -#Adding Custom Metrics Variables - -variable "custom_metrics_enabled" { - description = "Enable custom OTEL metrics in the sample application" - type = bool - default = false } \ No newline at end of file diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index e785f07f0..9346119ee 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -211,7 +211,7 @@ public enum PredefinedExpectedTemplate implements FileConfig { PYTHON_EC2_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/python/ec2/default/client-call-trace.mustache"), /** Python EC2 Default Custom Metrics Test Case Validations */ - PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache"), + PYTHON_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache"), /** Python EC2 Asg Test Case Validations */ PYTHON_EC2_ASG_OUTGOING_HTTP_CALL_LOG("/expected-data-template/python/ec2/asg/outgoing-http-call-log.mustache"), diff --git a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache similarity index 93% rename from validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache rename to validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index ed7614248..40668c9ab 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/custom-metrics/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -15,7 +15,7 @@ value: {{serviceName}} - name: cloud.account.id - value: 654654176582 + value: ANY_VALUE - name: cloud.availability_zone value: ANY_VALUE @@ -27,7 +27,7 @@ value: aws - name: cloud.region - value: us-east-1 + value: {{AWS_REGION}} - name: host.id value: ANY_VALUE @@ -36,7 +36,7 @@ value: ANY_VALUE - name: host.type - value: t3.micro + value: ANY_VALUE - name: operation.type value: custom_export_1 @@ -70,7 +70,7 @@ value: {{serviceName}} - name: cloud.account.id - value: 654654176582 + value: ANY_VALUE - name: cloud.availability_zone value: ANY_VALUE @@ -82,7 +82,7 @@ value: aws - name: cloud.region - value: us-east-1 + value: {{AWS_REGION}} - name: host.id value: ANY_VALUE @@ -91,7 +91,7 @@ value: ANY_VALUE - name: host.type - value: t3.micro + value: ANY_VALUE - name: operation.type value: histogram diff --git a/validator/src/main/resources/validations/python/ec2/custom-metrics/custom-metric-validation.yml b/validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml similarity index 100% rename from validator/src/main/resources/validations/python/ec2/custom-metrics/custom-metric-validation.yml rename to validator/src/main/resources/validations/python/ec2/default/custom-metric-validation.yml From c1401e79174e71b4dba9c9a1e8435db189d71d14 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 20 Oct 2025 10:19:28 -0700 Subject: [PATCH 78/82] fixing typos --- .github/workflows/python-ec2-default-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 21f039a59..fd37ad769 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -258,7 +258,7 @@ jobs: - name: Validate CWAgent metrics id: cwagent-metric-validation - if: (success() || ( steps.log-validation.outcome == 'failure') && !cancelled() + if: (success() || steps.log-validation.outcome == 'failure') && !cancelled() run: ./gradlew validator:run --args='-c python/ec2/default/custom-metric-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} @@ -275,7 +275,7 @@ jobs: - name: Validate generated traces id: trace-validation - if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || (steps.cwagent-metric-validation.outcome == 'failure') && !cancelled() + if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure' || steps.cwagent-metric-validation.outcome == 'failure') && !cancelled() run: ./gradlew validator:run --args='-c python/ec2/default/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} From 02b048967de0515f03086b24e7079832333b2b83 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 20 Oct 2025 10:35:53 -0700 Subject: [PATCH 79/82] updating ec2-default-test --- .github/workflows/python-ec2-default-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index fd37ad769..4dcf7de68 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -53,7 +53,6 @@ env: CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} - CUSTOM_METRICS_ENABLED: ${{ inputs.custom-metrics-enabled }} SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} From f1ab5d1fa7e0b1f7453b6ac8dd2b91e2016dda93 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 20 Oct 2025 10:45:04 -0700 Subject: [PATCH 80/82] updating ec2-default-test --- .github/workflows/python-ec2-default-test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 4dcf7de68..207e2fbd8 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -32,10 +32,6 @@ on: required: false type: string default: 'github' - custom-metrics-enabled: - required: false - type: boolean - default: false outputs: job-started: value: ${{ jobs.python-ec2-default.outputs.job-started }} From 6f29d955eb7a38dc01ae3e39a5fbf657e3ce304d Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 20 Oct 2025 11:15:27 -0700 Subject: [PATCH 81/82] updating cloud region to bypass population error for aws_region var --- .../python/ec2/default/aws-otel-custom-metrics.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache index 40668c9ab..f78f91307 100644 --- a/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/python/ec2/default/aws-otel-custom-metrics.mustache @@ -27,7 +27,7 @@ value: aws - name: cloud.region - value: {{AWS_REGION}} + value: ANY_VALUE - name: host.id value: ANY_VALUE @@ -82,7 +82,7 @@ value: aws - name: cloud.region - value: {{AWS_REGION}} + value: ANY_VALUE - name: host.id value: ANY_VALUE From 113714c571e39366e7b387e00e0cd7516d53d335 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 20 Oct 2025 12:34:13 -0700 Subject: [PATCH 82/82] removing test and delete-me files --- .github/workflows/python-ec2-default-test.yml | 2 +- .../workflows/python-sample-app-s3-deploy.yml | 4 +-- .github/workflows/test.yml | 30 ------------------- terraform/python/ec2/default/main.tf | 8 ++--- 4 files changed, 7 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/python-ec2-default-test.yml b/.github/workflows/python-ec2-default-test.yml index 207e2fbd8..948ced649 100644 --- a/.github/workflows/python-ec2-default-test.yml +++ b/.github/workflows/python-ec2-default-test.yml @@ -49,7 +49,7 @@ env: CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }} OTEL_SOURCE: ${{ inputs.otel-source }} - SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app-delete-me.zip + SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals diff --git a/.github/workflows/python-sample-app-s3-deploy.yml b/.github/workflows/python-sample-app-s3-deploy.yml index 0a0434ee6..28e3d31bd 100644 --- a/.github/workflows/python-sample-app-s3-deploy.yml +++ b/.github/workflows/python-sample-app-s3-deploy.yml @@ -48,11 +48,11 @@ jobs: - name: Build Sample App Zip working-directory: sample-apps/python - run: zip -r python-sample-app-delete-me.zip . + run: zip -r python-sample-app.zip . - name: Upload to S3 working-directory: sample-apps/python - 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 + 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 - name: Build Gen AI Sample App Zip working-directory: sample-apps/python/genai_service diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index a992e8e00..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,30 +0,0 @@ -## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -## SPDX-License-Identifier: Apache-2.0 - -# This is a reusable workflow for running the Enablement 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: Test -on: - push: - branches: - - otel-custom-metrics-test - -permissions: - id-token: write - contents: read - -jobs: - java-ec2-default: - uses: ./.github/workflows/python-ec2-default-test.yml - secrets: inherit - with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' - - custom-metrics: - uses: ./.github/workflows/python-ec2-default-test.yml - secrets: inherit - with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' diff --git a/terraform/python/ec2/default/main.tf b/terraform/python/ec2/default/main.tf index 75250bdcd..142545dde 100644 --- a/terraform/python/ec2/default/main.tf +++ b/terraform/python/ec2/default/main.tf @@ -161,8 +161,8 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip - unzip -o python-sample-app-delete-me.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip + unzip -o python-sample-app.zip # Export environment variables for instrumentation cd ./django_frontend_service @@ -295,8 +295,8 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_wheel_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_zip} ./python-sample-app-delete-me.zip - unzip -o python-sample-app-delete-me.zip + aws s3 cp ${var.sample_app_zip} ./python-sample-app.zip + unzip -o python-sample-app.zip # Export environment variables for instrumentation cd ./django_remote_service