Skip to content

Commit

Permalink
feat: Rename: Datadog -> DatadogLambda
Browse files Browse the repository at this point in the history
  • Loading branch information
lym953 committed Aug 29, 2024
1 parent 816bb26 commit 3646d05
Show file tree
Hide file tree
Showing 22 changed files with 1,265 additions and 1,175 deletions.
6 changes: 3 additions & 3 deletions examples/typescript-stack/lib/cdk-typescript-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BundlingOutput, Duration, Stack, StackProps } from "aws-cdk-lib";
import { Function } from "aws-cdk-lib/aws-lambda";
import { HttpLambdaIntegration } from "aws-cdk-lib/aws-apigatewayv2-integrations";
import { Construct } from "constructs";
import { Datadog } from "datadog-cdk-constructs-v2";
import { DatadogLambda } from "datadog-cdk-constructs-v2";

export class CdkTypeScriptStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
Expand Down Expand Up @@ -84,7 +84,7 @@ export class CdkTypeScriptStack extends Stack {

console.log("Instrumenting Lambda Functions in TypeScript stack with Datadog");

const DatadogCDK = new Datadog(this, "Datadog", {
const datadogLambda = new DatadogLambda(this, "Datadog", {
dotnetLayerVersion: 15,
nodeLayerVersion: 108,
pythonLayerVersion: 89,
Expand All @@ -97,6 +97,6 @@ export class CdkTypeScriptStack extends Stack {
site: "datadoghq.com",
});

DatadogCDK.addLambdaFunctions([helloNode, helloPython, helloGo, helloDotnet]);
datadogLambda.addLambdaFunctions([helloNode, helloPython, helloGo, helloDotnet]);
}
}
8 changes: 4 additions & 4 deletions integration_tests/stacks/lambda-function-arm-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as lambda from "aws-cdk-lib/aws-lambda";
import { Stack, StackProps, App } from "aws-cdk-lib";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Datadog } from "../../src/index";
import { DatadogLambda } from "../../src/index";
import { Architecture } from "aws-cdk-lib/aws-lambda";

export class ExampleStack extends Stack {
Expand All @@ -32,7 +32,7 @@ export class ExampleStack extends Stack {
},
});

const datadogCDK = new Datadog(this, "Datadog", {
const datadogLambda = new DatadogLambda(this, "Datadog", {
nodeLayerVersion: 62,
extensionLayerVersion: 10,
enableDatadogTracing: true,
Expand All @@ -41,8 +41,8 @@ export class ExampleStack extends Stack {
apiKey: "1234",
site: "datadoghq.com",
});
datadogCDK.addLambdaFunctions([lambdaFunction]);
datadogCDK.addForwarderToNonLambdaLogGroups([restLogGroup]);
datadogLambda.addLambdaFunctions([lambdaFunction]);
datadogLambda.addForwarderToNonLambdaLogGroups([restLogGroup]);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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 2021 Datadog, Inc.
*/

import * as lambda from "aws-cdk-lib/aws-lambda";
import { Stack, StackProps, App } from "aws-cdk-lib";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
// use the legacy Datadog class instead of the new DatadogLambda
import { Datadog } from "../../src/index";

export class ExampleStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
super(scope, id, props);

const lambdaFunction = new lambda.Function(this, "HelloHandler", {
runtime: lambda.Runtime.NODEJS_14_X,
code: lambda.Code.fromInline("test"),
handler: "lambdaFunction.handler",
});

const restLogGroup = new LogGroup(this, "restLogGroup");
new LambdaRestApi(this, "rest-test", {
handler: lambdaFunction,
deployOptions: {
accessLogDestination: new LogGroupLogDestination(restLogGroup),
},
});

const datadog = new Datadog(this, "Datadog", {
nodeLayerVersion: 62,
extensionLayerVersion: 10,
enableDatadogTracing: true,
flushMetricsToLogs: true,
sourceCodeIntegration: false,
apiKey: "1234",
site: "datadoghq.com",
});
datadog.addLambdaFunctions([lambdaFunction]);
datadog.addForwarderToNonLambdaLogGroups([restLogGroup]);
}
}

const app = new App();
const env = { account: "601427279990", region: "sa-east-1" };
const stack = new ExampleStack(app, "lambda-function-stack", { env: env });
console.log("Stack name: " + stack.stackName);
app.synth();
8 changes: 4 additions & 4 deletions integration_tests/stacks/lambda-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as lambda from "aws-cdk-lib/aws-lambda";
import { Stack, StackProps, App } from "aws-cdk-lib";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Datadog } from "../../src/index";
import { DatadogLambda } from "../../src/index";

