Skip to content

Commit 10491f6

Browse files
committed
fix: PR comments
1 parent 26be628 commit 10491f6

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

nodejs/sample-apps/aws-sdk/deploy/wrapper/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
locals {
2-
collector_layer_arn = "arn:aws:lambda:${data.aws_region.current.name}:${var.account_id}:layer:opentelemetry-collector-arm64-0_15_0:1"
3-
sdk_layer_arn = "arn:aws:lambda:${data.aws_region.current.name}:${var.account_id}:layer:opentelemetry-nodejs-0_14_0:1"
2+
collector_layer_arn = "arn:aws:lambda:${data.aws_region.current.name}:${var.account_id}:layer:opentelemetry-collector-arm64-${var.collector_layer_version}:1"
3+
sdk_layer_arn = "arn:aws:lambda:${data.aws_region.current.name}:${var.account_id}:layer:opentelemetry-nodejs-${var.nodejs_layer_version}:1"
44
}
55

66
data "aws_region" "current" {}

nodejs/sample-apps/aws-sdk/deploy/wrapper/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,15 @@ variable "runtime" {
2727
description = "NodeJS runtime version used for sample Lambda Function"
2828
default = "nodejs22.x"
2929
}
30+
31+
variable "collector_layer_version" {
32+
type = string,
33+
description = "Collector layer version, see latest releases here: https://github.com/open-telemetry/opentelemetry-lambda/releases"
34+
default = "0_15_0"
35+
}
36+
37+
variable "nodejs_layer_version" {
38+
type = string,
39+
description = "Node.js layer version, see latest releases here: https://github.com/open-telemetry/opentelemetry-lambda/releases"
40+
default = "0_14_0"
41+
}

nodejs/sample-apps/aws-sdk/lib/otel-sample-lambda-stack.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import * as lambda from 'aws-cdk-lib/aws-lambda';
44
import * as path from 'path';
55

66
const AWS_ACCOUNT_ID = '184161586896'; // Replace with your AWS account ID if you want to use a specific layer
7+
const NODEJS_LAYER_VERSION = '0_14_0'; // Update with the latest version if needed
8+
const COLLECTOR_LAYER_VERSION = '0_15_0'; // Update with the latest version if needed
79

810
export class OtelSampleLambdaStack extends cdk.Stack {
911
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
1012
super(scope, id, props);
1113

1214
const region = cdk.Stack.of(this).region;
1315
const architecture = lambda.Architecture.ARM_64;
14-
const collectorLayerArn = `arn:aws:lambda:${region}:${AWS_ACCOUNT_ID}:layer:opentelemetry-collector-${architecture}-0_15_0:1`; // Update with the latest version if needed
15-
const nodejsInstrumentationLayerArn = `arn:aws:lambda:${region}:${AWS_ACCOUNT_ID}:layer:opentelemetry-nodejs-0_14_0:1`; // Update with the latest version if needed
16+
const collectorLayerArn = `arn:aws:lambda:${region}:${AWS_ACCOUNT_ID}:layer:opentelemetry-collector-${architecture}-${COLLECTOR_LAYER_VERSION}:1`;
17+
const nodejsInstrumentationLayerArn = `arn:aws:lambda:${region}:${AWS_ACCOUNT_ID}:layer:opentelemetry-nodejs-${NODEJS_LAYER_VERSION}:1`;
1618

1719
new lambda.Function(this, 'MyLambdaFunction', {
1820
runtime: lambda.Runtime.NODEJS_22_X,
@@ -29,7 +31,7 @@ export class OtelSampleLambdaStack extends cdk.Stack {
2931
OTEL_EXPORTER_OTLP_ENDPOINT: 'http://localhost:4318/',
3032
OTEL_TRACES_EXPORTER: 'console',
3133
OTEL_METRICS_EXPORTER: 'console',
32-
OTEL_LOG_LEVEL: 'INFO',
34+
OTEL_LOG_LEVEL: 'DEBUG',
3335
OTEL_TRACES_SAMPLER: 'always_on',
3436
AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-handler',
3537
},

0 commit comments

Comments
 (0)