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] Import examples from aws-samples/aws-lambda-powertools-examples #1051

Merged
merged 31 commits into from
Feb 22, 2023

Conversation

scottgerring
Copy link
Contributor

@scottgerring scottgerring commented Feb 15, 2023

Issue #, if available:
#1050

Description of changes:

Moving the samples from https://github.com/aws-samples/aws-lambda-powertools-examples into the repository. This will help make the samples more discoverable, allow us to keep them up-to-date with the powertools themselves, and follow the pattern established by the python powertools.

Checklist

Detailed Description

The code is lifted verbatim from the old repository. I've tied it all together into one big maven build tree, and introduced an intermediate pom in the examples project. This has included some effort to restructure the examples themselves so they match the general maven project structure.

Breaking change checklist

RFC issue #:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

README.md Outdated Show resolved Hide resolved
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Introducing an intermediate parent pom to aggregate the samples together

@@ -0,0 +1,138 @@
# CoreUtilities
Copy link
Contributor Author

@scottgerring scottgerring Feb 15, 2023

Choose a reason for hiding this comment

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

These and the rest of the concrete samples have simply been lifted from main from the linked samples repository.

https://github.com/aws-samples/aws-lambda-powertools-examples

@@ -37,7 +37,8 @@
<module>powertools-validation</module>
<module>powertools-test-suite</module>
<module>powertools-cloudformation</module>
<module>powertools-idempotency</module>
<module>powertools-idempotency</module>
<module>examples</module>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussion point: do we want the samples to be build as part of the main project reactor here?
It makes the build easier, and we can simply choose not to release the examples project.

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the build time? Does it have any side effects?
If there are no issues with mentioned above questions, I believe that it's good to have it built as a part of build process to have quick feedback when some changes are done in the project (version of PowerTools used in examples might be an issue here...)

Copy link
Contributor Author

@scottgerring scottgerring Feb 15, 2023

Choose a reason for hiding this comment

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

Build time: +approx 45s, 3:30 up from 2:44

The only other side-effect I can see is that changes to the powertools that break the examples will have to fix the examples, but I'd say that is desirable!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that would be desirable, we'd have a mechanism to keep the samples up to date.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@@ -152,4 +152,13 @@
<Class name="software.amazon.lambda.powertools.logging.internal.LambdaLoggingAspect"/>
<Method name="setLogLevelBasedOnSamplingRate"/>
</Match>
<Match>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Spotbugs wasn't run on the examples previously. This lint comes from the original projects and I have not yet corrected it.

@@ -450,7 +452,7 @@
<profile>
<id>build-with-spotbugs</id>
<activation>
<activeByDefault>true</activeByDefault>
<activeByDefault>false</activeByDefault>
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've turned this off by default, as it 1/ helps with the SAM tooling for the examples and 2/ speeds up local builds that haven't opted into it.

The github workflows explicitly activate and de-activate these using the profiles, so it has no impact on CI.

pom.xml Outdated Show resolved Hide resolved
Copy link
Contributor

@jeromevdl jeromevdl left a comment

Choose a reason for hiding this comment

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

Should the example poms have the examples/pom.xml as parent or the lambda-powertools root pom?

(See my other comments)

@scottgerring
Copy link
Contributor Author

Should the example poms have the examples/pom.xml as parent or the lambda-powertools root pom?

(See my other comments)

yes - silly mistake - some were, some weren't. fixed.

@kozub
Copy link
Contributor

kozub commented Feb 21, 2023

Looks good to me.

One minor suggestion:

I think that we might change names of 2 examples packages in theirs pom.xml to have it more consistent.

Right now when we run all tests it produces logs (please ignore info about failing test):

