diff --git a/java/sample-apps/aws-sdk/README.md b/java/sample-apps/aws-sdk/README.md index d229a1559c..3d33a36d0c 100644 --- a/java/sample-apps/aws-sdk/README.md +++ b/java/sample-apps/aws-sdk/README.md @@ -24,6 +24,14 @@ terraform init terraform apply ``` +Use the following command to configure runtime and architecture + +``` +TF_VAR_architecture=x86_64 \ +TF_VAR_runtime=java11 \ +terraform apply -auto-approve +``` + For the agent version, to change the configuration of the OpenTelemetry collector, you can provide the ARN of a Lambda layer with a custom collector configuration in a file named `config.yaml` when prompted after running the `terraform apply` command. After deployment, a URL which can be used to invoke the function via API Gateway will be displayed. The agent version diff --git a/java/sample-apps/aws-sdk/deploy/agent/main.tf b/java/sample-apps/aws-sdk/deploy/agent/main.tf index 129c398055..e2b871029f 100644 --- a/java/sample-apps/aws-sdk/deploy/agent/main.tf +++ b/java/sample-apps/aws-sdk/deploy/agent/main.tf @@ -5,7 +5,7 @@ module "hello-lambda-function" { architectures = compact([var.architecture]) function_name = var.name handler = "io.opentelemetry.lambda.sampleapps.awssdk.AwsSdkRequestHandler::handleRequest" - runtime = "java11" + runtime = var.runtime create_package = false local_existing_package = "${path.module}/../../build/libs/aws-sdk-all.jar" diff --git a/java/sample-apps/aws-sdk/deploy/agent/variables.tf b/java/sample-apps/aws-sdk/deploy/agent/variables.tf index e4642534ca..e2a6073a15 100644 --- a/java/sample-apps/aws-sdk/deploy/agent/variables.tf +++ b/java/sample-apps/aws-sdk/deploy/agent/variables.tf @@ -32,3 +32,9 @@ variable "architecture" { description = "Lambda function architecture, valid values are arm64 or x86_64" default = "x86_64" } + +variable "runtime" { + type = string + description = "java agent runtime used for sample Lambda Function" + default = "java11" +} diff --git a/java/sample-apps/aws-sdk/deploy/wrapper/main.tf b/java/sample-apps/aws-sdk/deploy/wrapper/main.tf index f26143e252..28b2b8800b 100644 --- a/java/sample-apps/aws-sdk/deploy/wrapper/main.tf +++ b/java/sample-apps/aws-sdk/deploy/wrapper/main.tf @@ -5,7 +5,7 @@ module "hello-lambda-function" { architectures = compact([var.architecture]) function_name = var.name handler = "io.opentelemetry.lambda.sampleapps.awssdk.AwsSdkRequestHandler::handleRequest" - runtime = "java11" + runtime = var.runtime create_package = false local_existing_package = "${path.module}/../../build/libs/aws-sdk-all.jar" diff --git a/java/sample-apps/aws-sdk/deploy/wrapper/variables.tf b/java/sample-apps/aws-sdk/deploy/wrapper/variables.tf index d6621a1a31..3505ae54ba 100644 --- a/java/sample-apps/aws-sdk/deploy/wrapper/variables.tf +++ b/java/sample-apps/aws-sdk/deploy/wrapper/variables.tf @@ -27,3 +27,9 @@ variable "architecture" { description = "Lambda function architecture, valid values are arm64 or x86_64" default = "x86_64" } + +variable "runtime" { + type = string + description = "java wrapper runtime used for sample Lambda Function" + default = "java11" +} diff --git a/java/sample-apps/okhttp/README.md b/java/sample-apps/okhttp/README.md index 395cf88e74..592e152dca 100644 --- a/java/sample-apps/okhttp/README.md +++ b/java/sample-apps/okhttp/README.md @@ -36,6 +36,14 @@ terraform init terraform apply ``` +Use the following command to configure runtime and architecture + +``` +TF_VAR_architecture=x86_64 \ +TF_VAR_runtime=java11 \ +terraform apply -auto-approve +``` + After deployment, a URL which can be used to invoke the function via API Gateway will be displayed. As it uses the wrapper, it tends to take 5-10s. Confirm that spans are logged in the CloudWatch logs for the function on the AWS Console for the [wrapper](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logsV2:log-groups/log-group/$252Faws$252Flambda$252Fhello-awssdk-java-wrapper).n diff --git a/java/sample-apps/okhttp/deploy/wrapper/main.tf b/java/sample-apps/okhttp/deploy/wrapper/main.tf index bd0fb27406..f1d6918b1a 100644 --- a/java/sample-apps/okhttp/deploy/wrapper/main.tf +++ b/java/sample-apps/okhttp/deploy/wrapper/main.tf @@ -5,7 +5,7 @@ module "hello-lambda-function" { architectures = compact([var.architecture]) function_name = var.name handler = "io.opentelemetry.lambda.sampleapps.okhttp.OkHttpRequestHandler::handleRequest" - runtime = "java11" + runtime = var.runtime create_package = false local_existing_package = "${path.module}/../../build/libs/okhttp-all.jar" diff --git a/java/sample-apps/okhttp/deploy/wrapper/variables.tf b/java/sample-apps/okhttp/deploy/wrapper/variables.tf index 96716df980..a6ca0a92f9 100644 --- a/java/sample-apps/okhttp/deploy/wrapper/variables.tf +++ b/java/sample-apps/okhttp/deploy/wrapper/variables.tf @@ -27,3 +27,9 @@ variable "architecture" { description = "Lambda function architecture, valid values are arm64 or x86_64" default = "x86_64" } + +variable "runtime" { + type = string + description = "java runtime used for sample Lambda Function" + default = "java11" +} diff --git a/java/sample-apps/sqs/README.md b/java/sample-apps/sqs/README.md index 471a8767bc..afeb5c24c2 100644 --- a/java/sample-apps/sqs/README.md +++ b/java/sample-apps/sqs/README.md @@ -23,6 +23,14 @@ terraform init terraform apply ``` +Use the following command to configure runtime and architecture + +``` +TF_VAR_architecture=x86_64 \ +TF_VAR_runtime=java11 \ +terraform apply -auto-approve +``` + For the agent version, to change the configuration of the OpenTelemetry collector, you can provide the ARN of a Lambda layer with a custom collector configuration in a file named `config.yaml` when prompted after running the `terraform apply` command. After deployment, login to AWS and test the Lambda function using the predefined SQS test payload. The agent version tends to take 10-20s for the first request, while the wrapper version tends to take 5-10s. Confirm diff --git a/java/sample-apps/sqs/deploy/agent/main.tf b/java/sample-apps/sqs/deploy/agent/main.tf index 436f486eb3..5bdee7ab3a 100644 --- a/java/sample-apps/sqs/deploy/agent/main.tf +++ b/java/sample-apps/sqs/deploy/agent/main.tf @@ -5,7 +5,7 @@ module "hello-lambda-function" { architectures = compact([var.architecture]) function_name = var.name handler = "io.opentelemetry.lambda.sampleapps.sqs.SqsRequestHandler::handleRequest" - runtime = "java11" + runtime = var.runtime create_package = false local_existing_package = "${path.module}/../../build/libs/sqs-all.jar" diff --git a/java/sample-apps/sqs/deploy/agent/variables.tf b/java/sample-apps/sqs/deploy/agent/variables.tf index 884bc9ff5c..cccd38b18e 100644 --- a/java/sample-apps/sqs/deploy/agent/variables.tf +++ b/java/sample-apps/sqs/deploy/agent/variables.tf @@ -38,3 +38,9 @@ variable "architecture" { # type = string # description = "ARN for the SQS queue to use an event source for the Lambda" # } + +variable "runtime" { + type = string + description = "java runtime used for sample Lambda Function" + default = "java11" +} diff --git a/java/sample-apps/sqs/deploy/wrapper/main.tf b/java/sample-apps/sqs/deploy/wrapper/main.tf index 8507a97e61..354fa72452 100644 --- a/java/sample-apps/sqs/deploy/wrapper/main.tf +++ b/java/sample-apps/sqs/deploy/wrapper/main.tf @@ -5,7 +5,7 @@ module "hello-lambda-function" { architectures = compact([var.architecture]) function_name = var.name handler = "io.opentelemetry.lambda.sampleapps.sqs.SqsRequestHandler::handleRequest" - runtime = "java11" + runtime = var.runtime create_package = false local_existing_package = "${path.module}/../../build/libs/sqs-all.jar" diff --git a/java/sample-apps/sqs/deploy/wrapper/variables.tf b/java/sample-apps/sqs/deploy/wrapper/variables.tf index 1c96d6b1ec..7b59367d53 100644 --- a/java/sample-apps/sqs/deploy/wrapper/variables.tf +++ b/java/sample-apps/sqs/deploy/wrapper/variables.tf @@ -33,3 +33,9 @@ variable "architecture" { # type = string # description = "ARN for the SQS queue to use an event source for the Lambda" # } + +variable "runtime" { + type = string + description = "java runtime used for sample Lambda Function" + default = "java11" +}