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

feat(pipes): add LogDestination implementation #31672

Merged
merged 19 commits into from
Nov 27, 2024
Merged

Conversation

msambol
Copy link
Contributor

@msambol msambol commented Oct 6, 2024

Closes #31671.

@aws-cdk-automation aws-cdk-automation requested a review from a team October 6, 2024 05:23
@github-actions github-actions bot added distinguished-contributor [Pilot] contributed 50+ PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Oct 6, 2024
@msambol msambol marked this pull request as ready for review October 6, 2024 22:02
@@ -1,5 +1,9 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { IDeliveryStream } from '@aws-cdk/aws-kinesisfirehose-alpha';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@paulhcsun I saw you working on this module. Can I use this here??

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @msambol, sorry I missed this. There were a couple of breaking changes added to the aws-kinesisfirehose-alpha module recently right before we moved it to Developer Preview. From a quick look I think it's fine in this use case but I'd recommend taking a look at the release notes to see if anyof the recent changes conflicts with the usage of the DeliveryStream in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @paulhcsun! looks good from my view too. I'm just importing IDeliveryStream here.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Oct 7, 2024
@aws-cdk-automation
Copy link
Collaborator

This PR has been in the BUILD FAILING state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

Copy link
Contributor

@nmussy nmussy left a comment

Choose a reason for hiding this comment

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

Had a quick look, I might have missed some things

