Skip to content

chore: remove singleton private access - #670

Open
ava-silver wants to merge 2 commits into
mainfrom
ava.silver/chore/remove-singleton-private-access
Open

chore: remove singleton private access#670
ava-silver wants to merge 2 commits into
mainfrom
ava.silver/chore/remove-singleton-private-access

Conversation

@ava-silver

@ava-silver ava-silver commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Removes access to CDK's private SingletonFunction.lambdaFunction field.

Motivation

Avoid coupling singleton instrumentation to CDK implementation details.

Singleton support originally unwrapped its backing Lambda so the existing Function-only instrumentation paths could be reused. The backing field is private, so this change uses public SingletonFunction APIs and its documented permissionsNode for the generated L1 resource when needed. These were introduced in 2023, and the code only existed since they weren't available before.

Testing Guidelines

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Comment thread src/datadog-lambda.ts
Comment on lines -308 to -321
function extractSingletonFunctions(lambdaFunctions: LambdaFunction[]): lambda.Function[] {
// extract lambdaFunction property from Singleton Function
// using bracket notation here since lambdaFunction is a private property
const extractedLambdaFunctions: lambda.Function[] = lambdaFunctions.map((fn) => {
// eslint-disable-next-line dot-notation
return isSingletonFunction(fn) ? fn["lambdaFunction"] : fn;
});

return extractedLambdaFunctions;
}

function isSingletonFunction(fn: LambdaFunction): fn is lambda.SingletonFunction {
return fn.hasOwnProperty("lambdaFunction");
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the problematic access we're trying to avoid

@ava-silver
ava-silver marked this pull request as ready for review August 14, 2026 20:37
@ava-silver
ava-silver requested a review from a team as a code owner August 14, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant