Skip to content

Commit fc9f0ec

Browse files
committed
Resolve merge issues
1 parent c5ced4f commit fc9f0ec

File tree

20 files changed

+562
-208
lines changed

20 files changed

+562
-208
lines changed

examples/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
</description>
3030

3131
<modules>
32-
<module>powertools-examples-core/sam</module>
33-
<module>powertools-examples-core/cdk/app</module>
34-
<module>powertools-examples-core/cdk/infra</module>
35-
<module>powertools-examples-core/serverless</module>
32+
<module>powertools-examples-core-utilities/sam</module>
33+
<module>powertools-examples-core-utilities/cdk/app</module>
34+
<module>powertools-examples-core-utilities/cdk/infra</module>
35+
<module>powertools-examples-core-utilities/serverless</module>
3636
<module>powertools-examples-idempotency</module>
3737
<module>powertools-examples-parameters</module>
3838
<module>powertools-examples-serialization</module>

examples/powertools-examples-batch/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<maven.compiler.source>1.8</maven.compiler.source>
1616
<maven.compiler.target>1.8</maven.compiler.target>
1717
<sdk.version>2.20.152</sdk.version>
18+
<aspectj.version>1.9.20</aspectj.version>
19+
1820
</properties>
1921

2022
<dependencies>

examples/powertools-examples-cloudformation/pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44

55
<groupId>software.amazon.lambda.examples</groupId>
6-
<version>1.17.0-SNAPSHOT</version>
6+
<version>2.0.0-SNAPSHOT</version>
77
<artifactId>powertools-examples-cloudformation</artifactId>
88
<packaging>jar</packaging>
99

@@ -16,6 +16,8 @@
1616
<lambda.core.version>1.2.3</lambda.core.version>
1717
<lambda.events.version>3.11.3</lambda.events.version>
1818
<aws.sdk.version>2.20.162</aws.sdk.version>
19+
<aspectj.version>1.9.20</aspectj.version>
20+
1921
</properties>
2022
<dependencyManagement>
2123
<dependencies>

examples/powertools-examples-core-utilities/cdk/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ For general information on the deployed example itself, you can refer to the par
66

77
## Configuration
88
CDK uses the following project structure:
9-
- [app](app) - stores the source code of your application, which is similar between all examples
10-
- [infra](infra) - stores the definition of your infrastructure
11-
- [cdk.json](infra/cdk.json) - tells the CDK Toolkit how to execute your app
12-
- [CdkApp](infra/src/main/java/cdk/CdkApp.java) - bootstraps your stack, taking AWS `account` and `region` as input
13-
- [CdkStack](infra/src/main/java/cdk/CdkStack.java) - defines the Lambda function to be deployed as well as API Gateway for it.
9+
- [app](./app) - stores the source code of your application, which is similar between all examples
10+
- [infra](./infra) - stores the definition of your infrastructure
11+
- [cdk.json](./infra/cdk.json) - tells the CDK Toolkit how to execute your app
12+
- [CdkApp](./infra/src/main/java/cdk/CdkApp.java) - bootstraps your stack, taking AWS `account` and `region` as input
13+
- [CdkStack](./infra/src/main/java/cdk/CdkStack.java) - defines the Lambda function to be deployed as well as API Gateway for it.
1414