export class ExampleStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
Expand All @@ -30,7 +30,7 @@ export class ExampleStack extends Stack {
},
});

const datadogCDK = new Datadog(this, "Datadog", {
const datadogLambda = new DatadogLambda(this, "Datadog", {
nodeLayerVersion: 62,
extensionLayerVersion: 10,
enableDatadogTracing: true,
Expand All @@ -39,8 +39,8 @@ export class ExampleStack extends Stack {
apiKey: "1234",
site: "datadoghq.com",
});
datadogCDK.addLambdaFunctions([lambdaFunction]);
datadogCDK.addForwarderToNonLambdaLogGroups([restLogGroup]);
datadogLambda.addLambdaFunctions([lambdaFunction]);
datadogLambda.addForwarderToNonLambdaLogGroups([restLogGroup]);
}
}

Expand Down
8 changes: 4 additions & 4 deletions integration_tests/stacks/lambda-java-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as lambda from "aws-cdk-lib/aws-lambda";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps, App } from "aws-cdk-lib";
import { Datadog } from "../../src/index";
import { DatadogLambda } from "../../src/index";

export class ExampleStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
Expand All @@ -30,7 +30,7 @@ export class ExampleStack extends Stack {
},
});

const datadogCDK = new Datadog(this, "Datadog", {
const datadogLambda = new DatadogLambda(this, "Datadog", {
javaLayerVersion: 5,
extensionLayerVersion: 25,
enableDatadogTracing: true,
Expand All @@ -39,8 +39,8 @@ export class ExampleStack extends Stack {
apiKey: "1234",
site: "datadoghq.com",
});
datadogCDK.addLambdaFunctions([lambdaJavaFunction]);
datadogCDK.addForwarderToNonLambdaLogGroups([restLogGroup]);
datadogLambda.addLambdaFunctions([lambdaJavaFunction]);
datadogLambda.addForwarderToNonLambdaLogGroups([restLogGroup]);
}
}

Expand Down
8 changes: 4 additions & 4 deletions integration_tests/stacks/lambda-nodejs-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps, App } from "aws-cdk-lib";
import { Datadog } from "../../src/index";
import { DatadogLambda } from "../../src/index";

export class ExampleStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
Expand All @@ -31,7 +31,7 @@ export class ExampleStack extends Stack {
},
});

const datadogCDK = new Datadog(this, "Datadog", {
const datadogLambda = new DatadogLambda(this, "Datadog", {
nodeLayerVersion: 62,
extensionLayerVersion: 10,
enableDatadogTracing: true,
Expand All @@ -40,8 +40,8 @@ export class ExampleStack extends Stack {
apiKey: "1234",
site: "datadoghq.com",
});
datadogCDK.addLambdaFunctions([lambdaNodejsFunction]);
datadogCDK.addForwarderToNonLambdaLogGroups([restLogGroup]);
datadogLambda.addLambdaFunctions([lambdaNodejsFunction]);
datadogLambda.addForwarderToNonLambdaLogGroups([restLogGroup]);
}
}

Expand Down
8 changes: 4 additions & 4 deletions integration_tests/stacks/lambda-provided-arm-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as s3 from "aws-cdk-lib/aws-s3";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps, App } from "aws-cdk-lib";
import { Datadog } from "../../src/index";
import { DatadogLambda } from "../../src/index";

export class ExampleStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
Expand Down Expand Up @@ -31,14 +31,14 @@ export class ExampleStack extends Stack {
},
});

const datadogCDK = new Datadog(this, "Datadog", {
const datadogLambda = new DatadogLambda(this, "Datadog", {
extensionLayerVersion: 49,
apiKey: "1234",
site: "datadoghq.com",
sourceCodeIntegration: false,
});
datadogCDK.addLambdaFunctions([providedLambda]);
datadogCDK.addForwarderToNonLambdaLogGroups([restLogGroup]);
datadogLambda.addLambdaFunctions([providedLambda]);
datadogLambda.addForwarderToNonLambdaLogGroups([restLogGroup]);
}
}

Expand Down
8 changes: 4 additions & 4 deletions integration_tests/stacks/lambda-provided-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as s3 from "aws-cdk-lib/aws-s3";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps, App } from "aws-cdk-lib";
import { Datadog } from "../../src/index";
import { DatadogLambda } from "../../src/index";

export class ExampleStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
Expand All @@ -30,14 +30,14 @@ export class ExampleStack extends Stack {
},
});

const datadogCDK = new Datadog(this, "Datadog", {
const datadogLambda = new DatadogLambda(this, "Datadog", {
extensionLayerVersion: 49,
apiKey: "1234",
site: "datadoghq.com",
sourceCodeIntegration: false,
});
datadogCDK.addLambdaFunctions([providedLambda]);
datadogCDK.addForwarderToNonLambdaLogGroups([restLogGroup]);
datadogLambda.addLambdaFunctions([providedLambda]);
datadogLambda.addForwarderToNonLambdaLogGroups([restLogGroup]);
}
}

Expand Down
8 changes: 4 additions & 4 deletions integration_tests/stacks/lambda-python-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { PythonFunction } from "@aws-cdk/aws-lambda-python-alpha";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps, App } from "aws-cdk-lib";
import { Datadog } from "../../src/index";
import { DatadogLambda } from "../../src/index";

export class ExampleStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
Expand All @@ -32,7 +32,7 @@ export class ExampleStack extends Stack {
},
});

const datadogCDK = new Datadog(this, "Datadog", {
const datadogLambda = new DatadogLambda(this, "Datadog", {
pythonLayerVersion: 46,
extensionLayerVersion: 10,
enableDatadogTracing: true,
Expand All @@ -41,8 +41,8 @@ export class ExampleStack extends Stack {
apiKey: "1234",
site: "datadoghq.com",
});
datadogCDK.addLambdaFunctions([lambdaPythonFunction]);
datadogCDK.addForwarderToNonLambdaLogGroups([restLogGroup]);
datadogLambda.addLambdaFunctions([lambdaPythonFunction]);
datadogLambda.addForwarderToNonLambdaLogGroups([restLogGroup]);
}
}

Expand Down
8 changes: 4 additions & 4 deletions integration_tests/stacks/lambda-singleton-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as lambda from "aws-cdk-lib/aws-lambda";
import { Stack, StackProps, App } from "aws-cdk-lib";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Datadog } from "../../src/index";
import { DatadogLambda } from "../../src/index";

export class ExampleStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
Expand All @@ -31,7 +31,7 @@ export class ExampleStack extends Stack {
},
});

const datadogCDK = new Datadog(this, "Datadog", {
const datadogLambda = new DatadogLambda(this, "Datadog", {
nodeLayerVersion: 62,
extensionLayerVersion: 10,
enableDatadogTracing: true,
Expand All @@ -40,8 +40,8 @@ export class ExampleStack extends Stack {
apiKey: "1234",
site: "datadoghq.com",
});
datadogCDK.addLambdaFunctions([singletonLambdaFunction]);
datadogCDK.addForwarderToNonLambdaLogGroups([restLogGroup]);
datadogLambda.addLambdaFunctions([singletonLambdaFunction]);
datadogLambda.addForwarderToNonLambdaLogGroups([restLogGroup]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json

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

Loading

0 comments on commit 3646d05

Please sign in to comment.