Skip to content
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
81 changes: 18 additions & 63 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import { DatadogAppSecMode } from "./interfaces";
import { layerRuntimeCatalog } from "./layer-runtime-catalog";

export const LAYER_PREFIX = "DatadogLayer";
export const EXTENSION_LAYER_PREFIX = "DatadogExtension";
Expand All @@ -30,6 +31,15 @@ export enum RuntimeType {
UNSUPPORTED,
}

const runtimeTypeLookup: { [key: string]: RuntimeType } = {
DOTNET: RuntimeType.DOTNET,
NODE: RuntimeType.NODE,
PYTHON: RuntimeType.PYTHON,
JAVA: RuntimeType.JAVA,
RUBY: RuntimeType.RUBY,
CUSTOM: RuntimeType.CUSTOM,
};

export const DatadogLambdaDefaultProps = {
addLayers: true,
enableDatadogTracing: true,
Expand Down Expand Up @@ -58,70 +68,15 @@ export enum TagKeys {
DD_TRACE_ENABLED = "DD_TRACE_ENABLED",
}

export const runtimeLookup: { [key: string]: RuntimeType } = {
"dotnet6": RuntimeType.DOTNET,
"dotnet8": RuntimeType.DOTNET,
"dotnet10": RuntimeType.DOTNET,
"nodejs12.x": RuntimeType.NODE,
"nodejs14.x": RuntimeType.NODE,
"nodejs16.x": RuntimeType.NODE,
"nodejs18.x": RuntimeType.NODE,
"nodejs20.x": RuntimeType.NODE,
"nodejs22.x": RuntimeType.NODE,
"nodejs24.x": RuntimeType.NODE,
"python3.6": RuntimeType.PYTHON,
"python3.7": RuntimeType.PYTHON,
"python3.8": RuntimeType.PYTHON,
"python3.9": RuntimeType.PYTHON,
"python3.10": RuntimeType.PYTHON,
"python3.11": RuntimeType.PYTHON,
"python3.12": RuntimeType.PYTHON,
"python3.13": RuntimeType.PYTHON,
"python3.14": RuntimeType.PYTHON,
"java8.al2": RuntimeType.JAVA,
"java11": RuntimeType.JAVA,
"java17": RuntimeType.JAVA,
"java21": RuntimeType.JAVA,
"java25": RuntimeType.JAVA,
"provided": RuntimeType.CUSTOM,
"provided.al2": RuntimeType.CUSTOM,
"provided.al2023": RuntimeType.CUSTOM,
"ruby3.2": RuntimeType.RUBY,
"ruby3.3": RuntimeType.RUBY,
"ruby3.4": RuntimeType.RUBY,
"ruby4.0": RuntimeType.RUBY,
};
export const runtimeLookup: { [key: string]: RuntimeType } = Object.fromEntries(
layerRuntimeCatalog.flatMap((runtime) =>
"runtimeType" in runtime ? [[runtime.runtime, runtimeTypeLookup[runtime.runtimeType]]] : [],
),
);

export const runtimeToLayerName: { [key: string]: string } = {
"dotnet6": "dd-trace-dotnet",
"dotnet8": "dd-trace-dotnet",
"dotnet10": "dd-trace-dotnet",
"nodejs12.x": "Datadog-Node12-x",
"nodejs14.x": "Datadog-Node14-x",
"nodejs16.x": "Datadog-Node16-x",
"nodejs18.x": "Datadog-Node18-x",
"nodejs20.x": "Datadog-Node20-x",
"nodejs22.x": "Datadog-Node22-x",
"nodejs24.x": "Datadog-Node24-x",
"python3.6": "Datadog-Python36",
"python3.7": "Datadog-Python37",
"python3.8": "Datadog-Python38",
"python3.9": "Datadog-Python39",
"python3.10": "Datadog-Python310",
"python3.11": "Datadog-Python311",
"python3.12": "Datadog-Python312",
"python3.13": "Datadog-Python313",
"python3.14": "Datadog-Python314",
"java8.al2": "dd-trace-java",
"java11": "dd-trace-java",
"java17": "dd-trace-java",
"java21": "dd-trace-java",
"java25": "dd-trace-java",
"ruby32": "Datadog-Ruby3-2",
"ruby33": "Datadog-Ruby3-3",
"ruby34": "Datadog-Ruby3-4",
"ruby40": "Datadog-Ruby4-0",
};
export const runtimeToLayerName: { [key: string]: { x86_64: string; arm64: string } } = Object.fromEntries(
layerRuntimeCatalog.flatMap((runtime) => ("layerNames" in runtime ? [[runtime.runtime, runtime.layerNames]] : [])),
);

export const govCloudRegions: ReadonlyArray<string> = ["us-gov-east-1", "us-gov-west-1"];

Expand Down
125 changes: 125 additions & 0 deletions src/layer-runtime-catalog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed
* under the Apache License Version 2.0.
*
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2026 Datadog, Inc.
*/

/*
* DO NOT EDIT: This file is autogenerated.
*/

export const layerRuntimeCatalog = [
{
runtime: "dotnet6",
runtimeType: "DOTNET",
layerNames: { x86_64: "dd-trace-dotnet", arm64: "dd-trace-dotnet-ARM" },
},
{
runtime: "dotnet8",
runtimeType: "DOTNET",
layerNames: { x86_64: "dd-trace-dotnet", arm64: "dd-trace-dotnet-ARM" },
},
{
runtime: "dotnet10",
runtimeType: "DOTNET",
layerNames: { x86_64: "dd-trace-dotnet", arm64: "dd-trace-dotnet-ARM" },
},
{
runtime: "nodejs12.x",
runtimeType: "NODE",
layerNames: { x86_64: "Datadog-Node12-x", arm64: "Datadog-Node12-x-ARM" },
},
{
runtime: "nodejs14.x",
runtimeType: "NODE",
layerNames: { x86_64: "Datadog-Node14-x", arm64: "Datadog-Node14-x-ARM" },
},
{
runtime: "nodejs16.x",
runtimeType: "NODE",
layerNames: { x86_64: "Datadog-Node16-x", arm64: "Datadog-Node16-x-ARM" },
},
{
runtime: "nodejs18.x",
runtimeType: "NODE",
layerNames: { x86_64: "Datadog-Node18-x", arm64: "Datadog-Node18-x-ARM" },
},
{
runtime: "nodejs20.x",
runtimeType: "NODE",
layerNames: { x86_64: "Datadog-Node20-x", arm64: "Datadog-Node20-x-ARM" },
},
{
runtime: "nodejs22.x",
runtimeType: "NODE",
layerNames: { x86_64: "Datadog-Node22-x", arm64: "Datadog-Node22-x-ARM" },
},
{
runtime: "nodejs24.x",
runtimeType: "NODE",
layerNames: { x86_64: "Datadog-Node24-x", arm64: "Datadog-Node24-x-ARM" },
},
{
runtime: "python3.6",
runtimeType: "PYTHON",
layerNames: { x86_64: "Datadog-Python36", arm64: "Datadog-Python36-ARM" },
},
{
runtime: "python3.7",
runtimeType: "PYTHON",
layerNames: { x86_64: "Datadog-Python37", arm64: "Datadog-Python37-ARM" },
},
{
runtime: "python3.8",
runtimeType: "PYTHON",
layerNames: { x86_64: "Datadog-Python38", arm64: "Datadog-Python38-ARM" },
},
{
runtime: "python3.9",
runtimeType: "PYTHON",
layerNames: { x86_64: "Datadog-Python39", arm64: "Datadog-Python39-ARM" },
},
{
runtime: "python3.10",
runtimeType: "PYTHON",
layerNames: { x86_64: "Datadog-Python310", arm64: "Datadog-Python310-ARM" },
},
{
runtime: "python3.11",
runtimeType: "PYTHON",
layerNames: { x86_64: "Datadog-Python311", arm64: "Datadog-Python311-ARM" },
},
{
runtime: "python3.12",
runtimeType: "PYTHON",
layerNames: { x86_64: "Datadog-Python312", arm64: "Datadog-Python312-ARM" },
},
{
runtime: "python3.13",
runtimeType: "PYTHON",
layerNames: { x86_64: "Datadog-Python313", arm64: "Datadog-Python313-ARM" },
},
{
runtime: "python3.14",
runtimeType: "PYTHON",
layerNames: { x86_64: "Datadog-Python314", arm64: "Datadog-Python314-ARM" },
},
{ runtime: "java8.al2", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
{ runtime: "java11", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
{ runtime: "java17", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
{ runtime: "java21", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
{ runtime: "java25", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
{ runtime: "provided", runtimeType: "CUSTOM" },
{ runtime: "provided.al2", runtimeType: "CUSTOM" },
{ runtime: "provided.al2023", runtimeType: "CUSTOM" },
{ runtime: "ruby3.2", runtimeType: "RUBY" },
{ runtime: "ruby3.3", runtimeType: "RUBY" },
{ runtime: "ruby3.4", runtimeType: "RUBY" },
{ runtime: "ruby4.0", runtimeType: "RUBY" },
{ runtime: "ruby32", layerNames: { x86_64: "Datadog-Ruby3-2", arm64: "Datadog-Ruby3-2-ARM" } },
{ runtime: "ruby33", layerNames: { x86_64: "Datadog-Ruby3-3", arm64: "Datadog-Ruby3-3-ARM" } },
{ runtime: "ruby34", layerNames: { x86_64: "Datadog-Ruby3-4", arm64: "Datadog-Ruby3-4-ARM" } },
{ runtime: "ruby40", layerNames: { x86_64: "Datadog-Ruby4-0", arm64: "Datadog-Ruby4-0-ARM" } },
] as const;
3 changes: 1 addition & 2 deletions src/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,7 @@ export function getLambdaLayerArn(
isArm: boolean,
accountId?: string,
): string {
const baseLayerName = runtimeToLayerName[runtime];
const layerName = isArm ? `${baseLayerName}-ARM` : baseLayerName;
const layerName = runtimeToLayerName[runtime]?.[isArm ? "arm64" : "x86_64"];
const partition = getAWSPartitionFromRegion(region);
// TODO: edge case where gov cloud is the region, but they are using a token so we can't resolve it.
const isGovCloud = govCloudRegions.includes(region);
Expand Down
Loading