Skip to content

Commit

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

Update ADOT Lambda Layer ARNs for recent release

aws-observability/aws-otel-lambda#922

includes the PR changes - #30263

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
vasireddy99 authored Jun 5, 2024
1 parent a46bbc3 commit 0399ec3
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:1"
":901920570463:layer:aws-otel-nodejs-arm64-ver-1-18-1:3"
]
]
}
Expand Down Expand Up @@ -176,7 +176,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-python-amd64-ver-1-21-0:1"
":901920570463:layer:aws-otel-python-amd64-ver-1-24-0:1"
]
]
}
Expand Down Expand Up @@ -273,7 +273,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:1"
":901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2"
]
]
}
Expand Down Expand Up @@ -370,7 +370,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-java-agent-amd64-ver-1-32-0:1"
":901920570463:layer:aws-otel-java-agent-amd64-ver-1-32-0:2"
]
]
}
Expand Down Expand Up @@ -467,7 +467,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-collector-amd64-ver-0-90-1:1"
":901920570463:layer:aws-otel-collector-amd64-ver-0-98-0:5"
]
]
}
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:1"
":901920570463:layer:aws-otel-nodejs-amd64-ver-1-18-1:3"
]
]
}
Expand Down Expand Up @@ -176,7 +176,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-python-amd64-ver-1-21-0:1"
":901920570463:layer:aws-otel-python-amd64-ver-1-24-0:1"
]
]
}
Expand Down Expand Up @@ -273,7 +273,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:1"
":901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2"
]
]
}
Expand Down Expand Up @@ -370,7 +370,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-java-agent-amd64-ver-1-32-0:1"
":901920570463:layer:aws-otel-java-agent-amd64-ver-1-32-0:2"
]
]
}
Expand Down Expand Up @@ -467,7 +467,7 @@
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-collector-amd64-ver-0-90-1:1"
":901920570463:layer:aws-otel-collector-amd64-ver-0-98-0:5"
]
]
}
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.24.0
*/
public static readonly V1_24_0 = new AdotLambdaLayerPythonSdkVersion('1.24.0');

/**
* Version 1.21.0
*/
Expand Down Expand Up @@ -343,7 +348,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_21_0;
public static readonly LATEST = this.V1_24_0;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.PYTHON_SDK, layerVersion);
Expand Down Expand Up @@ -394,6 +399,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.98.0
*/
public static readonly V0_98_0 = new AdotLambdaLayerGenericVersion('0.98.0');

/**
* Version 0.90.1
*/
Expand Down Expand Up @@ -423,7 +433,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_90_1;
public static readonly LATEST = this.V0_98_0;

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:1',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2',
);
});

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:1',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2',
);
});
});
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_21_0.layerArn(fn.stack, fn.architecture);
const layerArn = lambda.AdotLambdaLayerPythonSdkVersion.V1_24_0.layerArn(fn.stack, fn.architecture);

expect(layerArn).toEqual(
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-21-0:1',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-24-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-21-0:1',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-24-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:1',
':901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-32-0:2',
],
],
},
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 @@ -3499,7 +3499,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:1'],
Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:2'],
Environment: {
Variables: {
AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-handler',
Expand All @@ -3521,14 +3521,14 @@ describe('function', () => {
handler: 'index.handler',
runtime: lambda.Runtime.PYTHON_3_9,
adotInstrumentation: {
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_21_0),
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_24_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-21-0:1'],
Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-24-0:1'],
Environment: {
Variables: {
AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-instrument',
Expand All @@ -3545,7 +3545,7 @@ describe('function', () => {
handler: 'index.handler',
runtime: lambda.Runtime.PYTHON_3_10,
adotInstrumentation: {
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_21_0),
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_24_0),
execWrapper: lambda.AdotLambdaExecWrapper.REGULAR_HANDLER,
},
})).toThrow(/Python Adot Lambda layer requires AdotLambdaExecWrapper.INSTRUMENT_HANDLER/);
Expand Down
Loading

0 comments on commit 0399ec3

Please sign in to comment.