From fec6c440edb91f32ece6720d992fd6b25a8ad9b8 Mon Sep 17 00:00:00 2001 From: branberry Date: Mon, 30 Oct 2023 16:58:25 -0500 Subject: [PATCH] Manually add OTel layer --- .../lib/constructs/api/webhook-api-construct.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cdk-infra/lib/constructs/api/webhook-api-construct.ts b/cdk-infra/lib/constructs/api/webhook-api-construct.ts index 5f6ff0351..01707475e 100644 --- a/cdk-infra/lib/constructs/api/webhook-api-construct.ts +++ b/cdk-infra/lib/constructs/api/webhook-api-construct.ts @@ -6,6 +6,7 @@ import { AdotLayerVersion, Code, Function, + LayerVersion, Runtime, Tracing, } from 'aws-cdk-lib/aws-lambda'; @@ -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', {