Skip to content

Commit

Permalink
chore(lambda): update the fact tables and tests for lambda layers v0.…
Browse files Browse the repository at this point in the history
…102.1 (#30812)

Update ADOT Lambda Layer ARNs for recent release
aws-observability/aws-otel-lambda#957

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
alexperez52 authored Jul 18, 2024
1 parent 726a3be commit d918499
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 140 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-nodejs-arm64-ver-1-18-1:3"
":901920570463:layer:aws-otel-nodejs-arm64-ver-1-18-1:4"
]
]
}
Expand Down Expand Up @@ -176,7 +176,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-python-amd64-ver-1-24-0:1"
":901920570463:layer:aws-otel-python-amd64-ver-1-25-0:1"
]
]
}
Expand Down Expand Up @@ -273,7 +273,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2"
":901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:3"
]
]
}
Expand Down Expand Up @@ -370,7 +370,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-java-agent-amd64-ver-1-32-0:2"
":901920570463:layer:aws-otel-java-agent-amd64-ver-1-32-0:3"
]
]
}
Expand Down Expand Up @@ -467,7 +467,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-collector-amd64-ver-0-98-0:5"
":901920570463:layer:aws-otel-collector-amd64-ver-0-102-1:1"
]
]
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-nodejs-amd64-ver-1-18-1:3"
":901920570463:layer:aws-otel-nodejs-amd64-ver-1-18-1:4"
]
]
}
Expand Down Expand Up @@ -176,7 +176,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-python-amd64-ver-1-24-0:1"
":901920570463:layer:aws-otel-python-amd64-ver-1-25-0:1"
]
]
}
Expand Down Expand Up @@ -273,7 +273,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2"
":901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:3"
]
]
}
Expand Down Expand Up @@ -370,7 +370,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-java-agent-amd64-ver-1-32-0:2"
":901920570463:layer:aws-otel-java-agent-amd64-ver-1-32-0:3"
]
]
}
Expand Down Expand Up @@ -467,7 +467,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-collector-amd64-ver-0-98-0:5"
":901920570463:layer:aws-otel-collector-amd64-ver-0-102-1:1"
]
]
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions packages/aws-cdk-lib/aws-lambda/lib/adot-layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ export class AdotLambdaLayerJavaAutoInstrumentationVersion extends AdotLambdaLay
* The collection of versions of the ADOT Lambda Layer for Python SDK
*/
export class AdotLambdaLayerPythonSdkVersion extends AdotLambdaLayerVersion {
/**
* Version 1.25.0
*/
public static readonly V1_25_0 = new AdotLambdaLayerPythonSdkVersion('1.25.0');

/**
* Version 1.24.0
*/
Expand Down Expand Up @@ -348,7 +353,7 @@ export class AdotLambdaLayerPythonSdkVersion extends AdotLambdaLayerVersion {
* The latest layer version available in this CDK version. New versions could
* introduce incompatible changes. Make sure to test them before deploying to production.
*/
public static readonly LATEST = this.V1_24_0;
public static readonly LATEST = this.V1_25_0;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.PYTHON_SDK, layerVersion);
Expand Down Expand Up @@ -399,6 +404,11 @@ export class AdotLambdaLayerJavaScriptSdkVersion extends AdotLambdaLayerVersion
* The collection of versions of the ADOT Lambda Layer for generic purpose
*/
export class AdotLambdaLayerGenericVersion extends AdotLambdaLayerVersion {
/**
* Version 0.102.1
*/
public static readonly V0_102_1 = new AdotLambdaLayerGenericVersion('0.102.1');

/**
* Version 0.98.0
*/
Expand Down Expand Up @@ -433,7 +443,7 @@ export class AdotLambdaLayerGenericVersion extends AdotLambdaLayerVersion {
* The latest layer version available in this CDK version. New versions could
* introduce incompatible changes. Make sure to test them before deploying to production.
*/
public static readonly LATEST = this.V0_98_0;
public static readonly LATEST = this.V0_102_1;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.GENERIC, layerVersion);
Expand Down
12 changes: 6 additions & 6 deletions packages/aws-cdk-lib/aws-lambda/test/adot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ describe('ADOT Lambda Layer', () => {
const layerArn = lambda.AdotLambdaLayerJavaSdkVersion.V1_32_0.layerArn(fn.stack, fn.architecture);

expect(layerArn).toEqual(
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:3',
);
});

test('is added properly when using "LATEST" version', () => {
const layerArn = lambda.AdotLambdaLayerJavaSdkVersion.LATEST.layerArn(fn.stack, fn.architecture);

expect(layerArn).toEqual(
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:3',
);
});
});
Expand All @@ -53,18 +53,18 @@ describe('ADOT Lambda Layer', () => {
});

test('is added properly when the region information is available at synthesis time', () => {
const layerArn = lambda.AdotLambdaLayerPythonSdkVersion.V1_24_0.layerArn(fn.stack, fn.architecture);
const layerArn = lambda.AdotLambdaLayerPythonSdkVersion.V1_25_0.layerArn(fn.stack, fn.architecture);

expect(layerArn).toEqual(
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-24-0:1',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-25-0:1',
);
});

test('is added properly when using "LATEST" version', () => {
const layerArn = lambda.AdotLambdaLayerPythonSdkVersion.LATEST.layerArn(fn.stack, fn.architecture);

expect(layerArn).toEqual(
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-24-0:1',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-25-0:1',
);
});
});
Expand Down Expand Up @@ -114,7 +114,7 @@ describe('ADOT Lambda Layer', () => {
{
Ref: 'AWS::Region',
},
':901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-32-0:2',
':901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-32-0:3',
],
],
},
Expand Down
8 changes: 4 additions & 4 deletions packages/aws-cdk-lib/aws-lambda/test/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3565,7 +3565,7 @@ describe('function', () => {

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', {
Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2'],
Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:3'],
Environment: {
Variables: {
AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-handler',
Expand All @@ -3587,14 +3587,14 @@ describe('function', () => {
handler: 'index.handler',
runtime: lambda.Runtime.PYTHON_3_9,
adotInstrumentation: {
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_24_0),
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_25_0),
execWrapper: lambda.AdotLambdaExecWrapper.INSTRUMENT_HANDLER,
},
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', {
Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-24-0:1'],
Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-25-0:1'],
Environment: {
Variables: {
AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-instrument',
Expand All @@ -3611,7 +3611,7 @@ describe('function', () => {
handler: 'index.handler',
runtime: lambda.Runtime.PYTHON_3_10,
adotInstrumentation: {
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_24_0),
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_25_0),
execWrapper: lambda.AdotLambdaExecWrapper.REGULAR_HANDLER,
},
})).toThrow(/Python Adot Lambda layer requires AdotLambdaExecWrapper.INSTRUMENT_HANDLER/);
Expand Down
Loading

0 comments on commit d918499

Please sign in to comment.