From 0392d075a12194a1d4dbd7d6809840349aef2ab3 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 30 Oct 2025 10:05:57 -0700 Subject: [PATCH 01/28] Testing Java custom metrics --- .github/workflows/test.yml | 23 ++ .../springboot-main-service/build.gradle.kts | 4 + .../sampleapp/FrontendServiceController.java | 68 +++++- .../ec2/default/amazon-cloudwatch-agent.json | 6 +- terraform/java/ec2/default/main.tf | 15 +- .../PredefinedExpectedTemplate.java | 3 + .../default/aws-otel-custom-metrics.mustache | 228 ++++++++++++++++++ .../ec2/default/custom-metric-validation.yml | 6 + 8 files changed, 345 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache create mode 100644 validator/src/main/resources/validations/java/ec2/default/custom-metric-validation.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..6da228c75 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +## 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: + - Java_Custom_metrics + +permissions: + id-token: write + contents: read + +jobs: + python-ec2-default: + uses: ./.github/workflows/java-ec2-default-test.yml + secrets: inherit + with: + caller-workflow-name: 'test' + aws-region: 'us-east-1' \ No newline at end of file diff --git a/sample-apps/java/springboot-main-service/build.gradle.kts b/sample-apps/java/springboot-main-service/build.gradle.kts index 16efdcfe4..ca79ae082 100644 --- a/sample-apps/java/springboot-main-service/build.gradle.kts +++ b/sample-apps/java/springboot-main-service/build.gradle.kts @@ -43,6 +43,10 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-logging") implementation("io.opentelemetry:opentelemetry-api:1.34.1") + implementation("io.opentelemetry:opentelemetry-sdk:1.34.1") + implementation("io.opentelemetry:opentelemetry-sdk-metrics:1.34.1") + implementation("io.opentelemetry:opentelemetry-exporter-otlp:1.34.1") + implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:1.34.1") implementation("software.amazon.awssdk:s3") implementation("software.amazon.awssdk:sts") implementation("com.mysql:mysql-connector-j:8.4.0") diff --git a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java index a84855c9f..d20fc9538 100644 --- a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java @@ -45,6 +45,22 @@ import org.springframework.web.bind.annotation.ResponseBody; import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.GetBucketLocationRequest; +import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.api.metrics.Meter; +import io.opentelemetry.api.metrics.LongCounter; +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter; +import io.opentelemetry.sdk.metrics.export.MetricExporter; +import io.opentelemetry.sdk.metrics.SdkMeterProvider; +import io.opentelemetry.sdk.resources.Resource; +import io.opentelemetry.sdk.metrics.export.MetricReader; +import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader; +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.sdk.OpenTelemetrySdk; +import io.opentelemetry.api.metrics.DoubleHistogram; +import io.opentelemetry.api.metrics.LongUpDownCounter; +import java.time.Duration; @Controller public class FrontendServiceController { @@ -76,10 +92,50 @@ private void runLocalRootClientCallRecurringService() { // run the service executorService.scheduleAtFixedRate(runnableTask, 100, 1000, TimeUnit.MILLISECONDS); } + // Agent-based metrics using GlobalOpenTelemetry + private static final Meter meter = GlobalOpenTelemetry.getMeter("myMeter"); + private static final LongCounter counter = meter.counterBuilder("agent_based_counter").build(); + private static final DoubleHistogram histogram = meter.histogramBuilder("agent_based_histogram").build(); + private static final LongUpDownCounter gauge = meter.upDownCounterBuilder("agent_based_gauge").build(); + + // Pipeline-based metrics (initialized in constructor) + private final Meter pipelineMeter; + private final LongCounter pipelineCounter; + private final DoubleHistogram pipelineHistogram; + private final LongUpDownCounter pipelineGauge; + @Autowired public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { this.httpClient = httpClient; this.s3 = s3; + + MetricExporter pipelineMetricExporter = OtlpHttpMetricExporter.builder() + .setEndpoint("http://localhost:4318/v1/metrics") + .setTimeout(Duration.ofSeconds(10)) + .build(); + + MetricReader pipelineMetricReader = PeriodicMetricReader.builder(pipelineMetricExporter) + .setInterval(Duration.ofSeconds(60)) + .build(); + + SdkMeterProvider pipelineMeterProvider = SdkMeterProvider.builder() + .setResource(Resource.getDefault()) + .registerMetricReader(pipelineMetricReader) + .build(); + + OpenTelemetry openTelemetry = OpenTelemetrySdk.builder() + .setMeterProvider(pipelineMeterProvider) + .build(); + + // Initialize pipeline metrics + this.pipelineMeter = openTelemetry.getMeter("myMeter"); + this.pipelineCounter = pipelineMeter.counterBuilder("custom_pipeline_counter").build(); + this.pipelineHistogram = pipelineMeter.histogramBuilder("custom_pipeline_histogram").build(); + this.pipelineGauge = pipelineMeter.upDownCounterBuilder("custom_pipeline_gauge").build(); + } + + private int random(int min, int max) { + return (int) (Math.random() * (max - min + 1)) + min; } @GetMapping("/") @@ -92,6 +148,16 @@ public String healthcheck() { @GetMapping("/aws-sdk-call") @ResponseBody public String awssdkCall(@RequestParam(name = "testingId", required = false) String testingId) { + + logger.info("Incrementing custom counter - OpenTelemetry available: {}", GlobalOpenTelemetry.get() != null); + counter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); + histogram.record((double)random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); + gauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); + + pipelineCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_counter")); + pipelineHistogram.record(random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_histogram")); + pipelineGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_gauge")); + String bucketName = "e2e-test-bucket-name"; if (testingId != null) { bucketName += "-" + testingId; @@ -186,4 +252,4 @@ private String getXrayTraceId() { String xrayTraceId = "1-" + traceId.substring(0, 8) + "-" + traceId.substring(8); return String.format("{\"traceId\": \"%s\"}", xrayTraceId); } -} +} \ No newline at end of file diff --git a/terraform/java/ec2/default/amazon-cloudwatch-agent.json b/terraform/java/ec2/default/amazon-cloudwatch-agent.json index a98a40d36..f65bfe32e 100644 --- a/terraform/java/ec2/default/amazon-cloudwatch-agent.json +++ b/terraform/java/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 diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 3ef773a08..eebfdd30d 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -135,18 +135,21 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_jar_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_jar} ./main-service.jar + aws s3 cp ${var.sample_app_jar} ./main-service-delete-me.jar JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ - OTEL_METRICS_EXPORTER=none \ + OTEL_METRICS_EXPORTER=otlp \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ - OTEL_RESOURCE_ATTRIBUTES="service.name=sample-application-${var.test_id},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ + SERVICE_NAME='python-sample-application-${var.test_id}' + DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' + OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ + OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ - nohup java -XX:+UseG1GC -jar main-service.jar &> nohup.out & + nohup java -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds sleep 30 @@ -233,7 +236,7 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_jar_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_remote_app_jar} ./remote-service.jar + aws s3 cp ${var.sample_remote_app_jar} ./remote-service-delete-me.jar JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ OTEL_METRICS_EXPORTER=none \ @@ -244,7 +247,7 @@ resource "null_resource" "remote_service_setup" { OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ OTEL_RESOURCE_ATTRIBUTES=service.name=sample-remote-application-${var.test_id} \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ - nohup java -XX:+UseG1GC -jar remote-service.jar &> nohup.out & + nohup java -XX:+UseG1GC -jar remote-service-delete-me.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds sleep 30 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 9346119ee..a130d9cac 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -71,6 +71,9 @@ public enum PredefinedExpectedTemplate implements FileConfig { JAVA_EC2_DEFAULT_AWS_SDK_CALL_METRIC("/expected-data-template/java/ec2/default/aws-sdk-call-metric.mustache"), JAVA_EC2_DEFAULT_AWS_SDK_CALL_TRACE("/expected-data-template/java/ec2/default/aws-sdk-call-trace.mustache"), + /** Java EC2 Default Custom Metrics Test Case Validations */ + JAVA_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC("/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache"), + JAVA_EC2_DEFAULT_REMOTE_SERVICE_LOG("/expected-data-template/java/ec2/default/remote-service-log.mustache"), JAVA_EC2_DEFAULT_REMOTE_SERVICE_METRIC("/expected-data-template/java/ec2/default/remote-service-metric.mustache"), JAVA_EC2_DEFAULT_REMOTE_SERVICE_TRACE("/expected-data-template/java/ec2/default/remote-service-trace.mustache"), diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache new file mode 100644 index 000000000..ba88624c7 --- /dev/null +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache @@ -0,0 +1,228 @@ +# OpenTelemetry Custom Metrics Validation Templates - AWS SDK Call Only +# ANY_VALUE defines a string to = 'ANY_VALUE' to pass validation testing +# Custom export templates +- + metricName: agent_based_counter + namespace: {{metricNamespace}} + dimensions: + - + name: deployment.environment.name + value: ec2:default + - + name: aws.local.service + value: {{serviceName}} + - + name: cloud.region + value: {{region}} + - + name: service.name + value: {{serviceName}} + - + name: Operation + value: counter + - + name: host.type + value: ANY_VALUE + - + name: cloud.availability_zone + value: ANY_VALUE + - + name: telemetry.sdk.name + value: opentelemetry + - + name: telemetry.sdk.language + value: java + - + name: cloud.provider + value: aws + - + name: cloud.account.id + value: {{accountId}} + - + name: host.name + value: ANY_VALUE + - + name: telemetry.sdk.version + value: ANY_VALUE + - + name: host.id + value: ANY_VALUE + - + name: telemetry.auto.version + value: ANY_VALUE + - + name: cloud.platform + value: aws_ec2 +- + metricName: agent_based_histogram + namespace: {{metricNamespace}} + dimensions: + - + name: deployment.environment.name + value: ec2:default + - + name: aws.local.service + value: {{serviceName}} + - + name: cloud.region + value: {{region}} + - + name: service.name + value: {{serviceName}} + - + name: Operation + value: histogram + - + name: host.type + value: ANY_VALUE + - + name: cloud.availability_zone + value: ANY_VALUE + - + name: telemetry.sdk.name + value: opentelemetry + - + name: telemetry.sdk.language + value: java + - + name: cloud.provider + value: aws + - + name: cloud.account.id + value: {{accountId}} + - + name: host.name + value: ANY_VALUE + - + name: telemetry.sdk.version + value: ANY_VALUE + - + name: host.id + value: ANY_VALUE + - + name: telemetry.auto.version + value: ANY_VALUE + - + name: cloud.platform + value: aws_ec2 +- + metricName: agent_based_gauge + namespace: {{metricNamespace}} + dimensions: + - + name: deployment.environment.name + value: ec2:default + - + name: aws.local.service + value: {{serviceName}} + - + name: cloud.region + value: {{region}} + - + name: service.name + value: {{serviceName}} + - + name: Operation + value: gauge + - + name: host.type + value: ANY_VALUE + - + name: cloud.availability_zone + value: ANY_VALUE + - + name: telemetry.sdk.name + value: opentelemetry + - + name: telemetry.sdk.language + value: java + - + name: cloud.provider + value: aws + - + name: cloud.account.id + value: {{accountId}} + - + name: host.name + value: ANY_VALUE + - + name: telemetry.sdk.version + value: ANY_VALUE + - + name: host.id + value: ANY_VALUE + - + name: telemetry.auto.version + value: ANY_VALUE + - + name: cloud.platform + value: aws_ec2 + value: aws_ec2 + +# Export pipeline metrics +- + metricName: custom_pipeline_counter + namespace: {{metricNamespace}} + dimensions: + - + name: deployment.environment.name + value: ec2:default + - + name: service.name + value: {{serviceName}} + - + name: Operation + value: pipeline_counter + - + name: telemetry.sdk.name + value: opentelemetry + - + name: telemetry.sdk.language + value: java + - + name: telemetry.sdk.version + value: ANY_VALUE +- + metricName: custom_pipeline_histogram + namespace: {{metricNamespace}} + dimensions: + - + name: deployment.environment.name + value: ec2:default + - + name: service.name + value: {{serviceName}} + - + name: Operation + value: pipeline_histogram + - + name: telemetry.sdk.name + value: opentelemetry + - + name: telemetry.sdk.language + value: java + - + name: telemetry.sdk.version + value: ANY_VALUE +- + metricName: custom_pipeline_gauge + namespace: {{metricNamespace}} + dimensions: + - + name: deployment.environment.name + value: ec2:default + - + name: service.name + value: {{serviceName}} + - + name: Operation + value: pipeline_gauge + - + name: telemetry.sdk.name + value: opentelemetry + - + name: telemetry.sdk.language + value: java + - + name: telemetry.sdk.version + value: ANY_VALUE \ No newline at end of file diff --git a/validator/src/main/resources/validations/java/ec2/default/custom-metric-validation.yml b/validator/src/main/resources/validations/java/ec2/default/custom-metric-validation.yml new file mode 100644 index 000000000..2e1b27ac3 --- /dev/null +++ b/validator/src/main/resources/validations/java/ec2/default/custom-metric-validation.yml @@ -0,0 +1,6 @@ +- + validationType: "cw-metric" + httpPath: "aws-sdk-call" + httpMethod: "get" + callingType: "http-with-query" + expectedMetricTemplate: "JAVA_EC2_DEFAULT_AWS_OTEL_CUSTOM_METRIC" \ No newline at end of file From 2928537730534beab8c9d9140cc80afda8e0e174 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 30 Oct 2025 12:56:19 -0700 Subject: [PATCH 02/28] fixing pr changes --- .../sampleapp/FrontendServiceController.java | 15 +++++++-------- terraform/java/ec2/default/main.tf | 2 +- .../ec2/default/aws-otel-custom-metrics.mustache | 1 - 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java index d20fc9538..76398d812 100644 --- a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java @@ -94,15 +94,15 @@ private void runLocalRootClientCallRecurringService() { // run the service // Agent-based metrics using GlobalOpenTelemetry private static final Meter meter = GlobalOpenTelemetry.getMeter("myMeter"); - private static final LongCounter counter = meter.counterBuilder("agent_based_counter").build(); - private static final DoubleHistogram histogram = meter.histogramBuilder("agent_based_histogram").build(); - private static final LongUpDownCounter gauge = meter.upDownCounterBuilder("agent_based_gauge").build(); + private static final LongCounter agentBasedCounter = meter.counterBuilder("agent_based_counter").build(); + private static final DoubleHistogram agentBasedHistogram = meter.histogramBuilder("agent_based_histogram").build(); + private static final LongUpDownCounter agentBasedGauge = meter.upDownCounterBuilder("agent_based_gauge").build(); // Pipeline-based metrics (initialized in constructor) private final Meter pipelineMeter; - private final LongCounter pipelineCounter; - private final DoubleHistogram pipelineHistogram; - private final LongUpDownCounter pipelineGauge; + private final LongCounter CustomPipelineCounter; + private final DoubleHistogram CustomPipelineHistogram; + private final LongUpDownCounter CustomPipelineGauge; @Autowired public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { @@ -115,7 +115,7 @@ public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { .build(); MetricReader pipelineMetricReader = PeriodicMetricReader.builder(pipelineMetricExporter) - .setInterval(Duration.ofSeconds(60)) + .setInterval(Duration.ofSeconds(1)) .build(); SdkMeterProvider pipelineMeterProvider = SdkMeterProvider.builder() @@ -149,7 +149,6 @@ public String healthcheck() { @ResponseBody public String awssdkCall(@RequestParam(name = "testingId", required = false) String testingId) { - logger.info("Incrementing custom counter - OpenTelemetry available: {}", GlobalOpenTelemetry.get() != null); counter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); histogram.record((double)random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); gauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index eebfdd30d..8537c30d7 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -144,7 +144,7 @@ resource "null_resource" "main_service_setup" { OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ - SERVICE_NAME='python-sample-application-${var.test_id}' + SERVICE_NAME='sample-application-${var.test_id}' DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache index ba88624c7..9ec466b63 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache @@ -157,7 +157,6 @@ - name: cloud.platform value: aws_ec2 - value: aws_ec2 # Export pipeline metrics - From feaa11a015826e66ffc71d5803645d2aba0edf07 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 30 Oct 2025 14:18:49 -0700 Subject: [PATCH 03/28] addressing pr comments --- .github/workflows/java-ec2-default-test.yml | 22 +++++++- .github/workflows/test.yml | 2 +- .../sampleapp/FrontendServiceController.java | 50 ++++++++++++------- terraform/java/ec2/default/main.tf | 1 + 4 files changed, 55 insertions(+), 20 deletions(-) diff --git a/.github/workflows/java-ec2-default-test.yml b/.github/workflows/java-ec2-default-test.yml index b94942178..7dafe7af9 100644 --- a/.github/workflows/java-ec2-default-test.yml +++ b/.github/workflows/java-ec2-default-test.yml @@ -251,9 +251,27 @@ jobs: --instance-id ${{ env.MAIN_SERVICE_INSTANCE_ID }} --rollup' + - name: Validate custom metrics + id: cwagent-metric-validation + if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled() + run: ./gradlew validator:run --args='-c java/ec2/default/metric-validation.yml + --testing-id ${{ env.TESTING_ID }} + --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} + --remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080 + --region ${{ inputs.aws-region }} + --account-id ${{ env.ACCOUNT_ID }} + --metric-namespace CWAgent + --log-group ${{ env.LOG_GROUP_NAME }} + --service-name sample-application-${{ env.TESTING_ID }} + --remote-service-name sample-remote-application-${{ env.TESTING_ID }} + --query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }} + --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 java/ec2/default/trace-validation.yml --testing-id ${{ env.TESTING_ID }} --endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }} @@ -280,7 +298,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.metric-validation.outcome }}" = "success" ] && [ "${{ steps.cwagent-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/test.yml b/.github/workflows/test.yml index 6da228c75..656aba12a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ permissions: contents: read jobs: - python-ec2-default: + java-ec2-default: uses: ./.github/workflows/java-ec2-default-test.yml secrets: inherit with: diff --git a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java index 76398d812..c22d578c2 100644 --- a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java @@ -99,27 +99,43 @@ private void runLocalRootClientCallRecurringService() { // run the service private static final LongUpDownCounter agentBasedGauge = meter.upDownCounterBuilder("agent_based_gauge").build(); // Pipeline-based metrics (initialized in constructor) - private final Meter pipelineMeter; - private final LongCounter CustomPipelineCounter; - private final DoubleHistogram CustomPipelineHistogram; - private final LongUpDownCounter CustomPipelineGauge; + private final Meter customPipelineMeter; + private final LongCounter customPipelineCounter; + private final DoubleHistogram customPipelineHistogram; + private final LongUpDownCounter customPipelineGauge; @Autowired public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { this.httpClient = httpClient; this.s3 = s3; + + // Get environment variables + String serviceName = System.getenv("SERVICE_NAME"); + String deploymentEnvironmentName = System.getenv("DEPLOYMENT_ENVIRONMENT_NAME"); + + // Create pipeline resource without interfering attributes + Resource pipelineResource; + if (serviceName != null && deploymentEnvironmentName != null && + !serviceName.isEmpty() && !deploymentEnvironmentName.isEmpty()) { + pipelineResource = Resource.getDefault().toBuilder() + .put("service.name", serviceName) + .put("deployment.environment.name", deploymentEnvironmentName) + .build(); + } else { + pipelineResource = Resource.getDefault(); + } MetricExporter pipelineMetricExporter = OtlpHttpMetricExporter.builder() .setEndpoint("http://localhost:4318/v1/metrics") .setTimeout(Duration.ofSeconds(10)) .build(); - MetricReader pipelineMetricReader = PeriodicMetricReader.builder(pipelineMetricExporter) + MetricReader pipelineMetricReader = PeriodicMetricReader.builder(pipelineMetricExporter) .setInterval(Duration.ofSeconds(1)) .build(); SdkMeterProvider pipelineMeterProvider = SdkMeterProvider.builder() - .setResource(Resource.getDefault()) + .setResource(pipelineResource) .registerMetricReader(pipelineMetricReader) .build(); @@ -128,12 +144,12 @@ public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { .build(); // Initialize pipeline metrics - this.pipelineMeter = openTelemetry.getMeter("myMeter"); - this.pipelineCounter = pipelineMeter.counterBuilder("custom_pipeline_counter").build(); - this.pipelineHistogram = pipelineMeter.histogramBuilder("custom_pipeline_histogram").build(); - this.pipelineGauge = pipelineMeter.upDownCounterBuilder("custom_pipeline_gauge").build(); + this.customPipelineMeter = openTelemetry.getMeter("myMeter"); + this.customPipelineCounter = customPipelineMeter.counterBuilder("custom_pipeline_counter").build(); + this.customPipelineHistogram = customPipelineMeter.histogramBuilder("custom_pipeline_histogram").build(); + this.customPipelineGauge = customPipelineMeter.upDownCounterBuilder("custom_pipeline_gauge").build(); } - + private int random(int min, int max) { return (int) (Math.random() * (max - min + 1)) + min; } @@ -149,13 +165,13 @@ public String healthcheck() { @ResponseBody public String awssdkCall(@RequestParam(name = "testingId", required = false) String testingId) { - counter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); - histogram.record((double)random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); - gauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); + agentBasedCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); + agentBasedHistogram.record((double)random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); + agentBasedGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); - pipelineCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_counter")); - pipelineHistogram.record(random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_histogram")); - pipelineGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_gauge")); + customPipelineCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_counter")); + customPipelineHistogram.record(random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_histogram")); + customPipelineGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_gauge")); String bucketName = "e2e-test-bucket-name"; if (testingId != null) { diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 8537c30d7..c94b206e9 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -148,6 +148,7 @@ resource "null_resource" "main_service_setup" { DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ + AWS_REGION='${var.aws_region}' \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ nohup java -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & From 276b77ae8787757b624d09112f1043d6ba624d60 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Tue, 11 Nov 2025 07:39:54 -0800 Subject: [PATCH 04/28] Making pipeline conditional, JAR has NOT been created or uploaded --- .../sampleapp/FrontendServiceController.java | 71 ++++++++++--------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java index c22d578c2..59346fc2b 100644 --- a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java @@ -98,7 +98,7 @@ private void runLocalRootClientCallRecurringService() { // run the service private static final DoubleHistogram agentBasedHistogram = meter.histogramBuilder("agent_based_histogram").build(); private static final LongUpDownCounter agentBasedGauge = meter.upDownCounterBuilder("agent_based_gauge").build(); - // Pipeline-based metrics (initialized in constructor) + // Pipeline-based metrics (conditionally initialized) private final Meter customPipelineMeter; private final LongCounter customPipelineCounter; private final DoubleHistogram customPipelineHistogram; @@ -113,41 +113,45 @@ public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { String serviceName = System.getenv("SERVICE_NAME"); String deploymentEnvironmentName = System.getenv("DEPLOYMENT_ENVIRONMENT_NAME"); - // Create pipeline resource without interfering attributes - Resource pipelineResource; + // Only create pipeline if environment variables exist (matching Python logic) if (serviceName != null && deploymentEnvironmentName != null && !serviceName.isEmpty() && !deploymentEnvironmentName.isEmpty()) { - pipelineResource = Resource.getDefault().toBuilder() + + Resource pipelineResource = Resource.getDefault().toBuilder() .put("service.name", serviceName) .put("deployment.environment.name", deploymentEnvironmentName) .build(); + + MetricExporter pipelineMetricExporter = OtlpHttpMetricExporter.builder() + .setEndpoint("http://localhost:4317") + .setTimeout(Duration.ofSeconds(10)) + .build(); + + MetricReader pipelineMetricReader = PeriodicMetricReader.builder(pipelineMetricExporter) + .setInterval(Duration.ofSeconds(1)) + .build(); + + SdkMeterProvider pipelineMeterProvider = SdkMeterProvider.builder() + .setResource(pipelineResource) + .registerMetricReader(pipelineMetricReader) + .build(); + + OpenTelemetry openTelemetry = OpenTelemetrySdk.builder() + .setMeterProvider(pipelineMeterProvider) + .build(); + + // Initialize pipeline metrics + this.customPipelineMeter = openTelemetry.getMeter("myMeter"); + this.customPipelineCounter = customPipelineMeter.counterBuilder("custom_pipeline_counter").build(); + this.customPipelineHistogram = customPipelineMeter.histogramBuilder("custom_pipeline_histogram").build(); + this.customPipelineGauge = customPipelineMeter.upDownCounterBuilder("custom_pipeline_gauge").build(); } else { - pipelineResource = Resource.getDefault(); + // No pipeline metrics if environment variables missing + this.customPipelineMeter = null; + this.customPipelineCounter = null; + this.customPipelineHistogram = null; + this.customPipelineGauge = null; } - - MetricExporter pipelineMetricExporter = OtlpHttpMetricExporter.builder() - .setEndpoint("http://localhost:4318/v1/metrics") - .setTimeout(Duration.ofSeconds(10)) - .build(); - - MetricReader pipelineMetricReader = PeriodicMetricReader.builder(pipelineMetricExporter) - .setInterval(Duration.ofSeconds(1)) - .build(); - - SdkMeterProvider pipelineMeterProvider = SdkMeterProvider.builder() - .setResource(pipelineResource) - .registerMetricReader(pipelineMetricReader) - .build(); - - OpenTelemetry openTelemetry = OpenTelemetrySdk.builder() - .setMeterProvider(pipelineMeterProvider) - .build(); - - // Initialize pipeline metrics - this.customPipelineMeter = openTelemetry.getMeter("myMeter"); - this.customPipelineCounter = customPipelineMeter.counterBuilder("custom_pipeline_counter").build(); - this.customPipelineHistogram = customPipelineMeter.histogramBuilder("custom_pipeline_histogram").build(); - this.customPipelineGauge = customPipelineMeter.upDownCounterBuilder("custom_pipeline_gauge").build(); } private int random(int min, int max) { @@ -169,9 +173,12 @@ public String awssdkCall(@RequestParam(name = "testingId", required = false) Str agentBasedHistogram.record((double)random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); agentBasedGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); - customPipelineCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_counter")); - customPipelineHistogram.record(random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_histogram")); - customPipelineGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_gauge")); + // Only record pipeline metrics if pipeline exists (matching Python logic) + if (customPipelineCounter != null) { + customPipelineCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_counter")); + customPipelineHistogram.record(random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_histogram")); + customPipelineGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_gauge")); + } String bucketName = "e2e-test-bucket-name"; if (testingId != null) { From ff40e366181fea0a8e85ea3459f9a1573dfaa0d0 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 12 Nov 2025 20:37:49 -0800 Subject: [PATCH 05/28] Java ec2-default test 1 --- .github/workflows/java-ec2-default-test.yml | 2 +- .../java/com/amazon/sampleapp/FrontendServiceController.java | 2 +- terraform/java/ec2/default/main.tf | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/java-ec2-default-test.yml b/.github/workflows/java-ec2-default-test.yml index 7dafe7af9..892980146 100644 --- a/.github/workflows/java-ec2-default-test.yml +++ b/.github/workflows/java-ec2-default-test.yml @@ -44,7 +44,7 @@ env: JAVA_VERSION: ${{ inputs.java-version }} OTEL_SOURCE: ${{ inputs.otel-source }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v${{ inputs.java-version }}.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/main-service-delete-me.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v${{ inputs.java-version }}.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} diff --git a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java index 59346fc2b..d6d18e72d 100644 --- a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java @@ -123,7 +123,7 @@ public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { .build(); MetricExporter pipelineMetricExporter = OtlpHttpMetricExporter.builder() - .setEndpoint("http://localhost:4317") + .setEndpoint("http://localhost:4318/v1/metrics") .setTimeout(Duration.ofSeconds(10)) .build(); diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index c94b206e9..f515cb531 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -144,8 +144,8 @@ resource "null_resource" "main_service_setup" { OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ - SERVICE_NAME='sample-application-${var.test_id}' - DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' + SERVICE_NAME='sample-application-${var.test_id}' \ + DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ AWS_REGION='${var.aws_region}' \ From 9b8b0f370c926476599796eacb77ec6835348e47 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 12 Nov 2025 20:55:12 -0800 Subject: [PATCH 06/28] updating default-test to look for custom metrics --- .github/workflows/java-ec2-default-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/java-ec2-default-test.yml b/.github/workflows/java-ec2-default-test.yml index 892980146..707fce851 100644 --- a/.github/workflows/java-ec2-default-test.yml +++ b/.github/workflows/java-ec2-default-test.yml @@ -254,7 +254,7 @@ jobs: - name: Validate custom metrics id: cwagent-metric-validation if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled() - run: ./gradlew validator:run --args='-c java/ec2/default/metric-validation.yml + run: ./gradlew validator:run --args='-c java/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 }}:8080 From 93b32c6bf4355c30f28875a0833d994d3b923556 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 12 Nov 2025 21:48:23 -0800 Subject: [PATCH 07/28] testing env vars --- terraform/java/ec2/default/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index f515cb531..d11f877fa 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -147,6 +147,7 @@ resource "null_resource" "main_service_setup" { SERVICE_NAME='sample-application-${var.test_id}' \ DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ + OTEL_EXPORTER_OTLP_METRICS_INSECURE=true OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ AWS_REGION='${var.aws_region}' \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ From fac5d698093656c951661eb9306acbd813d8edfa Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 12 Nov 2025 22:07:57 -0800 Subject: [PATCH 08/28] java-ec2-default test 2 --- terraform/java/ec2/default/main.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index d11f877fa..f515cb531 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -147,7 +147,6 @@ resource "null_resource" "main_service_setup" { SERVICE_NAME='sample-application-${var.test_id}' \ DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ - OTEL_EXPORTER_OTLP_METRICS_INSECURE=true OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ AWS_REGION='${var.aws_region}' \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ From 0d7e9f415c899f4789a622abe9729b2bb416398f Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 12 Nov 2025 23:21:06 -0800 Subject: [PATCH 09/28] java-ec2-default test 3 --- terraform/java/ec2/default/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index f515cb531..d17b63e33 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -150,7 +150,7 @@ resource "null_resource" "main_service_setup" { OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ AWS_REGION='${var.aws_region}' \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ - nohup java -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & + nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds sleep 30 From 27f360e841d96c5aeb4bb6c3dc2b6578369de6b5 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Wed, 12 Nov 2025 23:38:47 -0800 Subject: [PATCH 10/28] java-ec2-default test 4 --- .../sampleapp/FrontendServiceController.java | 27 ++++++++++++------- terraform/java/ec2/default/main.tf | 1 + 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java index d6d18e72d..9c29928e4 100644 --- a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java @@ -93,10 +93,10 @@ private void runLocalRootClientCallRecurringService() { // run the service } // Agent-based metrics using GlobalOpenTelemetry - private static final Meter meter = GlobalOpenTelemetry.getMeter("myMeter"); - private static final LongCounter agentBasedCounter = meter.counterBuilder("agent_based_counter").build(); - private static final DoubleHistogram agentBasedHistogram = meter.histogramBuilder("agent_based_histogram").build(); - private static final LongUpDownCounter agentBasedGauge = meter.upDownCounterBuilder("agent_based_gauge").build(); + private final Meter agentMeter; + private final LongCounter agentBasedCounter; + private final DoubleHistogram agentBasedHistogram; + private final LongUpDownCounter agentBasedGauge; // Pipeline-based metrics (conditionally initialized) private final Meter customPipelineMeter; @@ -108,6 +108,14 @@ private void runLocalRootClientCallRecurringService() { // run the service public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { this.httpClient = httpClient; this.s3 = s3; + + // Initialize agent-based metrics using GLOBAL OpenTelemetry (ADOT agent's configuration) + this.agentMeter = GlobalOpenTelemetry.get().getMeter("agent-meter"); + this.agentBasedCounter = agentMeter.counterBuilder("agent_based_counter").build(); + this.agentBasedHistogram = agentMeter.histogramBuilder("agent_based_histogram").build(); + this.agentBasedGauge = agentMeter.upDownCounterBuilder("agent_based_gauge").build(); + logger.info("Agent-based metrics initialized: counter={}, histogram={}, gauge={}", + agentBasedCounter != null, agentBasedHistogram != null, agentBasedGauge != null); // Get environment variables String serviceName = System.getenv("SERVICE_NAME"); @@ -120,6 +128,7 @@ public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { Resource pipelineResource = Resource.getDefault().toBuilder() .put("service.name", serviceName) .put("deployment.environment.name", deploymentEnvironmentName) + .put("metric.source", "pipeline") .build(); MetricExporter pipelineMetricExporter = OtlpHttpMetricExporter.builder() @@ -136,12 +145,8 @@ public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { .registerMetricReader(pipelineMetricReader) .build(); - OpenTelemetry openTelemetry = OpenTelemetrySdk.builder() - .setMeterProvider(pipelineMeterProvider) - .build(); - - // Initialize pipeline metrics - this.customPipelineMeter = openTelemetry.getMeter("myMeter"); + // Initialize pipeline metrics using SEPARATE SdkMeterProvider + this.customPipelineMeter = pipelineMeterProvider.get("pipeline-meter"); this.customPipelineCounter = customPipelineMeter.counterBuilder("custom_pipeline_counter").build(); this.customPipelineHistogram = customPipelineMeter.histogramBuilder("custom_pipeline_histogram").build(); this.customPipelineGauge = customPipelineMeter.upDownCounterBuilder("custom_pipeline_gauge").build(); @@ -169,9 +174,11 @@ public String healthcheck() { @ResponseBody public String awssdkCall(@RequestParam(name = "testingId", required = false) String testingId) { + logger.info("Recording agent-based metrics"); agentBasedCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); agentBasedHistogram.record((double)random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); agentBasedGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); + logger.info("Agent-based metrics recorded"); // Only record pipeline metrics if pipeline exists (matching Python logic) if (customPipelineCounter != null) { diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index d17b63e33..e5bf293fe 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -150,6 +150,7 @@ resource "null_resource" "main_service_setup" { OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ AWS_REGION='${var.aws_region}' \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ + OTEL_JAVAAGENT_ENABLED=true \ nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds From f4a6aa0b14dc02fef6e3e4183bae8810c083ca40 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 13 Nov 2025 13:41:14 -0800 Subject: [PATCH 11/28] testing env variables --- .../sampleapp/FrontendServiceController.java | 65 +++++++++++++++++-- terraform/java/ec2/default/main.tf | 2 +- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java index 9c29928e4..476625e9f 100644 --- a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java @@ -109,54 +109,78 @@ public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { this.httpClient = httpClient; this.s3 = s3; + logger.info("Initializing FrontendServiceController with custom metrics..."); + // Initialize agent-based metrics using GLOBAL OpenTelemetry (ADOT agent's configuration) + logger.info("Creating agent-based metrics using GlobalOpenTelemetry..."); this.agentMeter = GlobalOpenTelemetry.get().getMeter("agent-meter"); + logger.info("Agent meter created: {}", agentMeter.getClass().getName()); + this.agentBasedCounter = agentMeter.counterBuilder("agent_based_counter").build(); this.agentBasedHistogram = agentMeter.histogramBuilder("agent_based_histogram").build(); this.agentBasedGauge = agentMeter.upDownCounterBuilder("agent_based_gauge").build(); - logger.info("Agent-based metrics initialized: counter={}, histogram={}, gauge={}", + logger.info("Agent-based metrics initialized successfully: counter={}, histogram={}, gauge={}", agentBasedCounter != null, agentBasedHistogram != null, agentBasedGauge != null); // Get environment variables String serviceName = System.getenv("SERVICE_NAME"); String deploymentEnvironmentName = System.getenv("DEPLOYMENT_ENVIRONMENT_NAME"); + logger.info("Environment variables - SERVICE_NAME: '{}', DEPLOYMENT_ENVIRONMENT_NAME: '{}'", + serviceName, deploymentEnvironmentName); // Only create pipeline if environment variables exist (matching Python logic) if (serviceName != null && deploymentEnvironmentName != null && !serviceName.isEmpty() && !deploymentEnvironmentName.isEmpty()) { + logger.info("Creating custom pipeline metrics with SERVICE_NAME='{}' and DEPLOYMENT_ENVIRONMENT_NAME='{}'", + serviceName, deploymentEnvironmentName); + Resource pipelineResource = Resource.getDefault().toBuilder() .put("service.name", serviceName) .put("deployment.environment.name", deploymentEnvironmentName) .put("metric.source", "pipeline") .build(); + logger.info("Pipeline resource created with attributes: {}", pipelineResource.getAttributes()); MetricExporter pipelineMetricExporter = OtlpHttpMetricExporter.builder() .setEndpoint("http://localhost:4318/v1/metrics") .setTimeout(Duration.ofSeconds(10)) .build(); + logger.info("Pipeline OTLP exporter created targeting: http://localhost:4318/v1/metrics"); MetricReader pipelineMetricReader = PeriodicMetricReader.builder(pipelineMetricExporter) .setInterval(Duration.ofSeconds(1)) .build(); + logger.info("Pipeline metric reader created with 1-second export interval"); SdkMeterProvider pipelineMeterProvider = SdkMeterProvider.builder() .setResource(pipelineResource) .registerMetricReader(pipelineMetricReader) .build(); + logger.info("Pipeline meter provider created: {}", pipelineMeterProvider.getClass().getName()); // Initialize pipeline metrics using SEPARATE SdkMeterProvider this.customPipelineMeter = pipelineMeterProvider.get("pipeline-meter"); + logger.info("Pipeline meter created: {}", customPipelineMeter.getClass().getName()); + this.customPipelineCounter = customPipelineMeter.counterBuilder("custom_pipeline_counter").build(); this.customPipelineHistogram = customPipelineMeter.histogramBuilder("custom_pipeline_histogram").build(); this.customPipelineGauge = customPipelineMeter.upDownCounterBuilder("custom_pipeline_gauge").build(); + + logger.info("Pipeline metrics initialized successfully: counter={}, histogram={}, gauge={}", + customPipelineCounter != null, customPipelineHistogram != null, customPipelineGauge != null); + logger.info("Custom pipeline metrics setup COMPLETE - will export to CloudWatch Agent on port 4318"); } else { // No pipeline metrics if environment variables missing + logger.warn("Pipeline metrics NOT created - missing environment variables (SERVICE_NAME or DEPLOYMENT_ENVIRONMENT_NAME)"); this.customPipelineMeter = null; this.customPipelineCounter = null; this.customPipelineHistogram = null; this.customPipelineGauge = null; } + + logger.info("FrontendServiceController initialization complete - Agent metrics: {}, Pipeline metrics: {}", + agentBasedCounter != null, customPipelineCounter != null); } private int random(int min, int max) { @@ -174,19 +198,46 @@ public String healthcheck() { @ResponseBody public String awssdkCall(@RequestParam(name = "testingId", required = false) String testingId) { - logger.info("Recording agent-based metrics"); + logger.info("=== RECORDING CUSTOM METRICS ==="); + + // Record agent-based metrics + logger.info("Recording agent-based metrics using GlobalOpenTelemetry..."); + int histogramValue = random(100,1000); + int gaugeValue = random(-10,10); + agentBasedCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); - agentBasedHistogram.record((double)random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); - agentBasedGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); - logger.info("Agent-based metrics recorded"); + logger.info("Agent counter incremented by 1 with Operation=counter"); + + agentBasedHistogram.record((double)histogramValue, Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); + logger.info("Agent histogram recorded value {} with Operation=histogram", histogramValue); + + agentBasedGauge.add(gaugeValue, Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); + logger.info("Agent gauge added {} with Operation=gauge", gaugeValue); + + logger.info("Agent-based metrics recording COMPLETE"); // Only record pipeline metrics if pipeline exists (matching Python logic) if (customPipelineCounter != null) { + logger.info("Recording pipeline metrics using custom SdkMeterProvider..."); + int pipelineHistogramValue = random(100,1000); + int pipelineGaugeValue = random(-10,10); + customPipelineCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_counter")); - customPipelineHistogram.record(random(100,1000), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_histogram")); - customPipelineGauge.add(random(-10,10), Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_gauge")); + logger.info("Pipeline counter incremented by 1 with Operation=pipeline_counter"); + + customPipelineHistogram.record(pipelineHistogramValue, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_histogram")); + logger.info("Pipeline histogram recorded value {} with Operation=pipeline_histogram", pipelineHistogramValue); + + customPipelineGauge.add(pipelineGaugeValue, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_gauge")); + logger.info("Pipeline gauge added {} with Operation=pipeline_gauge", pipelineGaugeValue); + + logger.info("Pipeline metrics recording COMPLETE - exported to localhost:4318"); + } else { + logger.warn("Pipeline metrics SKIPPED - customPipelineCounter is null"); } + logger.info("=== CUSTOM METRICS RECORDING FINISHED ==="); + String bucketName = "e2e-test-bucket-name"; if (testingId != null) { bucketName += "-" + testingId; diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index e5bf293fe..57e422307 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -138,7 +138,7 @@ resource "null_resource" "main_service_setup" { aws s3 cp ${var.sample_app_jar} ./main-service-delete-me.jar JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ - OTEL_METRICS_EXPORTER=otlp \ + OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \ From 0906587ae8d21780ab9f0e20730ddcb531de4f7c Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 13 Nov 2025 14:00:59 -0800 Subject: [PATCH 12/28] testing env variables --- .../sampleapp/FrontendServiceController.java | 35 +++++++++++++++---- terraform/java/ec2/default/main.tf | 10 ++---- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java index 476625e9f..191d2040e 100644 --- a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java @@ -202,19 +202,42 @@ public String awssdkCall(@RequestParam(name = "testingId", required = false) Str // Record agent-based metrics logger.info("Recording agent-based metrics using GlobalOpenTelemetry..."); + logger.info("GlobalOpenTelemetry instance: {}", GlobalOpenTelemetry.get().getClass().getName()); + logger.info("Agent meter instance: {}", agentMeter.getClass().getName()); + int histogramValue = random(100,1000); int gaugeValue = random(-10,10); - agentBasedCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); - logger.info("Agent counter incremented by 1 with Operation=counter"); + try { + agentBasedCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); + logger.info("Agent counter incremented by 1 with Operation=counter - SUCCESS"); + } catch (Exception e) { + logger.error("Failed to record agent counter: {}", e.getMessage()); + } - agentBasedHistogram.record((double)histogramValue, Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); - logger.info("Agent histogram recorded value {} with Operation=histogram", histogramValue); + try { + agentBasedHistogram.record((double)histogramValue, Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); + logger.info("Agent histogram recorded value {} with Operation=histogram - SUCCESS", histogramValue); + } catch (Exception e) { + logger.error("Failed to record agent histogram: {}", e.getMessage()); + } - agentBasedGauge.add(gaugeValue, Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); - logger.info("Agent gauge added {} with Operation=gauge", gaugeValue); + try { + agentBasedGauge.add(gaugeValue, Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); + logger.info("Agent gauge added {} with Operation=gauge - SUCCESS", gaugeValue); + } catch (Exception e) { + logger.error("Failed to record agent gauge: {}", e.getMessage()); + } logger.info("Agent-based metrics recording COMPLETE"); + + // Force flush to ensure metrics are sent + try { + logger.info("Attempting to force flush agent metrics..."); + // Note: GlobalOpenTelemetry doesn't expose flush directly, but metrics should auto-export + } catch (Exception e) { + logger.error("Failed to flush agent metrics: {}", e.getMessage()); + } // Only record pipeline metrics if pipeline exists (matching Python logic) if (customPipelineCounter != null) { diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 57e422307..993d43e84 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -138,19 +138,13 @@ resource "null_resource" "main_service_setup" { aws s3 cp ${var.sample_app_jar} ./main-service-delete-me.jar JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ - OTEL_METRICS_EXPORTER=none \ - OTEL_LOGS_EXPORT=none \ + OTEL_METRICS_EXPORTER=otlp \ + OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \ - OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ SERVICE_NAME='sample-application-${var.test_id}' \ DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ - OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ - OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ AWS_REGION='${var.aws_region}' \ - OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ - OTEL_JAVAAGENT_ENABLED=true \ nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds From 6278cb5db34880e842a361b64ecc17c6d3b31db9 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Thu, 13 Nov 2025 16:01:11 -0800 Subject: [PATCH 13/28] testing env var --- terraform/java/ec2/default/main.tf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 993d43e84..df8f9ebfe 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -139,11 +139,15 @@ resource "null_resource" "main_service_setup" { JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ OTEL_METRICS_EXPORTER=otlp \ - OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ + OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \ + OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ + OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ + OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ SERVICE_NAME='sample-application-${var.test_id}' \ DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ + OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ AWS_REGION='${var.aws_region}' \ nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & From 7b6c3538545b3032adf43fe7bbe437b863714f18 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 09:47:46 -0800 Subject: [PATCH 14/28] swapping asg & ec2-default test validations --- terraform/java/ec2/asg/main.tf | 2 +- terraform/java/ec2/default/main.tf | 2 +- .../java/ec2/asg/aws-sdk-call-log.mustache | 10 ++++------ .../java/ec2/asg/aws-sdk-call-trace.mustache | 5 ++++- .../java/ec2/asg/client-call-log.mustache | 10 ++++------ .../java/ec2/asg/client-call-trace.mustache | 5 ++++- .../java/ec2/asg/outgoing-http-call-log.mustache | 10 ++++------ .../java/ec2/asg/outgoing-http-call-trace.mustache | 5 ++++- .../java/ec2/asg/remote-service-log.mustache | 10 ++++------ .../java/ec2/asg/remote-service-trace.mustache | 5 ++++- .../java/ec2/default/aws-sdk-call-log.mustache | 10 ++++++---- .../java/ec2/default/aws-sdk-call-trace.mustache | 5 +---- .../java/ec2/default/client-call-log.mustache | 10 ++++++---- .../java/ec2/default/client-call-trace.mustache | 5 +---- .../java/ec2/default/outgoing-http-call-log.mustache | 10 ++++++---- .../java/ec2/default/outgoing-http-call-trace.mustache | 5 +---- .../java/ec2/default/remote-service-log.mustache | 10 ++++++---- .../java/ec2/default/remote-service-trace.mustache | 5 +---- 18 files changed, 62 insertions(+), 62 deletions(-) diff --git a/terraform/java/ec2/asg/main.tf b/terraform/java/ec2/asg/main.tf index bd4df1d27..9b96d4dbd 100644 --- a/terraform/java/ec2/asg/main.tf +++ b/terraform/java/ec2/asg/main.tf @@ -134,7 +134,7 @@ resource "aws_launch_configuration" "launch_configuration" { OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ - OTEL_RESOURCE_ATTRIBUTES=service.name=sample-application-${var.test_id},aws.application_signals.metric_resource_keys=all_attributes \ + OTEL_RESOURCE_ATTRIBUTES="service.name=sample-application-${var.test_id},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ nohup java -jar -XX:+UseG1GC main-service.jar &> nohup.out & diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index df8f9ebfe..d76dc0b78 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -147,7 +147,7 @@ resource "null_resource" "main_service_setup" { OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ SERVICE_NAME='sample-application-${var.test_id}' \ DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ - OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ + OTEL_RESOURCE_ATTRIBUTES="service.name=${SERVICE_NAME},deployment.environment.name=${DEPLOYMENT_ENVIRONMENT_NAME},aws.application_signals.metric_resource_keys=all_attributes" \ AWS_REGION='${var.aws_region}' \ nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-log.mustache index e186cafc4..cb1a5456f 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-log.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-log.mustache @@ -7,9 +7,8 @@ "Version": "^1$", "Telemetry.Source": "^LocalRootSpan$", "Host": "^{{privateDnsName}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1" }, { "EC2.AutoScalingGroup": "^{{platformInfo}}$", @@ -24,7 +23,6 @@ "RemoteResourceType": "^AWS::S3::Bucket$", "Telemetry.Source": "^ClientSpan$", "Host": "^{{privateDnsName}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1" }] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-trace.mustache index f785c8c53..25c84781e 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/aws-sdk-call-trace.mustache @@ -21,7 +21,10 @@ "default": { "EC2.AutoScalingGroup": "^{{platformInfo}}$", "EC2.InstanceId": "^{{instanceId}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.Internal_Org": "Financial", + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1", + "otel.resource.aws.application_signals.metric_resource_keys": "Business Unit&Region&Organization", "otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$", "otel.resource.host.id": "^{{instanceId}}$", "otel.resource.host.image.id": "^{{instanceAmi}}$", diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-log.mustache index faf8d0aba..68b1e4592 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-log.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-log.mustache @@ -7,9 +7,8 @@ "Version": "^1$", "Telemetry.Source": "^LocalRootSpan$", "Host": "^{{privateDnsName}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1" }, { "EC2.AutoScalingGroup": "^{{platformInfo}}$", @@ -22,7 +21,6 @@ "RemoteOperation": "GET /", "Telemetry.Source": "^ClientSpan$", "Host": "^{{privateDnsName}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1" }] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-trace.mustache index 696fbc20d..5d13a3a40 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-trace.mustache @@ -7,7 +7,10 @@ }, "metadata": { "default": { - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.Internal_Org": "Financial", + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1", + "otel.resource.aws.application_signals.metric_resource_keys": "Business Unit&Region&Organization", "otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$", "otel.resource.host.id": "^{{instanceId}}$", "otel.resource.host.image.id": "^{{instanceAmi}}$", diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-log.mustache index 5ebafc0e7..434fb34ad 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-log.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-log.mustache @@ -7,9 +7,8 @@ "Version": "^1$", "Telemetry.Source": "^LocalRootSpan$", "Host": "^{{privateDnsName}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1" }, { "EC2.AutoScalingGroup": "^{{platformInfo}}$", @@ -22,7 +21,6 @@ "RemoteOperation": "GET /", "Telemetry.Source": "^ClientSpan$", "Host": "^{{privateDnsName}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1" }] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-trace.mustache index 041f6dddd..27f257a0d 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/outgoing-http-call-trace.mustache @@ -21,7 +21,10 @@ "default": { "EC2.AutoScalingGroup": "^{{platformInfo}}$", "EC2.InstanceId": "^{{instanceId}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.Internal_Org": "Financial", + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1", + "otel.resource.aws.application_signals.metric_resource_keys": "Business Unit&Region&Organization", "otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$", "otel.resource.host.id": "^{{instanceId}}$", "otel.resource.host.image.id": "^{{instanceAmi}}$", diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-log.mustache index 76a17990b..bb110cf4b 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-log.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-log.mustache @@ -7,9 +7,8 @@ "Version": "^1$", "Telemetry.Source": "^LocalRootSpan$", "Host": "^{{privateDnsName}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1" }, { "EC2.AutoScalingGroup": "^{{platformInfo}}$", @@ -22,7 +21,6 @@ "RemoteOperation": "GET /healthcheck", "Telemetry.Source": "^ClientSpan$", "Host": "^{{privateDnsName}}$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", - "otel.resource.host.image.id": "^{{instanceAmi}}$", - "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1" }] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-trace.mustache index cfa07a1c7..441db291d 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/asg/remote-service-trace.mustache @@ -22,7 +22,10 @@ "EC2.AutoScalingGroup": "^{{platformInfo}}$", "EC2.InstanceId": "^{{instanceId}}$", "PlatformType": "^AWS::EC2$", - "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.Internal_Org": "Financial", + "otel.resource.Business Unit": "Payments", + "otel.resource.Region": "us-east-1", + "otel.resource.aws.application_signals.metric_resource_keys": "Business Unit&Region&Organization", "otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$", "otel.resource.host.id": "^{{instanceId}}$", "otel.resource.host.image.id": "^{{instanceAmi}}$", diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-log.mustache index 946a63901..7c9abbbdb 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-log.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-log.mustache @@ -6,8 +6,9 @@ "Version": "^1$", "Telemetry.Source": "^LocalRootSpan$", "Host": "^ip(-[0-9]{1,3}){4}.*$", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1" + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" }, { "EC2.InstanceId": "^{{instanceId}}$", @@ -21,6 +22,7 @@ "RemoteResourceType": "^AWS::S3::Bucket$", "Telemetry.Source": "^ClientSpan$", "Host": "^ip(-[0-9]{1,3}){4}.*$", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1" + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" }] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-trace.mustache index dbcffd91b..4760d3f17 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-sdk-call-trace.mustache @@ -21,10 +21,7 @@ "default": { "EC2.InstanceId": "^{{instanceId}}$", "PlatformType": "^AWS::EC2$", - "otel.resource.Internal_Org": "Financial", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1", - "otel.resource.aws.application_signals.metric_resource_keys": "Business Unit&Region&Organization", + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", "otel.resource.host.image.id": "^{{instanceAmi}}$", "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "aws.span.kind": "^LOCAL_ROOT$" diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-log.mustache index 8abc8e038..c747e8baa 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-log.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-log.mustache @@ -6,8 +6,9 @@ "Version": "^1$", "Telemetry.Source": "^LocalRootSpan$", "Host": "^ip(-[0-9]{1,3}){4}.*$", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1" + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" }, { "EC2.InstanceId": "^{{instanceId}}$", @@ -19,6 +20,7 @@ "RemoteOperation": "GET /", "Telemetry.Source": "^ClientSpan$", "Host": "^ip(-[0-9]{1,3}){4}.*$", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1" + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" }] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-trace.mustache index c6fbfcd77..b5dfac7d5 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/client-call-trace.mustache @@ -7,10 +7,7 @@ }, "metadata": { "default": { - "otel.resource.Internal_Org": "Financial", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1", - "otel.resource.aws.application_signals.metric_resource_keys": "Business Unit&Region&Organization", + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", "otel.resource.host.image.id": "^{{instanceAmi}}$", "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" } diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-log.mustache index 3765c1785..6a8be41c7 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-log.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-log.mustache @@ -6,8 +6,9 @@ "Version": "^1$", "Telemetry.Source": "^LocalRootSpan$", "Host": "^ip(-[0-9]{1,3}){4}.*$", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1" + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" }, { "EC2.InstanceId": "^{{instanceId}}$", @@ -19,7 +20,8 @@ "RemoteOperation": "GET /", "Telemetry.Source": "^ClientSpan$", "Host": "^ip(-[0-9]{1,3}){4}.*$", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1" + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" }] diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-trace.mustache index 80e5c5411..4f9db8433 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/outgoing-http-call-trace.mustache @@ -21,10 +21,7 @@ "default": { "EC2.InstanceId": "^{{instanceId}}$", "PlatformType": "^AWS::EC2$", - "otel.resource.Internal_Org": "Financial", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1", - "otel.resource.aws.application_signals.metric_resource_keys": "Business Unit&Region&Organization", + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", "otel.resource.host.image.id": "^{{instanceAmi}}$", "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "aws.span.kind": "^LOCAL_ROOT$" diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-log.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-log.mustache index f042effc5..e92f22f4e 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-log.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-log.mustache @@ -6,8 +6,9 @@ "Version": "^1$", "Telemetry.Source": "^LocalRootSpan$", "Host": "^ip(-[0-9]{1,3}){4}.*$", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1" + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" }, { "EC2.InstanceId": "^{{instanceId}}$", @@ -19,6 +20,7 @@ "RemoteOperation": "GET /healthcheck", "Telemetry.Source": "^ClientSpan$", "Host": "^ip(-[0-9]{1,3}){4}.*$", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1" + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", + "otel.resource.host.image.id": "^{{instanceAmi}}$", + "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$" }] \ No newline at end of file diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-trace.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-trace.mustache index 51d7eec0c..2b93382ce 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-trace.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/remote-service-trace.mustache @@ -21,10 +21,7 @@ "default": { "EC2.InstanceId": "^{{instanceId}}$", "PlatformType": "^AWS::EC2$", - "otel.resource.Internal_Org": "Financial", - "otel.resource.Business Unit": "Payments", - "otel.resource.Region": "us-east-1", - "otel.resource.aws.application_signals.metric_resource_keys": "Business Unit&Region&Organization", + "otel.resource.aws.application_signals.metric_resource_keys": "all_attributes", "otel.resource.host.image.id": "^{{instanceAmi}}$", "otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$", "aws.span.kind": "^LOCAL_ROOT$" From 7b27bf9449f790e74a8d35bc18e97ffa8fc7a50a Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 09:54:18 -0800 Subject: [PATCH 15/28] updating shell expansion --- .../sampleapp/FrontendServiceController.java | 72 +------------------ terraform/java/ec2/default/main.tf | 2 +- 2 files changed, 4 insertions(+), 70 deletions(-) diff --git a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java index 191d2040e..9c79d9f8c 100644 --- a/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java +++ b/sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java @@ -109,78 +109,53 @@ public FrontendServiceController(CloseableHttpClient httpClient, S3Client s3) { this.httpClient = httpClient; this.s3 = s3; - logger.info("Initializing FrontendServiceController with custom metrics..."); - // Initialize agent-based metrics using GLOBAL OpenTelemetry (ADOT agent's configuration) - logger.info("Creating agent-based metrics using GlobalOpenTelemetry..."); this.agentMeter = GlobalOpenTelemetry.get().getMeter("agent-meter"); - logger.info("Agent meter created: {}", agentMeter.getClass().getName()); this.agentBasedCounter = agentMeter.counterBuilder("agent_based_counter").build(); this.agentBasedHistogram = agentMeter.histogramBuilder("agent_based_histogram").build(); this.agentBasedGauge = agentMeter.upDownCounterBuilder("agent_based_gauge").build(); - logger.info("Agent-based metrics initialized successfully: counter={}, histogram={}, gauge={}", - agentBasedCounter != null, agentBasedHistogram != null, agentBasedGauge != null); // Get environment variables String serviceName = System.getenv("SERVICE_NAME"); String deploymentEnvironmentName = System.getenv("DEPLOYMENT_ENVIRONMENT_NAME"); - logger.info("Environment variables - SERVICE_NAME: '{}', DEPLOYMENT_ENVIRONMENT_NAME: '{}'", - serviceName, deploymentEnvironmentName); // Only create pipeline if environment variables exist (matching Python logic) if (serviceName != null && deploymentEnvironmentName != null && !serviceName.isEmpty() && !deploymentEnvironmentName.isEmpty()) { - logger.info("Creating custom pipeline metrics with SERVICE_NAME='{}' and DEPLOYMENT_ENVIRONMENT_NAME='{}'", - serviceName, deploymentEnvironmentName); - Resource pipelineResource = Resource.getDefault().toBuilder() .put("service.name", serviceName) .put("deployment.environment.name", deploymentEnvironmentName) - .put("metric.source", "pipeline") .build(); - logger.info("Pipeline resource created with attributes: {}", pipelineResource.getAttributes()); MetricExporter pipelineMetricExporter = OtlpHttpMetricExporter.builder() .setEndpoint("http://localhost:4318/v1/metrics") .setTimeout(Duration.ofSeconds(10)) .build(); - logger.info("Pipeline OTLP exporter created targeting: http://localhost:4318/v1/metrics"); MetricReader pipelineMetricReader = PeriodicMetricReader.builder(pipelineMetricExporter) .setInterval(Duration.ofSeconds(1)) .build(); - logger.info("Pipeline metric reader created with 1-second export interval"); SdkMeterProvider pipelineMeterProvider = SdkMeterProvider.builder() .setResource(pipelineResource) .registerMetricReader(pipelineMetricReader) .build(); - logger.info("Pipeline meter provider created: {}", pipelineMeterProvider.getClass().getName()); // Initialize pipeline metrics using SEPARATE SdkMeterProvider this.customPipelineMeter = pipelineMeterProvider.get("pipeline-meter"); - logger.info("Pipeline meter created: {}", customPipelineMeter.getClass().getName()); this.customPipelineCounter = customPipelineMeter.counterBuilder("custom_pipeline_counter").build(); this.customPipelineHistogram = customPipelineMeter.histogramBuilder("custom_pipeline_histogram").build(); this.customPipelineGauge = customPipelineMeter.upDownCounterBuilder("custom_pipeline_gauge").build(); - - logger.info("Pipeline metrics initialized successfully: counter={}, histogram={}, gauge={}", - customPipelineCounter != null, customPipelineHistogram != null, customPipelineGauge != null); - logger.info("Custom pipeline metrics setup COMPLETE - will export to CloudWatch Agent on port 4318"); } else { // No pipeline metrics if environment variables missing - logger.warn("Pipeline metrics NOT created - missing environment variables (SERVICE_NAME or DEPLOYMENT_ENVIRONMENT_NAME)"); this.customPipelineMeter = null; this.customPipelineCounter = null; this.customPipelineHistogram = null; this.customPipelineGauge = null; } - - logger.info("FrontendServiceController initialization complete - Agent metrics: {}, Pipeline metrics: {}", - agentBasedCounter != null, customPipelineCounter != null); } private int random(int min, int max) { @@ -198,69 +173,28 @@ public String healthcheck() { @ResponseBody public String awssdkCall(@RequestParam(name = "testingId", required = false) String testingId) { - logger.info("=== RECORDING CUSTOM METRICS ==="); - // Record agent-based metrics - logger.info("Recording agent-based metrics using GlobalOpenTelemetry..."); - logger.info("GlobalOpenTelemetry instance: {}", GlobalOpenTelemetry.get().getClass().getName()); - logger.info("Agent meter instance: {}", agentMeter.getClass().getName()); - int histogramValue = random(100,1000); int gaugeValue = random(-10,10); - try { - agentBasedCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); - logger.info("Agent counter incremented by 1 with Operation=counter - SUCCESS"); - } catch (Exception e) { - logger.error("Failed to record agent counter: {}", e.getMessage()); - } + agentBasedCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "counter")); - try { - agentBasedHistogram.record((double)histogramValue, Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); - logger.info("Agent histogram recorded value {} with Operation=histogram - SUCCESS", histogramValue); - } catch (Exception e) { - logger.error("Failed to record agent histogram: {}", e.getMessage()); - } + agentBasedHistogram.record((double)histogramValue, Attributes.of(AttributeKey.stringKey("Operation"), "histogram")); - try { - agentBasedGauge.add(gaugeValue, Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); - logger.info("Agent gauge added {} with Operation=gauge - SUCCESS", gaugeValue); - } catch (Exception e) { - logger.error("Failed to record agent gauge: {}", e.getMessage()); - } - - logger.info("Agent-based metrics recording COMPLETE"); - - // Force flush to ensure metrics are sent - try { - logger.info("Attempting to force flush agent metrics..."); - // Note: GlobalOpenTelemetry doesn't expose flush directly, but metrics should auto-export - } catch (Exception e) { - logger.error("Failed to flush agent metrics: {}", e.getMessage()); - } + agentBasedGauge.add(gaugeValue, Attributes.of(AttributeKey.stringKey("Operation"), "gauge")); // Only record pipeline metrics if pipeline exists (matching Python logic) if (customPipelineCounter != null) { - logger.info("Recording pipeline metrics using custom SdkMeterProvider..."); int pipelineHistogramValue = random(100,1000); int pipelineGaugeValue = random(-10,10); customPipelineCounter.add(1, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_counter")); - logger.info("Pipeline counter incremented by 1 with Operation=pipeline_counter"); customPipelineHistogram.record(pipelineHistogramValue, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_histogram")); - logger.info("Pipeline histogram recorded value {} with Operation=pipeline_histogram", pipelineHistogramValue); customPipelineGauge.add(pipelineGaugeValue, Attributes.of(AttributeKey.stringKey("Operation"), "pipeline_gauge")); - logger.info("Pipeline gauge added {} with Operation=pipeline_gauge", pipelineGaugeValue); - - logger.info("Pipeline metrics recording COMPLETE - exported to localhost:4318"); - } else { - logger.warn("Pipeline metrics SKIPPED - customPipelineCounter is null"); } - logger.info("=== CUSTOM METRICS RECORDING FINISHED ==="); - String bucketName = "e2e-test-bucket-name"; if (testingId != null) { bucketName += "-" + testingId; diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index d76dc0b78..03b94f652 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -147,7 +147,7 @@ resource "null_resource" "main_service_setup" { OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ SERVICE_NAME='sample-application-${var.test_id}' \ DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ - OTEL_RESOURCE_ATTRIBUTES="service.name=${SERVICE_NAME},deployment.environment.name=${DEPLOYMENT_ENVIRONMENT_NAME},aws.application_signals.metric_resource_keys=all_attributes" \ + OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},aws.application_signals.metric_resource_keys=all_attributes" \ AWS_REGION='${var.aws_region}' \ nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & From e045d33daf7add7cb9b1fee79601deb17a759058 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 10:09:11 -0800 Subject: [PATCH 16/28] updating custom-metric validation template --- .../default/aws-otel-custom-metrics.mustache | 123 +++++++++++++++++- 1 file changed, 120 insertions(+), 3 deletions(-) diff --git a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache index 9ec466b63..7b2eb19ff 100644 --- a/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache +++ b/validator/src/main/resources/expected-data-template/java/ec2/default/aws-otel-custom-metrics.mustache @@ -48,7 +48,46 @@ name: host.id value: ANY_VALUE - - name: telemetry.auto.version + name: aws.application_signals.metric_resource_keys + value: all_attributes + - + name: host.arch + value: ANY_VALUE + - + name: host.image.id + value: ANY_VALUE + - + name: os.description + value: ANY_VALUE + - + name: os.type + value: linux + - + name: process.command_args + value: ANY_VALUE + - + name: process.executable.path + value: ANY_VALUE + - + name: process.pid + value: ANY_VALUE + - + name: process.runtime.description + value: ANY_VALUE + - + name: process.runtime.name + value: ANY_VALUE + - + name: process.runtime.version + value: ANY_VALUE + - + name: service.instance.id + value: ANY_VALUE + - + name: telemetry.distro.name + value: ANY_VALUE + - + name: telemetry.distro.version value: ANY_VALUE - name: cloud.platform @@ -100,7 +139,46 @@ name: host.id value: ANY_VALUE - - name: telemetry.auto.version + name: aws.application_signals.metric_resource_keys + value: all_attributes + - + name: host.arch + value: ANY_VALUE + - + name: host.image.id + value: ANY_VALUE + - + name: os.description + value: ANY_VALUE + - + name: os.type + value: linux + - + name: process.command_args + value: ANY_VALUE + - + name: process.executable.path + value: ANY_VALUE + - + name: process.pid + value: ANY_VALUE + - + name: process.runtime.description + value: ANY_VALUE + - + name: process.runtime.name + value: ANY_VALUE + - + name: process.runtime.version + value: ANY_VALUE + - + name: service.instance.id + value: ANY_VALUE + - + name: telemetry.distro.name + value: ANY_VALUE + - + name: telemetry.distro.version value: ANY_VALUE - name: cloud.platform @@ -152,7 +230,46 @@ name: host.id value: ANY_VALUE - - name: telemetry.auto.version + name: aws.application_signals.metric_resource_keys + value: all_attributes + - + name: host.arch + value: ANY_VALUE + - + name: host.image.id + value: ANY_VALUE + - + name: os.description + value: ANY_VALUE + - + name: os.type + value: linux + - + name: process.command_args + value: ANY_VALUE + - + name: process.executable.path + value: ANY_VALUE + - + name: process.pid + value: ANY_VALUE + - + name: process.runtime.description + value: ANY_VALUE + - + name: process.runtime.name + value: ANY_VALUE + - + name: process.runtime.version + value: ANY_VALUE + - + name: service.instance.id + value: ANY_VALUE + - + name: telemetry.distro.name + value: ANY_VALUE + - + name: telemetry.distro.version value: ANY_VALUE - name: cloud.platform From db755ab025e4203423af5bfe52da5486bbeb08a8 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 10:42:19 -0800 Subject: [PATCH 17/28] updating variable export --- terraform/java/ec2/default/main.tf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 03b94f652..545ca8103 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -137,6 +137,9 @@ resource "null_resource" "main_service_setup" { # Get and run the sample application with configuration aws s3 cp ${var.sample_app_jar} ./main-service-delete-me.jar + export SERVICE_NAME='sample-application-${var.test_id}' + export DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' + JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ OTEL_METRICS_EXPORTER=otlp \ OTEL_LOGS_EXPORT=none \ @@ -145,8 +148,6 @@ resource "null_resource" "main_service_setup" { OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ - SERVICE_NAME='sample-application-${var.test_id}' \ - DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},aws.application_signals.metric_resource_keys=all_attributes" \ AWS_REGION='${var.aws_region}' \ nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & From b95d990fe09560b5df04837f1fc78ee95c5e9ef5 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 10:52:42 -0800 Subject: [PATCH 18/28] updating env. variables --- terraform/java/ec2/default/main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 545ca8103..8e8894fdb 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -148,6 +148,8 @@ resource "null_resource" "main_service_setup" { OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ + SERVICE_NAME='sample-application-${var.test_id}' \ + DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},aws.application_signals.metric_resource_keys=all_attributes" \ AWS_REGION='${var.aws_region}' \ nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & From e7481ce2558a8b9fda1274d8c75b37d3a51754e4 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 11:28:49 -0800 Subject: [PATCH 19/28] adding ec2 instance connect for debug line --- terraform/java/ec2/default/main.tf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index 8e8894fdb..c7028f5c9 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -122,6 +122,9 @@ resource "null_resource" "main_service_setup" { sudo yum install java-${var.language_version}-amazon-corretto -y fi + # enable ec2 instance connect for debug + 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)}' echo $agent_config > amazon-cloudwatch-agent.json From cb5f459e2624e1ce176aa4e14e6c09cd71b60478 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 12:41:41 -0800 Subject: [PATCH 20/28] Java asg Test 1 --- .github/workflows/java-ec2-asg-test.yml | 2 +- .github/workflows/test.yml | 4 ++-- terraform/java/ec2/asg/main.tf | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/java-ec2-asg-test.yml b/.github/workflows/java-ec2-asg-test.yml index d7f21bc97..1fc1baa95 100644 --- a/.github/workflows/java-ec2-asg-test.yml +++ b/.github/workflows/java-ec2-asg-test.yml @@ -39,7 +39,7 @@ env: CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} JAVA_VERSION: ${{ inputs.java-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v${{ inputs.java-version }}.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/main-service-delete-me.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v${{ inputs.java-version }}.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 656aba12a..1009874c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,8 +15,8 @@ permissions: contents: read jobs: - java-ec2-default: - uses: ./.github/workflows/java-ec2-default-test.yml + java-ec2-asg-test: + uses: ./.github/workflows/java-ec2-asg-test.yml secrets: inherit with: caller-workflow-name: 'test' diff --git a/terraform/java/ec2/asg/main.tf b/terraform/java/ec2/asg/main.tf index 9b96d4dbd..af0ed6a8e 100644 --- a/terraform/java/ec2/asg/main.tf +++ b/terraform/java/ec2/asg/main.tf @@ -125,7 +125,7 @@ resource "aws_launch_configuration" "launch_configuration" { ${var.get_adot_jar_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_jar} ./main-service.jar + aws s3 cp ${var.sample_app_jar} ./main-service-delete-me.jar JAVA_TOOL_OPTIONS=' -javaagent:/adot.jar' \ OTEL_METRICS_EXPORTER=none \ @@ -136,7 +136,7 @@ resource "aws_launch_configuration" "launch_configuration" { OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ OTEL_RESOURCE_ATTRIBUTES="service.name=sample-application-${var.test_id},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ - nohup java -jar -XX:+UseG1GC main-service.jar &> nohup.out & + nohup java -jar -XX:+UseG1GC main-service-delete-me.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds sleep 30 From 8b5fa6b1044850334bd7c1d410cdfcd9476d6a3a Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 12:50:25 -0800 Subject: [PATCH 21/28] Java adot-sigv4 test 1 --- .github/workflows/java-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/test.yml | 4 ++-- terraform/java/ec2/adot-sigv4/main.tf | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/java-ec2-adot-sigv4-test.yml b/.github/workflows/java-ec2-adot-sigv4-test.yml index ab42a5a38..aa0703427 100644 --- a/.github/workflows/java-ec2-adot-sigv4-test.yml +++ b/.github/workflows/java-ec2-adot-sigv4-test.yml @@ -124,7 +124,7 @@ jobs: terraform apply -auto-approve \ -var="aws_region=${{ env.E2E_TEST_AWS_REGION }}" \ -var="test_id=${{ env.TESTING_ID }}" \ - -var="sample_app_jar=s3://aws-appsignals-sample-app-prod-us-east-1/java-main-service-v${{ env.JAVA_VERSION }}.jar" \ + -var="sample_app_jar=s3://aws-appsignals-sample-app-prod-us-east-1/main-service-delete-me.jar" \ -var="sample_remote_app_jar=s3://aws-appsignals-sample-app-prod-us-east-1/java-remote-service-v${{ env.JAVA_VERSION }}.jar" \ -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \ -var="language_version=${{ env.JAVA_VERSION }}" \ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1009874c1..e119558de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,8 +15,8 @@ permissions: contents: read jobs: - java-ec2-asg-test: - uses: ./.github/workflows/java-ec2-asg-test.yml + java-ec2-adot-sigv4-test: + uses: ./.github/workflows/java-ec2-adot-sigv4-test.yml secrets: inherit with: caller-workflow-name: 'test' diff --git a/terraform/java/ec2/adot-sigv4/main.tf b/terraform/java/ec2/adot-sigv4/main.tf index a5e5856c1..8e71adde1 100644 --- a/terraform/java/ec2/adot-sigv4/main.tf +++ b/terraform/java/ec2/adot-sigv4/main.tf @@ -128,7 +128,7 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_jar_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_jar} ./main-service.jar --region us-east-1 + aws s3 cp ${var.sample_app_jar} ./main-service-delete-me.jar --region us-east-1 # OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ export JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' @@ -141,7 +141,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://logs.${var.aws_region}.amazonaws.com/v1/logs export OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-aws-log-group=${var.application_logs_log_group},x-aws-log-stream=default export OTEL_RESOURCE_ATTRIBUTES=service.name=sample-application-${var.test_id} - nohup java -jar main-service.jar &> nohup.out & + nohup java -jar main-service-delete-me.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds sleep 30 From de5afec2c8b5169c8b6abebc0e5548012f708352 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 12:51:01 -0800 Subject: [PATCH 22/28] removing aws-region --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e119558de..44148e672 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,5 +19,4 @@ jobs: uses: ./.github/workflows/java-ec2-adot-sigv4-test.yml secrets: inherit with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' \ No newline at end of file + caller-workflow-name: 'test' \ No newline at end of file From fb3a4c91eb829b8f9792a671d142e667bca3e15b Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 13:21:17 -0800 Subject: [PATCH 23/28] Java ecs test 1 --- .github/workflows/java-ecs-test.yml | 2 +- .github/workflows/test.yml | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/java-ecs-test.yml b/.github/workflows/java-ecs-test.yml index fecaf2d3f..d97446cce 100644 --- a/.github/workflows/java-ecs-test.yml +++ b/.github/workflows/java-ecs-test.yml @@ -121,7 +121,7 @@ jobs: - name: Set Sample App Image run: | - echo MAIN_SAMPLE_APP_IMAGE_URI="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_MAIN_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}" >> $GITHUB_ENV + echo MAIN_SAMPLE_APP_IMAGE_URI="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/appsignals-java-springboot-main-service:delete-me" >> $GITHUB_ENV echo REMOTE_SAMPLE_APP_IMAGE_URI="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_REMOTE_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}" >> $GITHUB_ENV - name: Set ADOT Java image environment variable diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44148e672..4863c7ede 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,8 +15,9 @@ permissions: contents: read jobs: - java-ec2-adot-sigv4-test: - uses: ./.github/workflows/java-ec2-adot-sigv4-test.yml + java-ecs-test: + uses: ./.github/workflows/java-ecs-test.yml secrets: inherit with: - caller-workflow-name: 'test' \ No newline at end of file + caller-workflow-name: 'test' + aws-region: 'us-east-1' \ No newline at end of file From f4b3686f17cfa7258bb46f479247776b3757427e Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 13:28:57 -0800 Subject: [PATCH 24/28] Java eks test 1 --- .github/workflows/java-eks-test.yml | 2 +- .github/workflows/test.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/java-eks-test.yml b/.github/workflows/java-eks-test.yml index 25971a75c..b7ac21081 100644 --- a/.github/workflows/java-eks-test.yml +++ b/.github/workflows/java-eks-test.yml @@ -228,7 +228,7 @@ jobs: - name: Set Sample App Image run: | - echo MAIN_SAMPLE_APP_IMAGE_ARN="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_MAIN_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}" >> $GITHUB_ENV + echo MAIN_SAMPLE_APP_IMAGE_ARN="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/appsignals-java-springboot-main-service:delete-me" >> $GITHUB_ENV echo REMOTE_SAMPLE_APP_IMAGE_ARN="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_REMOTE_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}" >> $GITHUB_ENV - name: Deploy sample app via terraform and wait for the endpoint to come online diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4863c7ede..94d0e534e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,9 +15,9 @@ permissions: contents: read jobs: - java-ecs-test: - uses: ./.github/workflows/java-ecs-test.yml + java-eks-test: + uses: ./.github/workflows/java-eks-test.yml secrets: inherit with: caller-workflow-name: 'test' - aws-region: 'us-east-1' \ No newline at end of file + test-cluster-name: 'e2e-playground' \ No newline at end of file From ac66914029db5b1349ab891b3c83b4a6ea3740e4 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 13:29:52 -0800 Subject: [PATCH 25/28] adding aws-region --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94d0e534e..604ffdfcf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,4 +20,5 @@ jobs: secrets: inherit with: caller-workflow-name: 'test' + aws-region: 'us-east-1' test-cluster-name: 'e2e-playground' \ No newline at end of file From cafe7227e13c6ad6afca92d6a8a854034e8d859a Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 13:35:27 -0800 Subject: [PATCH 26/28] Java k8s test 1 --- .github/workflows/java-k8s-test.yml | 2 +- .github/workflows/test.yml | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/java-k8s-test.yml b/.github/workflows/java-k8s-test.yml index 51629be7a..b2369a373 100644 --- a/.github/workflows/java-k8s-test.yml +++ b/.github/workflows/java-k8s-test.yml @@ -120,7 +120,7 @@ jobs: working-directory: terraform/java/k8s/deploy/resources run: | sed -i 's#\${TESTING_ID}#${{ env.TESTING_ID }}#' frontend-service-depl.yaml - sed -i 's#\${IMAGE}#${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_MAIN_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}#' frontend-service-depl.yaml + sed -i 's#\${IMAGE}#${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/appsignals-java-springboot-main-service:delete-me#' frontend-service-depl.yaml sed -i 's#\${TESTING_ID}#${{ env.TESTING_ID }}#' remote-service-depl.yaml sed -i 's#\${IMAGE}#${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_REMOTE_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}#' remote-service-depl.yaml aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ env.E2E_TEST_AWS_REGION }} --key frontend-service-depl-${{ env.TESTING_ID }}.yaml --body frontend-service-depl.yaml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 604ffdfcf..d7918968b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,10 +15,8 @@ permissions: contents: read jobs: - java-eks-test: - uses: ./.github/workflows/java-eks-test.yml + java-k8s-test: + uses: ./.github/workflows/java-k8s-test.yml secrets: inherit with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' - test-cluster-name: 'e2e-playground' \ No newline at end of file + caller-workflow-name: 'test' \ No newline at end of file From 89833de8d9a13a36c8608a4e1b24e2ed8a79d508 Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 13:38:57 -0800 Subject: [PATCH 27/28] adding aws-region --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7918968b..07a4e6712 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,4 +19,5 @@ jobs: uses: ./.github/workflows/java-k8s-test.yml secrets: inherit with: - caller-workflow-name: 'test' \ No newline at end of file + caller-workflow-name: 'test' + aws-region: 'us-east-1' \ No newline at end of file From 1056791f973709add2b4e940171853e0376b18ba Mon Sep 17 00:00:00 2001 From: Vherremi Date: Mon, 17 Nov 2025 13:50:54 -0800 Subject: [PATCH 28/28] removing delete-me & test files --- .../workflows/java-ec2-adot-sigv4-test.yml | 2 +- .github/workflows/java-ec2-asg-test.yml | 2 +- .github/workflows/java-ec2-default-test.yml | 2 +- .github/workflows/java-ecs-test.yml | 2 +- .github/workflows/java-eks-test.yml | 2 +- .github/workflows/java-k8s-test.yml | 2 +- .github/workflows/test.yml | 23 ------------------- terraform/java/ec2/adot-sigv4/main.tf | 4 ++-- terraform/java/ec2/asg/main.tf | 4 ++-- terraform/java/ec2/default/main.tf | 8 +++---- 10 files changed, 14 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/java-ec2-adot-sigv4-test.yml b/.github/workflows/java-ec2-adot-sigv4-test.yml index aa0703427..ab42a5a38 100644 --- a/.github/workflows/java-ec2-adot-sigv4-test.yml +++ b/.github/workflows/java-ec2-adot-sigv4-test.yml @@ -124,7 +124,7 @@ jobs: terraform apply -auto-approve \ -var="aws_region=${{ env.E2E_TEST_AWS_REGION }}" \ -var="test_id=${{ env.TESTING_ID }}" \ - -var="sample_app_jar=s3://aws-appsignals-sample-app-prod-us-east-1/main-service-delete-me.jar" \ + -var="sample_app_jar=s3://aws-appsignals-sample-app-prod-us-east-1/java-main-service-v${{ env.JAVA_VERSION }}.jar" \ -var="sample_remote_app_jar=s3://aws-appsignals-sample-app-prod-us-east-1/java-remote-service-v${{ env.JAVA_VERSION }}.jar" \ -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \ -var="language_version=${{ env.JAVA_VERSION }}" \ diff --git a/.github/workflows/java-ec2-asg-test.yml b/.github/workflows/java-ec2-asg-test.yml index 1fc1baa95..d7f21bc97 100644 --- a/.github/workflows/java-ec2-asg-test.yml +++ b/.github/workflows/java-ec2-asg-test.yml @@ -39,7 +39,7 @@ env: CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} JAVA_VERSION: ${{ inputs.java-version }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/main-service-delete-me.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v${{ inputs.java-version }}.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v${{ inputs.java-version }}.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} diff --git a/.github/workflows/java-ec2-default-test.yml b/.github/workflows/java-ec2-default-test.yml index 707fce851..2162db05b 100644 --- a/.github/workflows/java-ec2-default-test.yml +++ b/.github/workflows/java-ec2-default-test.yml @@ -44,7 +44,7 @@ env: JAVA_VERSION: ${{ inputs.java-version }} OTEL_SOURCE: ${{ inputs.otel-source }} CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/main-service-delete-me.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v${{ inputs.java-version }}.jar SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v${{ inputs.java-version }}.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} diff --git a/.github/workflows/java-ecs-test.yml b/.github/workflows/java-ecs-test.yml index d97446cce..fecaf2d3f 100644 --- a/.github/workflows/java-ecs-test.yml +++ b/.github/workflows/java-ecs-test.yml @@ -121,7 +121,7 @@ jobs: - name: Set Sample App Image run: | - echo MAIN_SAMPLE_APP_IMAGE_URI="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/appsignals-java-springboot-main-service:delete-me" >> $GITHUB_ENV + echo MAIN_SAMPLE_APP_IMAGE_URI="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_MAIN_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}" >> $GITHUB_ENV echo REMOTE_SAMPLE_APP_IMAGE_URI="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_REMOTE_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}" >> $GITHUB_ENV - name: Set ADOT Java image environment variable diff --git a/.github/workflows/java-eks-test.yml b/.github/workflows/java-eks-test.yml index b7ac21081..25971a75c 100644 --- a/.github/workflows/java-eks-test.yml +++ b/.github/workflows/java-eks-test.yml @@ -228,7 +228,7 @@ jobs: - name: Set Sample App Image run: | - echo MAIN_SAMPLE_APP_IMAGE_ARN="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/appsignals-java-springboot-main-service:delete-me" >> $GITHUB_ENV + echo MAIN_SAMPLE_APP_IMAGE_ARN="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_MAIN_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}" >> $GITHUB_ENV echo REMOTE_SAMPLE_APP_IMAGE_ARN="${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_REMOTE_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}" >> $GITHUB_ENV - name: Deploy sample app via terraform and wait for the endpoint to come online diff --git a/.github/workflows/java-k8s-test.yml b/.github/workflows/java-k8s-test.yml index b2369a373..51629be7a 100644 --- a/.github/workflows/java-k8s-test.yml +++ b/.github/workflows/java-k8s-test.yml @@ -120,7 +120,7 @@ jobs: working-directory: terraform/java/k8s/deploy/resources run: | sed -i 's#\${TESTING_ID}#${{ env.TESTING_ID }}#' frontend-service-depl.yaml - sed -i 's#\${IMAGE}#${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/appsignals-java-springboot-main-service:delete-me#' frontend-service-depl.yaml + sed -i 's#\${IMAGE}#${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_MAIN_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}#' frontend-service-depl.yaml sed -i 's#\${TESTING_ID}#${{ env.TESTING_ID }}#' remote-service-depl.yaml sed -i 's#\${IMAGE}#${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/${{ env.JAVA_REMOTE_SAMPLE_APP_IMAGE }}:v${{ env.JAVA_VERSION }}#' remote-service-depl.yaml aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ env.E2E_TEST_AWS_REGION }} --key frontend-service-depl-${{ env.TESTING_ID }}.yaml --body frontend-service-depl.yaml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 07a4e6712..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,23 +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: - - Java_Custom_metrics - -permissions: - id-token: write - contents: read - -jobs: - java-k8s-test: - uses: ./.github/workflows/java-k8s-test.yml - secrets: inherit - with: - caller-workflow-name: 'test' - aws-region: 'us-east-1' \ No newline at end of file diff --git a/terraform/java/ec2/adot-sigv4/main.tf b/terraform/java/ec2/adot-sigv4/main.tf index 8e71adde1..a5e5856c1 100644 --- a/terraform/java/ec2/adot-sigv4/main.tf +++ b/terraform/java/ec2/adot-sigv4/main.tf @@ -128,7 +128,7 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_jar_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_jar} ./main-service-delete-me.jar --region us-east-1 + aws s3 cp ${var.sample_app_jar} ./main-service.jar --region us-east-1 # OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ export JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' @@ -141,7 +141,7 @@ resource "null_resource" "main_service_setup" { export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://logs.${var.aws_region}.amazonaws.com/v1/logs export OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-aws-log-group=${var.application_logs_log_group},x-aws-log-stream=default export OTEL_RESOURCE_ATTRIBUTES=service.name=sample-application-${var.test_id} - nohup java -jar main-service-delete-me.jar &> nohup.out & + nohup java -jar main-service.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds sleep 30 diff --git a/terraform/java/ec2/asg/main.tf b/terraform/java/ec2/asg/main.tf index af0ed6a8e..9b96d4dbd 100644 --- a/terraform/java/ec2/asg/main.tf +++ b/terraform/java/ec2/asg/main.tf @@ -125,7 +125,7 @@ resource "aws_launch_configuration" "launch_configuration" { ${var.get_adot_jar_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_jar} ./main-service-delete-me.jar + aws s3 cp ${var.sample_app_jar} ./main-service.jar JAVA_TOOL_OPTIONS=' -javaagent:/adot.jar' \ OTEL_METRICS_EXPORTER=none \ @@ -136,7 +136,7 @@ resource "aws_launch_configuration" "launch_configuration" { OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ OTEL_RESOURCE_ATTRIBUTES="service.name=sample-application-${var.test_id},Internal_Org=Financial,Business Unit=Payments,Region=us-east-1,aws.application_signals.metric_resource_keys=Business Unit&Region&Organization" \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ - nohup java -jar -XX:+UseG1GC main-service-delete-me.jar &> nohup.out & + nohup java -jar -XX:+UseG1GC main-service.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds sleep 30 diff --git a/terraform/java/ec2/default/main.tf b/terraform/java/ec2/default/main.tf index c7028f5c9..71fd5cdf1 100644 --- a/terraform/java/ec2/default/main.tf +++ b/terraform/java/ec2/default/main.tf @@ -138,7 +138,7 @@ resource "null_resource" "main_service_setup" { ${var.get_adot_jar_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_app_jar} ./main-service-delete-me.jar + aws s3 cp ${var.sample_app_jar} ./main-service.jar export SERVICE_NAME='sample-application-${var.test_id}' export DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' @@ -155,7 +155,7 @@ resource "null_resource" "main_service_setup" { DEPLOYMENT_ENVIRONMENT_NAME='ec2:default' \ OTEL_RESOURCE_ATTRIBUTES="service.name=$${SERVICE_NAME},deployment.environment.name=$${DEPLOYMENT_ENVIRONMENT_NAME},aws.application_signals.metric_resource_keys=all_attributes" \ AWS_REGION='${var.aws_region}' \ - nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service-delete-me.jar &> nohup.out & + nohup java -Dotel.java.global-autoconfigure.enabled=true -XX:+UseG1GC -jar main-service.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds sleep 30 @@ -242,7 +242,7 @@ resource "null_resource" "remote_service_setup" { ${var.get_adot_jar_command} # Get and run the sample application with configuration - aws s3 cp ${var.sample_remote_app_jar} ./remote-service-delete-me.jar + aws s3 cp ${var.sample_remote_app_jar} ./remote-service.jar JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar' \ OTEL_METRICS_EXPORTER=none \ @@ -253,7 +253,7 @@ resource "null_resource" "remote_service_setup" { OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \ OTEL_RESOURCE_ATTRIBUTES=service.name=sample-remote-application-${var.test_id} \ OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \ - nohup java -XX:+UseG1GC -jar remote-service-delete-me.jar &> nohup.out & + nohup java -XX:+UseG1GC -jar remote-service.jar &> nohup.out & # The application needs time to come up and reach a steady state, this should not take longer than 30 seconds sleep 30