packages/@aws-cdk/aws-pipes-alpha/lib/logs.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-pipes-alpha/lib/logs.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-pipes-alpha/lib/logs.ts Outdated Show resolved Hide resolved
},
"dependencies": {},
"peerDependencies": {
"aws-cdk-lib": "^0.0.0",
"constructs": "^10.0.0"
"constructs": "^10.0.0",
"@aws-cdk/aws-kinesisfirehose-alpha": "0.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the peer dependency required here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so.. because I am importing IDeliveryStream in logs.ts:

import { IDeliveryStream } from '@aws-cdk/aws-kinesisfirehose-alpha';

When I do npx lerna run build --scope=@aws-cdk/aws-pipes-alpha I get an error if I don't have it.

packages/@aws-cdk/aws-pipes-alpha/test/integ.pipe.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-pipes-alpha/test/integ.pipe.ts Outdated Show resolved Hide resolved
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Nov 3, 2024
parameters: {
s3LogDestination: {
bucketName: this.parameters.bucket.bucketName,
bucketOwner: this.parameters.bucketOwner || this.parameters.bucket.env.account,
Copy link
Contributor Author

@msambol msambol Nov 3, 2024

Choose a reason for hiding this comment

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

@nmussy I had to add this default otherwise I got the following:

Failed resources:
aws-cdk-pipes | 10:24:59 AM | UPDATE_FAILED        | AWS::Pipes::Pipe                     | Pipe (PipeXXX) Resource handler returned message: "[object has missing required properties (["BucketOwner"])] (Service: Pipes, Status Code: 400, Request ID: xxx)" (RequestToken: xxx, HandlerErrorCode: InvalidRequest)

Add this to the doc: @default - account ID derived from bucket

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be an issue given how the env prop is built (see below), but just for safety could you add a bucket import in a unit test?

this.env = {
account: props.account ?? parsedArn?.account ?? this.stack.account,
region: props.region ?? parsedArn?.region ?? this.stack.region,
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@msambol
Copy link
Contributor Author

msambol commented Nov 5, 2024

@paulhcsun Do you have time for a review here this week?

@msambol
Copy link
Contributor Author

msambol commented Nov 7, 2024

@Leo10Gama When you have time could you look here? This will be nice to round out the rest of pipes.

@Leo10Gama Leo10Gama self-assigned this Nov 12, 2024
Copy link
Member

@Leo10Gama Leo10Gama left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Seems like great work, I left a few comments on what could probably be improved and fine-tuned. It does seem like the original vision for this library was for the log destinations to be in their own folder like the targets and sources, but I'll double check with the CDK team to confirm if that's the route we want to go, since it may lead to more confusion later down the line.

packages/@aws-cdk/aws-pipes-alpha/README.md Show resolved Hide resolved

> Currently no implementation exist for any of the supported enrichments. The following example shows how an implementation can look like. The actual implementation is not part of this package and will be in a separate one.
Copy link
Member

Choose a reason for hiding this comment

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

It seems like the expected approach for this module is to have a new folder for the log destinations, likely akin to how we have aws-pipes-sources-alpha and aws-pipes-targets-alpha. We should probably follow this guideline, but I'll bring it up with the CDK team to confirm and get back to you, since it may add more confusion splitting one module into so many different parts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'd prefer to leave these in aws-pipes but open to feedback from the team.

Copy link
Member

Choose a reason for hiding this comment

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

It seems like there is an argument to be made about having this be in the aws-pipes-alpha module, but there isn't really much extra cost having a separate aws-pipes-log-destinations-alpha folder, or something of that nature. One of the main reasons these are split the way they are is to prevent the risk of circular dependencies, and I'm not sure how big of a risk that could be in this case.

I think we could leave things as is, but I would lean more towards making a separate module for log destinations, and in the future before graduating this module, see if we can refactor things and consolidate everything into one. Thoughts?

Copy link
Contributor Author

@msambol msambol Nov 17, 2024

Choose a reason for hiding this comment

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

I'd prefer to leave them here. Logging configuration is tied to a pipe, so I think it makes sense. But will of course default to you and the team.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, kinesis is now in dev preview which I think was the concern with circular dependency?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure how dev preview might be a circular dependency concern; if anything I think the risk with that is, when it's out of dev preview and into GA, the import will need to be updated, but that's expected. It more so applies to the module as a whole, but we can keep the log destination resources here, and investigate refactoring at a later time.

Comment on lines +74 to +76
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-s3logdestination.html#cfn-pipes-pipe-s3logdestination-bucketname
*/
readonly bucket: IBucket;
Copy link
Member

Choose a reason for hiding this comment

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

The documentation you linked here shows that the bucket property isn't required, but we're mandating it here. I'm curious as to why that may be the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not required to create a pipe but it is required if you want to create an S3LogDestination. IMO the docs should be updated.

packages/@aws-cdk/aws-pipes-alpha/lib/logs.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-pipes-alpha/lib/logs.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-pipes-alpha/test/integ.pipe.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-pipes-alpha/test/pipe.test.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed Leo10Gama’s stale review November 17, 2024 20:08

Pull request has been modified.

@msambol
Copy link
Contributor Author

msambol commented Nov 17, 2024

Thanks for the contribution! Seems like great work, I left a few comments on what could probably be improved and fine-tuned. It does seem like the original vision for this library was for the log destinations to be in their own folder like the targets and sources, but I'll double check with the CDK team to confirm if that's the route we want to go, since it may lead to more confusion later down the line.

Update with your feedback – thanks!

Copy link
Member

@Leo10Gama Leo10Gama left a comment

Choose a reason for hiding this comment

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

Thanks for the timely response! Just a few more nits and minor comments on my end

packages/@aws-cdk/aws-pipes-alpha/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-pipes-alpha/test/integ.pipe.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-pipes-alpha/test/integ.pipe.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed Leo10Gama’s stale review November 19, 2024 03:38

Pull request has been modified.

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.46%. Comparing base (4db9565) to head (7c8c792).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #31672   +/-   ##
=======================================
  Coverage   77.46%   77.46%           
=======================================
  Files         105      105           
  Lines        7168     7168           
  Branches     1314     1314           
=======================================
  Hits         5553     5553           
  Misses       1433     1433           
  Partials      182      182           
Flag Coverage Δ
suite.unit 77.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 77.46% <ø> (ø)

@msambol
Copy link
Contributor Author

msambol commented Nov 19, 2024

Thanks for the timely response! Just a few more nits and minor comments on my end

Fixed! Thanks.

@msambol
Copy link
Contributor Author

msambol commented Nov 22, 2024

@Leo10Gama any further feedback on this one? Could we get this in too 😄

Copy link
Member

@Leo10Gama Leo10Gama left a comment

Choose a reason for hiding this comment

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

Thanks for your patience! Just one minor comment about the S3OutputFormat default value.

packages/@aws-cdk/aws-pipes-alpha/lib/logs.ts Show resolved Hide resolved
Copy link
Member

@Leo10Gama Leo10Gama left a comment

Choose a reason for hiding this comment

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

Thanks for the quick response, changes look good to me!

@Leo10Gama
Copy link
Member

@Mergifyio update

Copy link
Contributor

mergify bot commented Nov 26, 2024

update

✅ Branch has been successfully updated

Copy link
Contributor

mergify bot commented Nov 26, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit af5345e into aws:main Nov 27, 2024
16 of 17 checks passed
Copy link
Contributor

mergify bot commented Nov 27, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 7c8c792
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2024
@msambol msambol deleted the pipes-logs branch November 27, 2024 00:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@aws-cdk/aws-pipes-alpha: add missing L2 constructs that implement ILogDestination interface
5 participants