Skip to content
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

Support CDK Aspects #251

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Support CDK Aspects #251

wants to merge 6 commits into from

Conversation

astuyve
Copy link
Contributor

@astuyve astuyve commented Feb 15, 2024

  • feat: Aspect POC
  • feat: Add datadog aspect
  • feat: No need to forward logs, addFunctions will do that
  • docs: Document Aspects in readme

What does this PR do?

Allows our construct to be imported and used as an Aspect, which makes it easier to instrument all functions in a stack without re-importing or re-declaring the Datadog construct.

Motivation

Testing Guidelines

Additional Notes

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

@astuyve astuyve requested review from a team as code owners February 15, 2024 16:42
constructor(private datadog: Datadog) {}

visit(node: IConstruct): void {
if (node.constructor.name === lambda.Function.name) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that this condition might not instrument lambda.SingletonFunction, is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah that's a miss, good call

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the interfaces differ, so LambdaFunction.name might or might not work 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I seemed to run into.

Copy link
Contributor

@duncanista duncanista left a comment

Choose a reason for hiding this comment

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

LGTM – thanks a lot for this PR, AJ! 🎉

@astuyve
Copy link
Contributor Author

astuyve commented Feb 16, 2024

holding off on merging this because apparently this issue still remains.

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.

3 participants