-
Notifications
You must be signed in to change notification settings - Fork 28
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
fix: revert "chore: rename Lambda related interfaces (#288)" #296
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,11 +19,11 @@ import { | |||||
addForwarderToLogGroups, | ||||||
applyEnvVariables, | ||||||
TagKeys, | ||||||
DatadogLambdaStrictProps, | ||||||
DatadogStrictProps, | ||||||
setGitEnvironmentVariables, | ||||||
setDDEnvVariables, | ||||||
DatadogLambdaDefaultProps, | ||||||
DatadogLambdaProps, | ||||||
DefaultDatadogProps, | ||||||
DatadogProps, | ||||||
Transport, | ||||||
} from "./index"; | ||||||
import { LambdaFunction } from "./interfaces"; | ||||||
|
@@ -32,10 +32,10 @@ const versionJson = require("../version.json"); | |||||
|
||||||
export class DatadogLambda extends Construct { | ||||||
scope: Construct; | ||||||
props: DatadogLambdaProps; | ||||||
props: DatadogProps; | ||||||
transport: Transport; | ||||||
constructor(scope: Construct, id: string, props: DatadogLambdaProps) { | ||||||
if (process.env.DD_CONSTRUCT_DEBUG_LOGS?.toLowerCase() === "true") { | ||||||
constructor(scope: Construct, id: string, props: DatadogProps) { | ||||||
if (process.env.DD_CONSTRUCT_DEBUG_LOGS?.toLowerCase() == "true") { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ Code Quality Violation
Suggested change
Expected '===' and instead saw '=='. (...read more)In JavaScript, |
||||||
log.setLevel("debug"); | ||||||
} | ||||||
super(scope, id); | ||||||
|
@@ -58,8 +58,8 @@ export class DatadogLambda extends Construct { | |||||
|
||||||
public addLambdaFunctions(lambdaFunctions: LambdaFunction[], construct?: Construct): void { | ||||||
// baseProps contains all properties set by the user, with default values for properties | ||||||
// defined in DatadogLambdaDefaultProps (if not set by user) | ||||||
const baseProps: DatadogLambdaStrictProps = handleSettingPropDefaults(this.props); | ||||||
// defined in DefaultDatadogProps (if not set by user) | ||||||
const baseProps: DatadogStrictProps = handleSettingPropDefaults(this.props); | ||||||
|
||||||
const extractedLambdaFunctions = extractSingletonFunctions(lambdaFunctions); | ||||||
|
||||||
|
@@ -160,7 +160,7 @@ export function addCdkConstructVersionTag(lambdaFunctions: lambda.Function[]): v | |||||
}); | ||||||
} | ||||||
|
||||||
function setTags(lambdaFunctions: lambda.Function[], props: DatadogLambdaProps): void { | ||||||
function setTags(lambdaFunctions: lambda.Function[], props: DatadogProps): void { | ||||||
log.debug(`Adding datadog tags`); | ||||||
lambdaFunctions.forEach((functionName) => { | ||||||
if (props.forwarderArn) { | ||||||
|
@@ -214,7 +214,7 @@ function isSingletonFunction(fn: LambdaFunction): fn is lambda.SingletonFunction | |||||
return fn.hasOwnProperty("lambdaFunction"); | ||||||
} | ||||||
|
||||||
export function validateProps(props: DatadogLambdaProps, apiKeyArnOverride = false): void { | ||||||
export function validateProps(props: DatadogProps, apiKeyArnOverride = false): void { | ||||||
log.debug("Validating props..."); | ||||||
|
||||||
checkForMultipleApiKeys(props, apiKeyArnOverride); | ||||||
|
@@ -268,7 +268,7 @@ export function validateProps(props: DatadogLambdaProps, apiKeyArnOverride = fal | |||||
} | ||||||
} | ||||||
|
||||||
export function checkForMultipleApiKeys(props: DatadogLambdaProps, apiKeyArnOverride = false): void { | ||||||
export function checkForMultipleApiKeys(props: DatadogProps, apiKeyArnOverride = false): void { | ||||||
let multipleApiKeysMessage; | ||||||
const apiKeyArnOrOverride = props.apiKeySecretArn !== undefined || apiKeyArnOverride; | ||||||
if (props.apiKey !== undefined && props.apiKmsKey !== undefined && apiKeyArnOrOverride) { | ||||||
|
@@ -286,7 +286,7 @@ export function checkForMultipleApiKeys(props: DatadogLambdaProps, apiKeyArnOver | |||||
} | ||||||
} | ||||||
|
||||||
export function handleSettingPropDefaults(props: DatadogLambdaProps): DatadogLambdaStrictProps { | ||||||
export function handleSettingPropDefaults(props: DatadogProps): DatadogStrictProps { | ||||||
let addLayers = props.addLayers; | ||||||
let enableDatadogTracing = props.enableDatadogTracing; | ||||||
let enableDatadogASM = props.enableDatadogASM; | ||||||
|
@@ -301,59 +301,51 @@ export function handleSettingPropDefaults(props: DatadogLambdaProps): DatadogLam | |||||
const extensionLayerVersion = props.extensionLayerVersion; | ||||||
|
||||||
if (addLayers === undefined) { | ||||||
log.debug(`No value provided for addLayers, defaulting to ${DatadogLambdaDefaultProps.addLayers}`); | ||||||
addLayers = DatadogLambdaDefaultProps.addLayers; | ||||||
log.debug(`No value provided for addLayers, defaulting to ${DefaultDatadogProps.addLayers}`); | ||||||
addLayers = DefaultDatadogProps.addLayers; | ||||||
} | ||||||
if (enableDatadogTracing === undefined) { | ||||||
log.debug( | ||||||
`No value provided for enableDatadogTracing, defaulting to ${DatadogLambdaDefaultProps.enableDatadogTracing}`, | ||||||
); | ||||||
enableDatadogTracing = DatadogLambdaDefaultProps.enableDatadogTracing; | ||||||
log.debug(`No value provided for enableDatadogTracing, defaulting to ${DefaultDatadogProps.enableDatadogTracing}`); | ||||||
enableDatadogTracing = DefaultDatadogProps.enableDatadogTracing; | ||||||
} | ||||||
if (enableDatadogASM === undefined) { | ||||||
log.debug(`No value provided for enableDatadogASM, defaulting to ${DatadogLambdaDefaultProps.enableDatadogASM}`); | ||||||
enableDatadogASM = DatadogLambdaDefaultProps.enableDatadogASM; | ||||||
log.debug(`No value provided for enableDatadogASM, defaulting to ${DefaultDatadogProps.enableDatadogASM}`); | ||||||
enableDatadogASM = DefaultDatadogProps.enableDatadogASM; | ||||||
} | ||||||
if (enableMergeXrayTraces === undefined) { | ||||||
log.debug( | ||||||
`No value provided for enableMergeXrayTraces, defaulting to ${DatadogLambdaDefaultProps.enableMergeXrayTraces}`, | ||||||
`No value provided for enableMergeXrayTraces, defaulting to ${DefaultDatadogProps.enableMergeXrayTraces}`, | ||||||
); | ||||||
enableMergeXrayTraces = DatadogLambdaDefaultProps.enableMergeXrayTraces; | ||||||
enableMergeXrayTraces = DefaultDatadogProps.enableMergeXrayTraces; | ||||||
} | ||||||
if (injectLogContext === undefined) { | ||||||
log.debug(`No value provided for injectLogContext, defaulting to ${DatadogLambdaDefaultProps.injectLogContext}`); | ||||||
injectLogContext = DatadogLambdaDefaultProps.injectLogContext; | ||||||
log.debug(`No value provided for injectLogContext, defaulting to ${DefaultDatadogProps.injectLogContext}`); | ||||||
injectLogContext = DefaultDatadogProps.injectLogContext; | ||||||
} | ||||||
if (logLevel === undefined) { | ||||||
log.debug(`No value provided for logLevel`); | ||||||
} | ||||||
if (enableDatadogLogs === undefined) { | ||||||
log.debug(`No value provided for enableDatadogLogs, defaulting to ${DatadogLambdaDefaultProps.enableDatadogLogs}`); | ||||||
enableDatadogLogs = DatadogLambdaDefaultProps.enableDatadogLogs; | ||||||
log.debug(`No value provided for enableDatadogLogs, defaulting to ${DefaultDatadogProps.enableDatadogLogs}`); | ||||||
enableDatadogLogs = DefaultDatadogProps.enableDatadogLogs; | ||||||
} | ||||||
if (captureLambdaPayload === undefined) { | ||||||
log.debug( | ||||||
`No value provided for captureLambdaPayload, default to ${DatadogLambdaDefaultProps.captureLambdaPayload}`, | ||||||
); | ||||||
captureLambdaPayload = DatadogLambdaDefaultProps.captureLambdaPayload; | ||||||
log.debug(`No value provided for captureLambdaPayload, default to ${DefaultDatadogProps.captureLambdaPayload}`); | ||||||
captureLambdaPayload = DefaultDatadogProps.captureLambdaPayload; | ||||||
} | ||||||
if (sourceCodeIntegration === undefined) { | ||||||
log.debug( | ||||||
`No value provided for sourceCodeIntegration, default to ${DatadogLambdaDefaultProps.sourceCodeIntegration}`, | ||||||
); | ||||||
sourceCodeIntegration = DatadogLambdaDefaultProps.sourceCodeIntegration; | ||||||
log.debug(`No value provided for sourceCodeIntegration, default to ${DefaultDatadogProps.sourceCodeIntegration}`); | ||||||
sourceCodeIntegration = DefaultDatadogProps.sourceCodeIntegration; | ||||||
} | ||||||
|
||||||
if (redirectHandler === undefined) { | ||||||
log.debug(`No value provided for redirectHandler, default to ${DatadogLambdaDefaultProps.redirectHandler}`); | ||||||
redirectHandler = DatadogLambdaDefaultProps.redirectHandler; | ||||||
log.debug(`No value provided for redirectHandler, default to ${DefaultDatadogProps.redirectHandler}`); | ||||||
redirectHandler = DefaultDatadogProps.redirectHandler; | ||||||
} | ||||||
|
||||||
if (grantSecretReadAccess === undefined) { | ||||||
log.debug( | ||||||
`No value provided for grantSecretReadAccess, default to ${DatadogLambdaDefaultProps.grantSecretReadAccess}`, | ||||||
); | ||||||
grantSecretReadAccess = DatadogLambdaDefaultProps.grantSecretReadAccess; | ||||||
log.debug(`No value provided for grantSecretReadAccess, default to ${DefaultDatadogProps.grantSecretReadAccess}`); | ||||||
grantSecretReadAccess = DefaultDatadogProps.grantSecretReadAccess; | ||||||
} | ||||||
|
||||||
return { | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
import { DatadogLambda } from "./datadog-lambda"; | ||
|
||
/** | ||
* For backward compatibility. To be deprecated. | ||
* It's recommended to use DatadogLambda for users who want to add Datadog | ||
* monitoring for Lambda functions. | ||
*/ | ||
export class Datadog extends DatadogLambda {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Code Quality Violation
Expected '===' and instead saw '=='. (...read more)
In JavaScript,
==
and!=
comparisons do type coercion, which can be confusing and may introduce potential errors. Use the type-safe equality operators===
and!==
instead.