1515
It is a [Maven](https://maven.apache.org/) based project, so you can open this project with any Maven compatible Java IDE to build and run tests.
1616

examples/powertools-examples-core-utilities/cdk/app/pom.xml

Lines changed: 70 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
<modelVersion>4.0.0</modelVersion>
44

55
<groupId>software.amazon.lambda.examples</groupId>
6+
<!-- TODO TODO TODO this should build from SNAPSHOT, but it doesn't, because the snapshots
7+
don't appear in the docker environment CDK builds it in in our CDK tests. How to procede? V2 blocker -->
68
<version>1.17.0</version>
79
<artifactId>powertools-examples-core-utilities-cdk</artifactId>
810
<packaging>jar</packaging>
9-
10-
<name>Powertools for AWS Lambda (Java) library Examples - Core Utilities (logging, tracing, metrics) with CDK</name>
11+
<name>Powertools for AWS Lambda (Java) library Examples - Core</name>
1112

1213
<properties>
1314
<log4j.version>2.20.0</log4j.version>
@@ -40,7 +41,7 @@
4041
<dependency>
4142
<groupId>com.amazonaws</groupId>
4243
<artifactId>aws-lambda-java-events</artifactId>
43-
<version>3.11.2</version>
44+
<version>3.11.3</version>
4445
</dependency>
4546
<dependency>
4647
<groupId>org.apache.logging.log4j</groupId>
@@ -67,80 +68,72 @@
6768
</dependencies>
6869

6970
<build>
70-
<finalName>helloworld-lambda</finalName>
71-
<plugins>
72-
<plugin>
73-
<groupId>dev.aspectj</groupId>
74-
<artifactId>aspectj-maven-plugin</artifactId>
75-
<version>1.13.1</version>
76-
<configuration>
77-
<source>${maven.compiler.source}</source>
78-
<target>${maven.compiler.target}</target>
79-
<complianceLevel>${maven.compiler.target}</complianceLevel>
80-
<aspectLibraries>
81-
<aspectLibrary>
82-
<groupId>software.amazon.lambda</groupId>
83-
<artifactId>powertools-tracing</artifactId>
84-
</aspectLibrary>
85-
<aspectLibrary>
86-
<groupId>software.amazon.lambda</groupId>
87-
<artifactId>powertools-logging</artifactId>
88-
</aspectLibrary>
89-
<aspectLibrary>
90-
<groupId>software.amazon.lambda</groupId>
91-
<artifactId>powertools-metrics</artifactId>
92-
</aspectLibrary>
93-
</aspectLibraries>
94-
</configuration>
95-
<executions>
96-
<execution>
97-
<goals>
98-
<goal>compile</goal>
99-
</goals>
100-
</execution>
101-
</executions>
102-
<dependencies>
103-
<dependency>
104-
<groupId>org.aspectj</groupId>
105-
<artifactId>aspectjtools</artifactId>
106-
<version>${aspectj.version}</version>
107-
</dependency>
108-
</dependencies>
109-
</plugin>
110-
<plugin>
111-
<groupId>org.apache.maven.plugins</groupId>
112-
<artifactId>maven-shade-plugin</artifactId>
113-
<version>3.5.0</version>
114-
<executions>
115-
<execution>
116-
<phase>package</phase>
117-
<goals>
118-
<goal>shade</goal>
119-
</goals>
120-
<configuration>
121-
<transformers>
122-
<transformer implementation="org.apache.logging.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer"/>
123-
</transformers>
124-
</configuration>
125-
</execution>
126-
</executions>
127-
<dependencies>
128-
<dependency>
129-
<groupId>org.apache.logging.log4j</groupId>
130-
<artifactId>log4j-transform-maven-shade-plugin-extensions</artifactId>
131-
<version>0.1.0</version>
132-
</dependency>
133-
</dependencies>
134-
</plugin>
135-
<!-- Don't deploy the example -->
136-
<plugin>
137-
<groupId>org.apache.maven.plugins</groupId>
138-
<artifactId>maven-deploy-plugin</artifactId>
139-
<configuration>
140-
<skip>true</skip>
141-
</configuration>
142-
</plugin>
143-
</plugins>
71+
<finalName>helloworld-lambda</finalName>
72+
<plugins>
73+
<plugin>
74+
<groupId>dev.aspectj</groupId>
75+
<artifactId>aspectj-maven-plugin</artifactId>
76+
<version>1.13.1</version>
77+
<configuration>
78+
<source>${maven.compiler.source}</source>
79+
<target>${maven.compiler.target}</target>
80+
<complianceLevel>${maven.compiler.target}</complianceLevel>
81+
<aspectLibraries>
82+
<aspectLibrary>
83+
<groupId>software.amazon.lambda</groupId>
84+
<artifactId>powertools-tracing</artifactId>
85+
</aspectLibrary>
86+
<aspectLibrary>
87+
<groupId>software.amazon.lambda</groupId>
88+
<artifactId>powertools-logging</artifactId>
89+
</aspectLibrary>
90+
<aspectLibrary>
91+
<groupId>software.amazon.lambda</groupId>
92+
<artifactId>powertools-metrics</artifactId>
93+
</aspectLibrary>
94+
</aspectLibraries>
95+
</configuration>
96+
<executions>
97+
<execution>
98+
<goals>
99+
<goal>compile</goal>
100+
</goals>
101+
</execution>
102+
</executions>
103+
<dependencies>
104+
<dependency>
105+
<groupId>org.aspectj</groupId>
106+
<artifactId>aspectjtools</artifactId>
107+
<version>${aspectj.version}</version>
108+
</dependency>
109+
</dependencies>
110+
</plugin>
111+
<plugin>
112+
<groupId>org.apache.maven.plugins</groupId>
113+
<artifactId>maven-shade-plugin</artifactId>
114+
<version>3.5.0</version>
115+
<executions>
116+
<execution>
117+
<phase>package</phase>
118+
<goals>
119+
<goal>shade</goal>
120+
</goals>
121+
<configuration>
122+
<transformers>
123+
<transformer implementation="org.apache.logging.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer"/>
124+
</transformers>
125+
</configuration>
126+
</execution>
127+
</executions>
128+
<dependencies>
129+
<dependency>
130+
<groupId>org.apache.logging.log4j</groupId>
131+
<artifactId>log4j-transform-maven-shade-plugin-extensions</artifactId>
132+
<version>0.1.0</version>
133+
</dependency>
134+
</dependencies>
135+
</plugin>
136+
</plugins>
144137
</build>
145138
<profiles>
146139
<!-- Use a profile to enforce AspectJ version 1.9.7 if we are Java 1.8 otherwise we'll get class

examples/powertools-examples-core-utilities/cdk/app/src/main/java/helloworld/App.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,9 @@
4646
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
4747
private final static Logger log = LogManager.getLogger(App.class);
4848

49-
// This is controlled by POWERTOOLS_LOGGER_SAMPLE_RATE environment variable
50-
// @Logging(logEvent = true, samplingRate = 0.7)
51-
// This is controlled by POWERTOOLS_METRICS_NAMESPACE environment variable
52-
// @Metrics(namespace = "ServerlessAirline", service = "payment", captureColdStart = true)
53-
// This is controlled by POWERTOOLS_TRACER_CAPTURE_ERROR environment variable
49+
@Logging(logEvent = true, samplingRate = 0.7)
5450
@Tracing(captureMode = CaptureMode.RESPONSE_AND_ERROR)
51+
@Metrics(namespace = "ServerlessAirline", service = "payment", captureColdStart = true)
5552
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
5653
Map<String, String> headers = new HashMap<>();
5754

@@ -87,25 +84,18 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
8784
return response
8885
.withStatusCode(200)
8986
.withBody(output);
90-
<<<<<<<< HEAD:examples/powertools-examples-core-utilities/cdk/app/src/main/java/helloworld/App.java
9187
} catch (IOException e) {
92-
========
93-
} catch (RuntimeException | IOException e) {
94-
>>>>>>>> main:examples/powertools-examples-core/serverless/src/main/java/helloworld/App.java
9588
return response
9689
.withBody("{}")
9790
.withStatusCode(500);
9891
}
9992
}
10093

101-
<<<<<<<< HEAD:examples/powertools-examples-core-utilities/cdk/app/src/main/java/helloworld/App.java
10294
@Tracing
10395
private void log() {
10496
log.info("inside threaded logging for function");
10597
}
10698

107-
========
108-
>>>>>>>> main:examples/powertools-examples-core/serverless/src/main/java/helloworld/App.java
10999
@Tracing(namespace = "getPageContents", captureMode = CaptureMode.DISABLED)
110100
private String getPageContents(String address) throws IOException {
111101
URL url = new URL(address);

examples/powertools-examples-core-utilities/gradle/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You can also use `sam init` to create a new Gradle-powered Powertools applicatio
88
and then **Hello World Example with Powertools for AWS Lambda**, **Java 17** runtime, and finally **gradle**.
99

1010

11-
For general information on the deployed example itself, you can refer to the parent [README](../../powertools-examples-core/README.md)
11+
For general information on the deployed example itself, you can refer to the parent [README](../README.md)
1212

1313
## Configuration
1414
SAM uses [template.yaml](template.yaml) to define the application's AWS resources.

0 commit comments

Comments
 (0)