[INFO] Reactor Summary for AWS Lambda Powertools for Java library Parent 1.14.0:
[INFO]
[INFO] AWS Lambda Powertools for Java library Parent ...... SUCCESS [  0.311 s]
[INFO] AWS Lambda Powertools for Java library Core ........ SUCCESS [  2.522 s]
[INFO] AWS Lambda Powertools for Java library Serialization Utilities SUCCESS [  2.596 s]
[INFO] AWS Lambda Powertools for Java library Logging ..... SUCCESS [  3.538 s]
[INFO] AWS Lambda Powertools for Java library Tracing ..... SUCCESS [  2.695 s]
[INFO] AWS Lambda Powertools for Java library SQS ......... SUCCESS [  2.864 s]
[INFO] AWS Lambda Powertools for Java library Metrics ..... SUCCESS [  2.440 s]
[INFO] AWS Lambda Powertools for Java library Parameters .. SUCCESS [  3.165 s]
[INFO] AWS Lambda Powertools for Java validation library .. SUCCESS [  3.167 s]
[INFO] AWS Lambda Powertools for Java library Test Suite .. SUCCESS [  2.547 s]
[INFO] AWS Lambda Powertools for Java library Cloudformation SUCCESS [  2.086 s]
[INFO] AWS Lambda Powertools for Java library Idempotency . SUCCESS [  4.064 s]
[INFO] AWS Lambda Powertools for Java library Examples .... SUCCESS [  0.004 s]
[INFO] A sample Hello World created for SAM CLI using powertools core utilities SUCCESS [  3.381 s]
[INFO] A sample Hello World using powertools idempotency .. FAILURE [  8.181 s]
[INFO] Sample app demoing parameters utility of Powertools. SKIPPED
[INFO] Sample app demoing serialization utility of Powertools. SKIPPED
[INFO] Sample app demoing SQS Batch Processing utility of Powertools. SKIPPED
[INFO] Sample app demoing validation utility of Powertools. SKIPPED

@scottgerring
Copy link
Contributor Author

Looks good to me.

One minor suggestion:

I think that we might change names of 2 examples packages in theirs pom.xml to have it more consistent.

Right now when we run all tests it produces logs (please ignore info about failing test):

[INFO] Reactor Summary for AWS Lambda Powertools for Java library Parent 1.14.0:
[INFO]
[INFO] AWS Lambda Powertools for Java library Parent ...... SUCCESS [  0.311 s]
[INFO] AWS Lambda Powertools for Java library Core ........ SUCCESS [  2.522 s]
[INFO] AWS Lambda Powertools for Java library Serialization Utilities SUCCESS [  2.596 s]
[INFO] AWS Lambda Powertools for Java library Logging ..... SUCCESS [  3.538 s]
[INFO] AWS Lambda Powertools for Java library Tracing ..... SUCCESS [  2.695 s]
[INFO] AWS Lambda Powertools for Java library SQS ......... SUCCESS [  2.864 s]
[INFO] AWS Lambda Powertools for Java library Metrics ..... SUCCESS [  2.440 s]
[INFO] AWS Lambda Powertools for Java library Parameters .. SUCCESS [  3.165 s]
[INFO] AWS Lambda Powertools for Java validation library .. SUCCESS [  3.167 s]
[INFO] AWS Lambda Powertools for Java library Test Suite .. SUCCESS [  2.547 s]
[INFO] AWS Lambda Powertools for Java library Cloudformation SUCCESS [  2.086 s]
[INFO] AWS Lambda Powertools for Java library Idempotency . SUCCESS [  4.064 s]
[INFO] AWS Lambda Powertools for Java library Examples .... SUCCESS [  0.004 s]
[INFO] A sample Hello World created for SAM CLI using powertools core utilities SUCCESS [  3.381 s]
[INFO] A sample Hello World using powertools idempotency .. FAILURE [  8.181 s]
[INFO] Sample app demoing parameters utility of Powertools. SKIPPED
[INFO] Sample app demoing serialization utility of Powertools. SKIPPED
[INFO] Sample app demoing SQS Batch Processing utility of Powertools. SKIPPED
[INFO] Sample app demoing validation utility of Powertools. SKIPPED

I've changed the example project names to match the general format, and i've put a publish exclusion on them so they don't end up in maven central.

jeromevdl
jeromevdl previously approved these changes Feb 21, 2023
@scottgerring scottgerring changed the title [feat: In Progress] Import examples from aws-samples/aws-lambda-powertools-examples [feat] Import examples from aws-samples/aws-lambda-powertools-examples Feb 21, 2023
@scottgerring
Copy link
Contributor Author

Created change in aws-samples/aws-lambda-powertools-examples/pull/296 to forward viewers onto the samples here.

Copy link
Contributor

@jeromevdl jeromevdl left a comment

Choose a reason for hiding this comment

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

Good for me

@msailes msailes merged commit 33fe108 into aws-powertools:master Feb 22, 2023
@scottgerring scottgerring deleted the import-examples branch February 27, 2023 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants