Skip to content

Commit bb173f6

Browse files
authored
Merge branch 'v2' into chore/remove-deprecated
2 parents 9f33633 + 57f3eff commit bb173f6

File tree

19 files changed

+60
-599
lines changed

19 files changed

+60
-599
lines changed

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
1414
with:
1515
distribution: 'corretto'
16-
java-version: 8
16+
java-version: 11
1717
server-id: ossrh
1818
server-username: MAVEN_USERNAME
1919
server-password: MAVEN_PASSWORD

.github/workflows/spotbugs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
26-
- name: Setup java JDK 1.8
26+
- name: Setup java JDK 11
2727
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
2828
with:
2929
distribution: 'corretto'

README.md

+7-81
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ Powertools for AWS Lambda (Java) is available in Maven Central. You can use your
3838
</dependencies>
3939
```
4040

41-
Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project. A different configuration is needed for projects on Java 8.
41+
Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project.
4242

4343
<details>
44-
<summary><b>Maven - Java 11 and newer</b></summary>
44+
<summary><b>Maven</b></summary>
4545

4646
```xml
4747
<build>
@@ -52,9 +52,9 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
5252
<artifactId>aspectj-maven-plugin</artifactId>
5353
<version>1.13.1</version>
5454
<configuration>
55-
<source>1.8</source>
56-
<target>1.8</target>
57-
<complianceLevel>1.8</complianceLevel>
55+
<source>11</source>
56+
<target>11</target>
57+
<complianceLevel>11</complianceLevel>
5858
<aspectLibraries>
5959
<aspectLibrary>
6060
<groupId>software.amazon.lambda</groupId>
@@ -85,51 +85,7 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
8585
</details>
8686

8787
<details>
88-
<summary><b>Maven - Java 8</b></summary>
89-
90-
```xml
91-
<build>
92-
<plugins>
93-
...
94-
<plugin>
95-
<groupId>org.codehaus.mojo</groupId>
96-
<artifactId>aspectj-maven-plugin</artifactId>
97-
<version>1.14.0</version>
98-
<configuration>
99-
<source>1.8</source>
100-
<target>1.8</target>
101-
<complianceLevel>1.8</complianceLevel>
102-
<aspectLibraries>
103-
<aspectLibrary>
104-
<groupId>software.amazon.lambda</groupId>
105-
<artifactId>powertools-logging</artifactId>
106-
</aspectLibrary>
107-
<aspectLibrary>
108-
<groupId>software.amazon.lambda</groupId>
109-
<artifactId>powertools-tracing</artifactId>
110-
</aspectLibrary>
111-
<aspectLibrary>
112-
<groupId>software.amazon.lambda</groupId>
113-
<artifactId>powertools-metrics</artifactId>
114-
</aspectLibrary>
115-
</aspectLibraries>
116-
</configuration>
117-
<executions>
118-
<execution>
119-
<goals>
120-
<goal>compile</goal>
121-
</goals>
122-
</execution>
123-
</executions>
124-
</plugin>
125-
...
126-
</plugins>
127-
</build>
128-
```
129-
</details>
130-
131-
<details>
132-
<summary><b>Gradle - Java 11+</b></summary>
88+
<summary><b>Gradle</b></summary>
13389

13490
```groovy
13591
@@ -160,38 +116,9 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
160116
```
161117
</details>
162118

163-
<details>
164-
<summary><b>Gradle - Java 8</b></summary>
165-
166-
```groovy
167-
plugins {
168-
id 'java'
169-
id 'io.freefair.aspectj.post-compile-weaving' version '6.6.3'
170-
}
171-
172-
// the freefair aspect plugins targets gradle 7.6.1
173-
// https://docs.freefair.io/gradle-plugins/6.6.3/reference/
174-
wrapper {
175-
gradleVersion = "7.6.1"
176-
}
177-
178-
repositories {
179-
mavenCentral()
180-
}
181-
182-
dependencies {
183-
aspect 'software.amazon.lambda:powertools-logging:{{ powertools.version }}'
184-
aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}'
185-
aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}'
186-
}
187-
188-
sourceCompatibility = 1.8
189-
targetCompatibility = 1.8
190-
```
191-
</details>
192119

