Skip to content

Commit

Permalink
Update the fact tables and tests for lambda layers v0.115.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vasireddy99 committed Jan 7, 2025
1 parent 6218f3a commit c53f18f
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 17 deletions.
35 changes: 30 additions & 5 deletions packages/aws-cdk-lib/aws-lambda/lib/adot-layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ abstract class AdotLambdaLayerVersion {
* The collection of versions of the ADOT Lambda Layer for Java SDK
*/
export class AdotLambdaLayerJavaSdkVersion extends AdotLambdaLayerVersion {
/**
* Version 1.32.1
*/
public static readonly V1_32_1 = new AdotLambdaLayerJavaSdkVersion('1.32.1');

/**
* Version 1.32.0
*/
Expand Down Expand Up @@ -243,7 +248,7 @@ export class AdotLambdaLayerJavaSdkVersion 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_32_0;
public static readonly LATEST = this.V1_32_1;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.JAVA_SDK, layerVersion);
Expand All @@ -254,6 +259,11 @@ export class AdotLambdaLayerJavaSdkVersion extends AdotLambdaLayerVersion {
* The collection of versions of the ADOT Lambda Layer for Java auto-instrumentation
*/
export class AdotLambdaLayerJavaAutoInstrumentationVersion extends AdotLambdaLayerVersion {
/**
* Version 1.32.1
*/
public static readonly V1_32_1 = new AdotLambdaLayerJavaAutoInstrumentationVersion('1.32.1');

/**
* Version 1.32.0
*/
Expand Down Expand Up @@ -283,7 +293,7 @@ export class AdotLambdaLayerJavaAutoInstrumentationVersion extends AdotLambdaLay
* 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_32_0;
public static readonly LATEST = this.V1_32_1;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.JAVA_AUTO_INSTRUMENTATION, layerVersion);
Expand All @@ -294,6 +304,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.29.0
*/
public static readonly V1_29_0 = new AdotLambdaLayerPythonSdkVersion('1.29.0');

/**
* Version 1.25.0
*/
Expand Down Expand Up @@ -358,7 +373,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_25_0;
public static readonly LATEST = this.V1_29_0;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.PYTHON_SDK, layerVersion);
Expand All @@ -369,6 +384,11 @@ export class AdotLambdaLayerPythonSdkVersion extends AdotLambdaLayerVersion {
* The collection of versions of the ADOT Lambda Layer for JavaScript SDK
*/
export class AdotLambdaLayerJavaScriptSdkVersion extends AdotLambdaLayerVersion {
/**
* Version 1.30.0
*/
public static readonly V1_30_0 = new AdotLambdaLayerJavaScriptSdkVersion('1.30.0');

/**
* Version 1.18.1
*/
Expand Down Expand Up @@ -398,7 +418,7 @@ export class AdotLambdaLayerJavaScriptSdkVersion 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_18_1;
public static readonly LATEST = this.V1_30_0;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.JAVASCRIPT_SDK, layerVersion);
Expand All @@ -409,6 +429,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.115.0
*/
public static readonly V0_115_0 = new AdotLambdaLayerGenericVersion('0.115.0');

/**
* Version 0.102.1
*/
Expand Down Expand Up @@ -448,7 +473,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_102_1;
public static readonly LATEST = this.V0_115_0;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.GENERIC, layerVersion);
Expand Down
14 changes: 7 additions & 7 deletions packages/aws-cdk-lib/aws-lambda/test/adot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ describe('ADOT Lambda Layer', () => {
});

test('is added properly when the region information is available at synthesis time', () => {
const layerArn = lambda.AdotLambdaLayerJavaSdkVersion.V1_32_0.layerArn(fn.stack, fn.architecture);
const layerArn = lambda.AdotLambdaLayerJavaSdkVersion.V1_32_1.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:3',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:4',
);
});

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

expect(layerArn).toEqual(
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-25-0:1',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-29-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-25-0:1',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-29-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:3',
':901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-32-0:4',
],
],
},
Expand Down
10 changes: 5 additions & 5 deletions packages/aws-cdk-lib/aws-lambda/test/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3725,14 +3725,14 @@ describe('function', () => {
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_LATEST,
adotInstrumentation: {
layerVersion: lambda.AdotLayerVersion.fromJavaSdkLayerVersion(AdotLambdaLayerJavaSdkVersion.V1_32_0),
layerVersion: lambda.AdotLayerVersion.fromJavaSdkLayerVersion(AdotLambdaLayerJavaSdkVersion.V1_32_1),
execWrapper: lambda.AdotLambdaExecWrapper.REGULAR_HANDLER,
},
});

// 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:3'],
Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-32-0:4'],
Environment: {
Variables: {
AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-handler',
Expand All @@ -3754,14 +3754,14 @@ describe('function', () => {
handler: 'index.handler',
runtime: lambda.Runtime.PYTHON_3_9,
adotInstrumentation: {
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_25_0),
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_29_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-25-0:1'],
Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-29-0:1'],
Environment: {
Variables: {
AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-instrument',
Expand All @@ -3778,7 +3778,7 @@ describe('function', () => {
handler: 'index.handler',
runtime: lambda.Runtime.PYTHON_3_10,
adotInstrumentation: {
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_25_0),
layerVersion: lambda.AdotLayerVersion.fromPythonSdkLayerVersion(lambda.AdotLambdaLayerPythonSdkVersion.V1_29_0),
execWrapper: lambda.AdotLambdaExecWrapper.REGULAR_HANDLER,
},
})).toThrow(/Python Adot Lambda layer requires AdotLambdaExecWrapper.INSTRUMENT_HANDLER/);
Expand Down
Loading

0 comments on commit c53f18f

Please sign in to comment.