Skip to content

[Java] SigV4 logs release testing #412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
25 changes: 22 additions & 3 deletions .github/workflows/java-ec2-adot-sigv4-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ env:
E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} # us-east-1 test account
E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }}
LOG_GROUP_NAME: aws/spans
TEST_LOG_GROUP_NAME: otlp_logs
TEST_RESOURCES_FOLDER: ${GITHUB_WORKSPACE}

jobs:
Expand Down Expand Up @@ -128,6 +129,7 @@ jobs:
-var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \
-var="language_version=${{ env.JAVA_VERSION }}" \
-var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \
-var="test_log_group=${{ env.TEST_LOG_GROUP_NAME }}" \
|| deployment_failed=$?

if [ $deployment_failed -eq 1 ]; then
Expand Down Expand Up @@ -178,7 +180,7 @@ jobs:
# Validation for pulse telemetry data
- name: Validate generated EMF logs
id: log-validation
run: ./gradlew validator:run --args='-c java/ec2/adot-sigv4/log-validation.yml
run: ./gradlew validator:run --args='-c java/ec2/adot-aws-otlp/log-validation.yml
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
Expand All @@ -196,7 +198,7 @@ jobs:
- name: Validate generated metrics
id: metric-validation
if: (success() || steps.log-validation.outcome == 'failure') && !cancelled()
run: ./gradlew validator:run --args='-c java/ec2/adot-sigv4/metric-validation.yml
run: ./gradlew validator:run --args='-c java/ec2/adot-aws-otlp/metric-validation.yml
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
--remote-service-deployment-name sample-remote-application-${{ env.TESTING_ID }}
Expand All @@ -214,7 +216,7 @@ jobs:
- name: Validate generated traces
id: trace-validation
if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled()
run: ./gradlew validator:run --args='-c java/ec2/adot-sigv4/trace-validation.yml
run: ./gradlew validator:run --args='-c java/ec2/adot-aws-otlp/trace-validation.yml
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
Expand All @@ -228,6 +230,23 @@ jobs:
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
--instance-id ${{ env.MAIN_SERVICE_INSTANCE_ID }}
--rollup'

- name: Validate generated otlp logs
id: application-log-validation
run: ./gradlew validator:run --args='-c java/ec2/adot-aws-otlp/logs/application-log-validation.yml
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
--region ${{ env.E2E_TEST_AWS_REGION }}
--account-id ${{ env.E2E_TEST_ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.TEST_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: Refresh AWS Credentials
if: ${{ github.event.repository.name == 'aws-application-signals-test-framework' }}
Expand Down
14 changes: 8 additions & 6 deletions terraform/java/ec2/adot-sigv4/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ resource "null_resource" "main_service_setup" {

# OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \
export JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar'
export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=false
export OTEL_RESOURCE_PROVIDERS_AWS_ENABLED=true
export OTEL_LOGS_EXPORT=none
export OTEL_LOGS_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=none
export OTEL_TRACES_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.${var.aws_region}.amazonaws.com/v1/traces
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.test_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 &

Expand Down Expand Up @@ -222,13 +223,14 @@ resource "null_resource" "remote_service_setup" {

# OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true \
export JAVA_TOOL_OPTIONS=' -javaagent:/home/ec2-user/adot.jar'
export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=false
export OTEL_RESOURCE_PROVIDERS_AWS_ENABLED=true
export OTEL_LOGS_EXPORT=none
export OTEL_LOGS_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=none
export OTEL_TRACES_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.${var.aws_region}.amazonaws.com/v1/traces
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.test_log_group},x-aws-log-stream=default
OTEL_RESOURCE_ATTRIBUTES=service.name=sample-remote-application-${var.test_id} \
nohup java -jar remote-service.jar &> nohup.out &

Expand Down
4 changes: 4 additions & 0 deletions terraform/java/ec2/adot-sigv4/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ variable "language_version" {

variable "cpu_architecture" {
default = "x86_64"
}

variable "test_log_group" {
default = "otlp_logs"
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,26 @@ public enum PredefinedExpectedTemplate implements FileConfig {
JAVA_EC2_UBUNTU_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/ubuntu/client-call-trace.mustache"),

/** Java EC2 ADOT SigV4 (ADOT Stand-Alone) Test Case Validations */
JAVA_EC2_ADOT_SIGV4_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/ec2/adot-sigv4/outgoing-http-call-log.mustache"),
JAVA_EC2_ADOT_SIGV4_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/ec2/adot-aws-otlp/outgoing-http-call-log.mustache"),
JAVA_EC2_ADOT_SIGV4_OUTGOING_HTTP_CALL_METRIC(
"/expected-data-template/java/ec2/adot-sigv4/outgoing-http-call-metric.mustache"),
"/expected-data-template/java/ec2/adot-aws-otlp/outgoing-http-call-metric.mustache"),
JAVA_EC2_ADOT_SIGV4_OUTGOING_HTTP_CALL_TRACE(
"/expected-data-template/java/ec2/adot-sigv4/outgoing-http-call-trace.mustache"),
"/expected-data-template/java/ec2/adot-aws-otlp/outgoing-http-call-trace.mustache"),

JAVA_EC2_ADOT_SIGV4_AWS_SDK_CALL_LOG("/expected-data-template/java/ec2/adot-sigv4/aws-sdk-call-log.mustache"),
JAVA_EC2_ADOT_SIGV4_AWS_SDK_CALL_METRIC("/expected-data-template/java/ec2/adot-sigv4/aws-sdk-call-metric.mustache"),
JAVA_EC2_ADOT_SIGV4_AWS_SDK_CALL_TRACE("/expected-data-template/java/ec2/adot-sigv4/aws-sdk-call-trace.mustache"),
JAVA_EC2_ADOT_SIGV4_AWS_SDK_CALL_LOG("/expected-data-template/java/ec2/adot-aws-otlp/aws-sdk-call-log.mustache"),
JAVA_EC2_ADOT_SIGV4_AWS_SDK_CALL_METRIC("/expected-data-template/java/ec2/adot-aws-otlp/aws-sdk-call-metric.mustache"),
JAVA_EC2_ADOT_SIGV4_AWS_SDK_CALL_TRACE("/expected-data-template/java/ec2/adot-aws-otlp/aws-sdk-call-trace.mustache"),

JAVA_EC2_ADOT_SIGV4_REMOTE_SERVICE_LOG("/expected-data-template/java/ec2/adot-sigv4/remote-service-log.mustache"),
JAVA_EC2_ADOT_SIGV4_REMOTE_SERVICE_METRIC("/expected-data-template/java/ec2/adot-sigv4/remote-service-metric.mustache"),
JAVA_EC2_ADOT_SIGV4_REMOTE_SERVICE_TRACE("/expected-data-template/java/ec2/adot-sigv4/remote-service-trace.mustache"),
JAVA_EC2_ADOT_SIGV4_REMOTE_SERVICE_LOG("/expected-data-template/java/ec2/adot-aws-otlp/remote-service-log.mustache"),
JAVA_EC2_ADOT_SIGV4_REMOTE_SERVICE_METRIC("/expected-data-template/java/ec2/adot-aws-otlp/remote-service-metric.mustache"),
JAVA_EC2_ADOT_SIGV4_REMOTE_SERVICE_TRACE("/expected-data-template/java/ec2/adot-aws-otlp/remote-service-trace.mustache"),

JAVA_EC2_ADOT_SIGV4_CLIENT_CALL_LOG("/expected-data-template/java/ec2/adot-sigv4/client-call-log.mustache"),
JAVA_EC2_ADOT_SIGV4_CLIENT_CALL_METRIC("/expected-data-template/java/ec2/adot-sigv4/client-call-metric.mustache"),
JAVA_EC2_ADOT_SIGV4_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/adot-sigv4/client-call-trace.mustache"),
JAVA_EC2_ADOT_SIGV4_CLIENT_CALL_LOG("/expected-data-template/java/ec2/adot-aws-otlp/client-call-log.mustache"),
JAVA_EC2_ADOT_SIGV4_CLIENT_CALL_METRIC("/expected-data-template/java/ec2/adot-aws-otlp/client-call-metric.mustache"),
JAVA_EC2_ADOT_SIGV4_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/adot-aws-otlp/client-call-trace.mustache"),

/** Java EC2 ADOT SigV4 Log Exporter Test Case Validation */
JAVA_EC2_ADOT_OTLP_LOG("/expected-data-template/java/ec2/adot-aws-otlp/logs/application-log.mustache"),

/** Java EC2 K8s Test Case Validations */
JAVA_K8S_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/k8s/outgoing-http-call-log.mustache"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private Map<String, Object> getActualOtelSpanLog(String operation, String remote

private Map<String, Object> getActualAwsOtlpLog() throws Exception {
String filterPattern= String.format(
"{ ($.attributes.otelServiceName = \"%s\") && ($.body = \"This is a custom log for validation testing\") }",
"{ ($.resource.attributes.['service.name'] = \"%s\") && ($.body = \"This is a custom log for validation testing\") }",
context.getServiceName()
);
log.info("Filter Pattern for OTLP Log Search: " + filterPattern);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[{
"resource": {
"attributes": {
"service.name": "{{serviceName}}",
"cloud.provider": "aws",
"cloud.region": "{{region}}",
"cloud.account.id": "{{accountId}}",
"cloud.platform": "aws_ec2"
}
},
"severityNumber": "^[0-9]+$",
"severityText": "{{severityText}}",
"body": "This is a custom log for validation testing",
"traceId": "{{traceId}}",
"spanId": "{{spanId}}"
}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-
validationType: "cw-log"
expectedLogStructureTemplate: "JAVA_EC2_ADOT_OTLP_LOG"
Loading