193120
### Java Compatibility
194-
Powertools for AWS Lambda (Java) supports all Java version from 8 up to 21 as well as the
121+
Powertools for AWS Lambda (Java) supports all Java version from 11 up to 21 as well as the
195122
[corresponding Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
196123
For the modules that provide annotations, Powertools for AWS Lambda (Java) leverages the **aspectj** library.
197124
You may need to add the good version of `aspectjrt` to your dependencies based on the JDK used for building your function:
@@ -209,7 +136,6 @@ You may need to add the good version of `aspectjrt` to your dependencies based o
209136

210137
| JDK version | aspectj version |
211138
|-------------|-----------------|
212-
| `1.8` | `1.9.7` |
213139
| `11-17` | `1.9.20.1` |
214140
| `21` | `1.9.21` |
215141

docs/core/tracing.md

+2-70
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ a provides functionality to reduce the overhead of performing common tracing tas
1717

1818
## Install
1919

20-
Depending on your version of Java (either Java 1.8 or 11+), the configuration slightly changes.
21-
22-
=== "Maven Java 11+"
20+
=== "Maven"
2321

2422
```xml hl_lines="3-7 16 18 24-27"
2523
<dependencies>
@@ -64,52 +62,7 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
6462
</build>
6563
```
6664

67-
=== "Maven Java 1.8"
68-
69-
```xml hl_lines="3-7 16 18 24-27"
70-
<dependencies>
71-
...
72-
<dependency>
73-
<groupId>software.amazon.lambda</groupId>
74-
<artifactId>powertools-tracing</artifactId>
75-
<version>{{ powertools.version }}</version>
76-
</dependency>
77-
...
78-
</dependencies>
79-
...
80-
<!-- configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project -->
81-
<build>
82-
<plugins>
83-
...
84-
<plugin>
85-
<groupId>org.codehaus.mojo</groupId>
86-
<artifactId>aspectj-maven-plugin</artifactId>
87-
<version>1.14.0</version>
88-
<configuration>
89-
<source>1.8</source>
90-
<target>1.8</target>
91-
<complianceLevel>1.8</complianceLevel>
92-
<aspectLibraries>
93-
<aspectLibrary>
94-
<groupId>software.amazon.lambda</groupId>
95-
<artifactId>powertools-tracing</artifactId>
96-
</aspectLibrary>
97-
</aspectLibraries>
98-
</configuration>
99-
<executions>
100-
<execution>
101-
<goals>
102-
<goal>compile</goal>
103-
</goals>
104-
</execution>
105-
</executions>
106-
</plugin>
107-
...
108-
</plugins>
109-
</build>
110-
```
111-
112-
=== "Gradle Java 11+"
65+
=== "Gradle"
11366

11467
```groovy hl_lines="3 11"
11568
plugins {
@@ -129,27 +82,6 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
12982
targetCompatibility = 11
13083
```
13184

132-
=== "Gradle Java 1.8"
133-
134-
```groovy hl_lines="3 11"
135-
plugins {
136-
id 'java'
137-
id 'io.freefair.aspectj.post-compile-weaving' version '6.6.3'
138-
}
139-
140-
repositories {
141-
mavenCentral()
142-
}
143-
144-
dependencies {
145-
aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}'
146-
}
147-
148-
sourceCompatibility = 1.8
149-
targetCompatibility = 1.8
150-
```
151-
152-
15385
## Initialization
15486

15587
Before your use this utility, your AWS Lambda function [must have permissions](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-permissions) to send traces to AWS X-Ray.

docs/index.md

+12-108
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ Powertools for AWS Lambda (Java) dependencies are available in Maven Central. Yo
8686
* [Maven](https://maven.apache.org/)
8787
* [Gradle](https://gradle.org)
8888

89-
Depending on your version of Java (either Java 1.8 or 11+), the configuration slightly changes.
90-
91-
=== "Maven Java 11+"
89+
=== "Maven"
9290

9391
```xml
9492
<dependencies>
@@ -151,70 +149,7 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
151149
</build>
152150
```
153151

154-
=== "Maven Java 1.8"
155-
156-
```xml
157-
<dependencies>
158-
...
159-
<dependency>
160-
<groupId>software.amazon.lambda</groupId>
161-
<artifactId>powertools-tracing</artifactId>
162-
<version>{{ powertools.version }}</version>
163-
</dependency>
164-
<dependency>
165-
<groupId>software.amazon.lambda</groupId>
166-
<artifactId>powertools-logging</artifactId>
167-
<version>{{ powertools.version }}</version>
168-
</dependency>
169-
<dependency>
170-
<groupId>software.amazon.lambda</groupId>
171-
<artifactId>powertools-metrics</artifactId>
172-
<version>{{ powertools.version }}</version>
173-
</dependency>
174-
...
175-
</dependencies>
176-
...
177-
<!-- configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project -->
178-
<build>
179-
<plugins>
180-
...
181-
<plugin>
182-
<groupId>org.codehaus.mojo</groupId>
183-
<artifactId>aspectj-maven-plugin</artifactId>
184-
<version>1.14.0</version>
185-
<configuration>
186-
<source>1.8</source>
187-
<target>1.8</target>
188-
<complianceLevel>1.8</complianceLevel>
189-
<aspectLibraries>
190-
<aspectLibrary>
191-
<groupId>software.amazon.lambda</groupId>
192-
<artifactId>powertools-tracing</artifactId>
193-
</aspectLibrary>
194-
<aspectLibrary>
195-
<groupId>software.amazon.lambda</groupId>
196-
<artifactId>powertools-logging</artifactId>
197-
</aspectLibrary>
198-
<aspectLibrary>
199-
<groupId>software.amazon.lambda</groupId>
200-
<artifactId>powertools-metrics</artifactId>
201-
</aspectLibrary>
202-
</aspectLibraries>
203-
</configuration>
204-
<executions>
205-
<execution>
206-
<goals>
207-
<goal>compile</goal>
208-
</goals>
209-
</execution>
210-
</executions>
211-
</plugin>
212-
...
213-
</plugins>
214-
</build>
215-
```
216-
217-
=== "Gradle Java 11+"
152+
=== "Gradle"
218153

219154
```groovy
220155

@@ -243,36 +178,6 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
243178
targetCompatibility = 11
244179
```
245180

246-
=== "Gradle Java 1.8"
247-
248-
```groovy
249-
250-
plugins {
251-
id 'java'
252-
id 'io.freefair.aspectj.post-compile-weaving' version '6.6.3'
253-
}
254-
255-
// the freefair aspect plugins targets gradle 7.6.1
256-
// https://docs.freefair.io/gradle-plugins/6.6.3/reference/
257-
wrapper {
258-
gradleVersion = "7.6.1"
259-
}
260-
261-
262-
repositories {
263-
mavenCentral()
264-
}
265-
266-
dependencies {
267-
aspect 'software.amazon.lambda:powertools-logging:{{ powertools.version }}'
268-
aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}'
269-
aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}'
270-
}
271-
272-
sourceCompatibility = 1.8
273-
targetCompatibility = 1.8
274-
```
275-
276181
???+ tip "Why a different configuration?"
277182
Powertools for AWS Lambda (Java) is using [AspectJ](https://eclipse.dev/aspectj/doc/released/progguide/starting.html) internally
278183
to handle annotations. Recently, in order to support Java 17 we had to move to `dev.aspectj:aspectj-maven-plugin` because
@@ -281,7 +186,7 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
281186
while `dev.aspectj:aspectj-maven-plugin` is based on AspectJ 1.9.8, compiled for Java 11+.
282187

283188
### Java Compatibility
284-
Powertools for AWS Lambda (Java) supports all Java version from 8 up to 21 as well as the
189+
Powertools for AWS Lambda (Java) supports all Java version from 11 up to 21 as well as the
285190
[corresponding Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
286191

287192
For the following modules, Powertools for AWS Lambda (Java) leverages the **aspectj** library to provide annotations:
@@ -308,7 +213,6 @@ Use the following [dependency matrix](https://github.com/eclipse-aspectj/aspectj
308213

309214
| JDK version | aspectj version |
310215
|-------------|-----------------|
311-
| `1.8` | `1.9.7` |
312216
| `11-17` | `1.9.20.1` |
313217
| `21` | `1.9.21` |
314218

@@ -317,13 +221,13 @@ Use the following [dependency matrix](https://github.com/eclipse-aspectj/aspectj
317221
!!! info
318222
**Explicit parameters take precedence over environment variables.**
319223

320-
| Environment variable | Description | Utility |
321-
| ------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
322-
| **POWERTOOLS_SERVICE_NAME** | Sets service name used for tracing namespace, metrics dimension and structured logging | All |
323-
| **POWERTOOLS_METRICS_NAMESPACE** | Sets namespace used for metrics | [Metrics](./core/metrics) |
324-
| **POWERTOOLS_LOGGER_SAMPLE_RATE** | Debug log sampling | [Logging](./core/logging) |
325-
| **POWERTOOLS_LOG_LEVEL** | Sets logging level | [Logging](./core/logging) |
326-
| **POWERTOOLS_LOGGER_LOG_EVENT** | Enables/Disables whether to log the incoming event when using the aspect | [Logging](./core/logging) |
327-
| **POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Enables/Disables tracing mode to capture method response | [Tracing](./core/tracing) |
328-
| **POWERTOOLS_TRACER_CAPTURE_ERROR** | Enables/Disables tracing mode to capture method error | [Tracing](./core/tracing) |
224+
| Environment variable | Description | Utility |
225+
|----------------------------------------|----------------------------------------------------------------------------------------|---------------------------|
226+
| **POWERTOOLS_SERVICE_NAME** | Sets service name used for tracing namespace, metrics dimension and structured logging | All |
227+
| **POWERTOOLS_METRICS_NAMESPACE** | Sets namespace used for metrics | [Metrics](./core/metrics) |
228+
| **POWERTOOLS_LOGGER_SAMPLE_RATE** | Debug log sampling | [Logging](./core/logging) |
229+
| **POWERTOOLS_LOG_LEVEL** | Sets logging level | [Logging](./core/logging) |
230+
| **POWERTOOLS_LOGGER_LOG_EVENT** | Enables/Disables whether to log the incoming event when using the aspect | [Logging](./core/logging) |
231+
| **POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Enables/Disables tracing mode to capture method response | [Tracing](./core/tracing) |
232+
| **POWERTOOLS_TRACER_CAPTURE_ERROR** | Enables/Disables tracing mode to capture method error | [Tracing](./core/tracing) |
329233

0 commit comments

Comments
 (0)