Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(aws-cdk-lib): Update adot lambda layers to the latest version #27508

Merged
merged 6 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class StackUnderTest extends Stack {
code: Code.fromInline(`exports.handler = ${handler.toString()}`),
architecture: props.architecture,
adotInstrumentation: {
layerVersion: AdotLayerVersion.fromJavaScriptSdkLayerVersion(AdotLambdaLayerJavaScriptSdkVersion.V1_15_0_1),
layerVersion: AdotLayerVersion.fromJavaScriptSdkLayerVersion(AdotLambdaLayerJavaScriptSdkVersion.V1_16_0),
execWrapper: AdotLambdaExecWrapper.REGULAR_HANDLER,
},
});
Expand All @@ -43,7 +43,7 @@ class StackUnderTest extends Stack {
handler: 'index.handler',
code: Code.fromInline('def handler(event, context): pass'),
adotInstrumentation: {
layerVersion: AdotLayerVersion.fromPythonSdkLayerVersion(AdotLambdaLayerPythonSdkVersion.V1_19_0_1),
layerVersion: AdotLayerVersion.fromPythonSdkLayerVersion(AdotLambdaLayerPythonSdkVersion.V1_20_0),
execWrapper: AdotLambdaExecWrapper.INSTRUMENT_HANDLER,
},
});
Expand All @@ -53,7 +53,7 @@ class StackUnderTest extends Stack {
handler: 'index.handler',
code: Code.fromInline('def handler(event, context): pass'),
adotInstrumentation: {
layerVersion: AdotLayerVersion.fromJavaSdkLayerVersion(AdotLambdaLayerJavaSdkVersion.V1_28_1),
layerVersion: AdotLayerVersion.fromJavaSdkLayerVersion(AdotLambdaLayerJavaSdkVersion.V1_30_0),
execWrapper: AdotLambdaExecWrapper.INSTRUMENT_HANDLER,
},
});
Expand All @@ -63,7 +63,7 @@ class StackUnderTest extends Stack {
handler: 'index.handler',
code: Code.fromInline('def handler(event, context): pass'),
adotInstrumentation: {
layerVersion: AdotLayerVersion.fromJavaAutoInstrumentationLayerVersion(AdotLambdaLayerJavaAutoInstrumentationVersion.V1_28_1),
layerVersion: AdotLayerVersion.fromJavaAutoInstrumentationLayerVersion(AdotLambdaLayerJavaAutoInstrumentationVersion.V1_30_0),
execWrapper: AdotLambdaExecWrapper.INSTRUMENT_HANDLER,
},
});
Expand All @@ -73,7 +73,7 @@ class StackUnderTest extends Stack {
handler: 'index.handler',
code: Code.fromInline('def handler(event, context): pass'),
adotInstrumentation: {
layerVersion: AdotLayerVersion.fromGenericLayerVersion(AdotLambdaLayerGenericVersion.V0_82_0),
layerVersion: AdotLayerVersion.fromGenericLayerVersion(AdotLambdaLayerGenericVersion.V0_84_0),
execWrapper: AdotLambdaExecWrapper.INSTRUMENT_HANDLER,
},
});
Expand Down
54 changes: 39 additions & 15 deletions packages/aws-cdk-lib/aws-lambda/lib/adot-layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,9 @@ abstract class AdotLambdaLayerVersion {
*/
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.
* Version 1.30.0
*/
public static readonly LATEST = new AdotLambdaLayerJavaSdkVersion('1.28.1');
public static readonly V1_30_0 = new AdotLambdaLayerJavaSdkVersion('1.30.0');

/**
* Version 1.28.1
Expand All @@ -225,6 +224,12 @@ export class AdotLambdaLayerJavaSdkVersion extends AdotLambdaLayerVersion {
*/
public static readonly V1_19_0 = new AdotLambdaLayerJavaSdkVersion('1.19.0');

/**
* 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_30_0;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.JAVA_SDK, layerVersion);
}
Expand All @@ -235,10 +240,9 @@ export class AdotLambdaLayerJavaSdkVersion extends AdotLambdaLayerVersion {
*/
export class AdotLambdaLayerJavaAutoInstrumentationVersion 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.
* Version 1.30.0
*/
public static readonly LATEST = new AdotLambdaLayerJavaAutoInstrumentationVersion('1.28.1');
public static readonly V1_30_0 = new AdotLambdaLayerJavaAutoInstrumentationVersion('1.30.0');

/**
* Version 1.28.1
Expand All @@ -250,6 +254,12 @@ export class AdotLambdaLayerJavaAutoInstrumentationVersion extends AdotLambdaLay
*/
public static readonly V1_19_2 = new AdotLambdaLayerJavaAutoInstrumentationVersion('1.19.2');

/**
* 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_30_0;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.JAVA_AUTO_INSTRUMENTATION, layerVersion);
}
Expand All @@ -260,10 +270,9 @@ export class AdotLambdaLayerJavaAutoInstrumentationVersion extends AdotLambdaLay
*/
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.
* Version 1.20.0
*/
public static readonly LATEST = new AdotLambdaLayerPythonSdkVersion('1.19.0-1');
public static readonly V1_20_0 = new AdotLambdaLayerPythonSdkVersion('1.20.0');

/**
* Version 1.19.0
Expand Down Expand Up @@ -300,6 +309,12 @@ export class AdotLambdaLayerPythonSdkVersion extends AdotLambdaLayerVersion {
*/
public static readonly V1_13_0 = new AdotLambdaLayerPythonSdkVersion('1.13.0');

/**
* 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_20_0;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.PYTHON_SDK, layerVersion);
}
Expand All @@ -310,10 +325,9 @@ export class AdotLambdaLayerPythonSdkVersion extends AdotLambdaLayerVersion {
*/
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.
* Version 1.16.0
*/
public static readonly LATEST = new AdotLambdaLayerJavaScriptSdkVersion('1.15.0-1');
public static readonly V1_16_0 = new AdotLambdaLayerJavaScriptSdkVersion('1.16.0');

/**
* Version 1.15.0
Expand All @@ -325,6 +339,12 @@ export class AdotLambdaLayerJavaScriptSdkVersion extends AdotLambdaLayerVersion
*/
public static readonly V1_7_0 = new AdotLambdaLayerJavaScriptSdkVersion('1.7.0');

/**
* 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_16_0;

private constructor(protected readonly layerVersion: string) {
super(AdotLambdaLayerType.JAVASCRIPT_SDK, layerVersion);
}
Expand All @@ -335,10 +355,9 @@ export class AdotLambdaLayerJavaScriptSdkVersion extends AdotLambdaLayerVersion
*/
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.
* Version 0.84.0
*/
public static readonly LATEST = new AdotLambdaLayerGenericVersion('0.82.0');
public static readonly V0_84_0 = new AdotLambdaLayerGenericVersion('0.84.0');

/**
* Version 0.82.0
Expand All @@ -350,6 +369,11 @@ export class AdotLambdaLayerGenericVersion extends AdotLambdaLayerVersion {
*/
public static readonly V0_62_1 = new AdotLambdaLayerGenericVersion('0.62.1');

/**
* 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_84_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_28_1.layerArn(fn.stack, fn.architecture);
const layerArn = lambda.AdotLambdaLayerJavaSdkVersion.V1_30_0.layerArn(fn.stack, fn.architecture);

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

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

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

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-19-0:2',
'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-20-0:2',
);
});
});
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('ADOT Lambda Layer', () => {
{
Ref: 'AWS::Region',
},
'JAVAxSDKx1x28x1xarm64',
'JAVAxSDKx1x30x0xarm64',
],
},
});
Expand Down
Loading