Skip to content

Commit

Permalink
Manually add OTel layer
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Oct 30, 2023
1 parent 4a70bfd commit fec6c44
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cdk-infra/lib/constructs/api/webhook-api-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
AdotLayerVersion,
Code,
Function,
LayerVersion,
Runtime,
Tracing,
} from 'aws-cdk-lib/aws-lambda';
Expand Down Expand Up @@ -73,21 +74,24 @@ export class WebhookApiConstruct extends Construct {
timeout,
});

const otelLayer = LayerVersion.fromLayerVersionArn(
this,
'otelLambdaLayer',
'arn:aws:lambda:us-east-2:184161586896:layer:opentelemetry-nodejs-0_2_0:1'
);

const githubTriggerLambda = new NodejsFunction(this, 'githubTriggerLambda', {
entry: `${HANDLERS_PATH}/github.ts`,
runtime,
handler: 'TriggerBuild',
bundling,
environment,
environment: { ...environment, AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-handler' },
timeout,
tracing: Tracing.ACTIVE,
currentVersionOptions: {
provisionedConcurrentExecutions: 5,
},
adotInstrumentation: {
execWrapper: AdotLambdaExecWrapper.REGULAR_HANDLER,
layerVersion: AdotLayerVersion.fromJavaScriptSdkLayerVersion(AdotLambdaLayerJavaScriptSdkVersion.LATEST),
},
layers: [otelLayer],
});

const githubDeleteArtifactsLambda = new NodejsFunction(this, 'githubDeleteArtifactsLambda', {
Expand Down

0 comments on commit fec6c44

Please sign in to comment.