Skip to content

Commit d0c100b

Browse files
committed
Merge main into v2
2 parents 3afb1d2 + 76cd363 commit d0c100b

34 files changed

Lines changed: 702 additions & 72 deletions

File tree

.github/workflows/pr_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
strategy:
5050
max-parallel: 5
5151
matrix:
52-
java: [8, 11, 17, 21, 15, 16, 18, 19, 20]
52+
java: [8, 11, 17, 21]
5353
name: Java ${{ matrix.java }}
5454
env:
5555
JAVA: ${{ matrix.java }}

.github/workflows/run-e2e-tests.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@ jobs:
3333
e2e:
3434
runs-on: ubuntu-latest
3535
strategy:
36-
max-parallel: 3
36+
max-parallel: 4
3737
matrix:
38-
java: [ 8, 11, 17 ]
38+
java: [ 8, 11, 17, 21 ]
3939
name: End-to-end tests java${{ matrix.java }}
4040
env:
41-
JAVA_VERSION: ${{ matrix.java }}
4241
AWS_DEFAULT_REGION: eu-west-1
42+
43+
# If matrix.version is 21, use 17, otherwise use matrix.version
44+
# This is because AspectJ does not yet support weaving with Java21; we want
45+
# to test the Java21 runtime, but we can't yet use the JDK21 compiler.
46+
# https://github.com/eclipse-aspectj/aspectj/issues/260#issuecomment-1815920274
47+
JAVA_VERSION: ${{ (matrix.java == 21 && '17') || matrix.java }}
48+
JAVA_LAMBDA_RUNTIME_VERSION: ${{ matrix.java }}
4349
permissions:
4450
id-token: write # needed to interact with GitHub's OIDC Token endpoint.
4551
contents: read
@@ -49,7 +55,8 @@ jobs:
4955
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
5056
with:
5157
distribution: 'corretto'
52-
java-version: ${{ matrix.java }}
58+
# See comment above on JAVA_VERSION env var
59+
java-version: ${{ (matrix.java == 21 && '17') || matrix.java }}
5360
cache: maven
5461
- name: Setup AWS credentials
5562
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,37 @@ This project follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) fo
88

99
## [Unreleased]
1010

11+
## [1.18.0] - 2023-11-16
12+
13+
### Added
14+
15+
* feat: add support for [Lambda Advanced Logging Controls (ALC)](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html#monitoring-cloudwatchlogs-advanced) (#1514) by @jeromevdl
16+
* feat: Add support for POWERTOOLS_LOGGER_LOG_EVENT (#1510) by @AlexeySoshin
17+
18+
### Maintenance
19+
20+
* fix: json schema 403 error (#1457) by @jeromevdl
21+
* fix: array jmespath fail in idempotency module (#1420) by @jeromevdl
22+
* chore: java21 support in our build (#1488) by @jeromevdl
23+
* chore: Addition of Warn Message If Invalid Annotation Key While Tracing #1511 (#1512) by @jdoherty
24+
* fix: null namespace should fallback to default namespace (#1506) by @jeromevdl
25+
* fix: get trace id from system property when env var is not set (#1503) by @mriccia
26+
* chore: artifacts size on good branches (#1493) by @jeromevdl
27+
* fix: enforce jackson databind version (#1472) by @jeromevdl
28+
* chore: add missing projects and improve workflow (#1487) by @jeromevdl
29+
* chore: Reporting size of the jars in GitHub comments (#1196) by @jeromevdl
30+
* Deps: Bump third party dependencies to the latest versions.
31+
32+
### Documentation
33+
34+
* docs(customer-reference): add Vertex Pharmaceuticals as a customer reference (#1486) by @scottgerring
35+
* docs: Adding Kotlin example. (#1454) by @jasoniharris
36+
* docs: Terraform example (#1478) by @skal111
37+
* docs: Add Serveless Framework example (#1363) by @AlexeySoshin
38+
* docs: Fix link to SQS large message migration guide (#1422) by @scottgerring
39+
* docs(logging): correct log example keys (#1411) by @walmsles
40+
* docs: Update gradle configuration readme (#1359) by @scottgerring
41+
1142
## [1.17.0] - 2023-08-21
1243

1344
### Added

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ We strongly recommend installing the CheckStyle-IDEA plugin and apply the provid
5555
2. After installing the plugin, open the preferences (`⌘,` on macOS, or `Ctrl+Alt+S` on Windows/Linux) and search for _Code Style_. Click on the gear icon near the scheme and import checkstyle configuration. Click on "Apply" and "OK".
5656
![](docs/media/intellij_checkstyle_1.png)
5757

58-
3. Select the code you've created (module, package, class) and reformat code: `⌘⌥L` (macOS), or `Ctrl+Alt+L` (Windows/Linux):
59-
![](docs/media/intellij_checkstyle_2.png)
58+
3. Select the code you've created (module, package, class) and reformat code: `⌘⌥L` (macOS), or `Ctrl+Alt+L` (Windows/Linux).
6059

6160
4. Apply the reformat, optimize imports, rearrange and cleanup to your code and only to java files:
6261
![](docs/media/intellij_checkstyle_3.png)

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ Powertools for AWS Lambda (Java) is a developer toolkit to implement Serverless
1111
1212
**[📜Documentation](https://docs.powertools.aws.dev/lambda-java/)** | **[Feature request](https://github.com/aws-powertools/powertools-lambda-java/issues/new?assignees=&labels=feature-request%2C+triage&template=feature_request.md&title=)** | **[🐛Bug Report](https://github.com/aws-powertools/powertools-lambda-java/issues/new?assignees=&labels=bug%2C+triage&template=bug_report.md&title=)** | **[Detailed blog post](https://aws.amazon.com/blogs/opensource/simplifying-serverless-best-practices-with-aws-lambda-powertools-java/)**
1313

14+
### Java Compatibility
15+
Powertools for AWS Lambda (Java) supports all Java version from 8 up to 21 as well as the
16+
[corresponding Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
17+
18+
AspectJ does not yet support Java 21 [[1]](https://github.com/eclipse-aspectj/aspectj/issues/260), [[2]](https://github.com/eclipse-aspectj/aspectj/blob/master/docs/dist/doc/JavaVersionCompatibility.md).
19+
If you need to use aspects - either Powertools features leveraging aspects or other libraries - you should use the JDK 17 compiler and target either the Java 17 or Java 21
20+
Lambda runtimes.
21+
1422
### Installation
1523

1624
Powertools for AWS Lambda (Java) is available in Maven Central. You can use your favourite dependency management tool to install it
@@ -22,17 +30,17 @@ Powertools for AWS Lambda (Java) is available in Maven Central. You can use your
2230
<dependency>
2331
<groupId>software.amazon.lambda</groupId>
2432
<artifactId>powertools-tracing</artifactId>
25-
<version>1.17.0</version>
33+
<version>1.18.0</version>
2634
</dependency>
2735
<dependency>
2836
<groupId>software.amazon.lambda</groupId>
2937
<artifactId>powertools-logging</artifactId>
30-
<version>1.17.0</version>
38+
<version>1.18.0</version>
3139
</dependency>
3240
<dependency>
3341
<groupId>software.amazon.lambda</groupId>
3442
<artifactId>powertools-metrics</artifactId>
35-
<version>1.17.0</version>
43+
<version>1.18.0</version>
3644
</dependency>
3745
...
3846
</dependencies>
@@ -192,7 +200,7 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
192200

193201
## Examples
194202

195-
See the latest release of the **[examples](https://github.com/aws-powertools/powertools-lambda-java/tree/v1.17.0/examples)** for example projects showcasing usage of different utilities.
203+
See the latest release of the **[examples](https://github.com/aws-powertools/powertools-lambda-java/tree/v1.18.0/examples)** for example projects showcasing usage of different utilities.
196204

197205
Have a demo project to contribute which showcase usage of different utilities from powertools? We are happy to accept it [here](CONTRIBUTING.md#security-issue-notifications).
198206

docs/core/logging.md

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,7 @@ Key | Type | Example | Description
217217

218218
## Capturing context Lambda info
219219

220-
You can enrich your structured logs with key Lambda context information via `logEvent` annotation parameter.
221-
You can also explicitly log any incoming event using `logEvent` param. Refer [Override default object mapper](#override-default-object-mapper)
222-
to customise what is logged.
220+
When debugging in non-production environments, you can instruct Logger to log the incoming event with `@Logger(logEvent = true)` or via `POWERTOOLS_LOGGER_LOG_EVENT=true` environment variable.
223221

224222
!!! warning
225223
Log event is disabled by default to prevent sensitive info being logged.
@@ -265,7 +263,7 @@ to customise what is logged.
265263
}
266264
```
267265

268-
### Customising fields in logs
266+
### Customising fields in logs
269267

270268
- Utility by default emits `timestamp` field in the logs in format `yyyy-MM-dd'T'HH:mm:ss.SSSZz` and in system default timezone.
271269
If you need to customize format and timezone, you can do so by configuring `log4j2.component.properties` and configuring properties as shown in example below:
@@ -598,6 +596,48 @@ via `samplingRate` attribute on annotation.
598596
POWERTOOLS_LOGGER_SAMPLE_RATE: 0.5
599597
```
600598

599+
## AWS Lambda Advanced Logging Controls
600+
With AWS [Lambda Advanced Logging Controls (ALC)](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html#monitoring-cloudwatchlogs-advanced), you can control the output format of your logs as either `TEXT` or `JSON` and specify the minimum accepted log level for your application.
601+
Regardless of the output format setting in Lambda, Powertools for AWS Lambda will always output JSON formatted logging messages.
602+
603+
When you have this feature enabled, log messages that don’t meet the configured log level are discarded by Lambda.
604+
For example, if you set the minimum log level to `WARN`, you will only receive `WARN` and `ERROR` messages in your AWS CloudWatch Logs, all other log levels will be discarded by Lambda.
605+
606+
```mermaid
607+
sequenceDiagram
608+
participant Lambda service
609+
participant Lambda function
610+
participant Application Logger
611+
612+
Note over Lambda service: AWS_LAMBDA_LOG_LEVEL="WARN"
613+
Lambda service->>Lambda function: Invoke (event)
614+
Lambda function->>Lambda function: Calls handler
615+
Lambda function->>Application Logger: logger.warn("Something happened")
616+
Lambda function-->>Application Logger: logger.debug("Something happened")
617+
Lambda function-->>Application Logger: logger.info("Something happened")
618+
619+
Lambda service->>Lambda service: DROP INFO and DEBUG logs
620+
621+
Lambda service->>CloudWatch Logs: Ingest error logs
622+
```
623+
624+
Logger will automatically listen for the `AWS_LAMBDA_LOG_FORMAT` and `AWS_LAMBDA_LOG_LEVEL` environment variables, and change behaviour if they’re found to ensure as much compatibility as possible.
625+
626+
### Priority of log level settings in Powertools for AWS Lambda
627+
628+
When the Advanced Logging Controls feature is enabled, we are unable to increase the minimum log level below the `AWS_LAMBDA_LOG_LEVEL` environment variable value, see [AWS Lambda service documentation](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html#monitoring-cloudwatchlogs-log-level) for more details.
629+
630+
We prioritise log level settings in this order:
631+
632+
1. `AWS_LAMBDA_LOG_LEVEL` environment variable
633+
2. `POWERTOOLS_LOG_LEVEL` environment variable
634+
635+
In the event you have set `POWERTOOLS_LOG_LEVEL` to a level lower than the ACL setting, Powertools for AWS Lambda will output a warning log message informing you that your messages will be discarded by Lambda.
636+
637+
### Timestamp format
638+
639+
When the Advanced Logging Controls feature is enabled, Powertools for AWS Lambda must comply with the timestamp format required by AWS Lambda, which is [RFC3339](https://www.rfc-editor.org/rfc/rfc3339).
640+
In this case the format will be `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`.
601641

602642
## Upgrade to JsonTemplateLayout from deprecated LambdaJsonLayout configuration in log4j2.xml
603643

docs/index.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ Powertools for AWS Lambda (Java) is a suite of utilities for AWS Lambda Function
1111
Powertools for AWS Lambda is also available for [Python](https://docs.powertools.aws.dev/lambda/python/latest/){target="_blank"}, [TypeScript](https://docs.powertools.aws.dev/lambda/typescript/latest/){target="_blank"}, and [.NET](https://docs.powertools.aws.dev/lambda/dotnet/){target="_blank"}
1212

1313

14-
!!! tip "Looking for a quick run through of the core utilities?"
14+
???+ tip "Looking for a quick run through of the core utilities?"
1515
Check out [this detailed blog post](https://aws.amazon.com/blogs/opensource/simplifying-serverless-best-practices-with-aws-lambda-powertools-java/) with a practical example. To dive deeper,
1616
the [Powertools for AWS Lambda (Java) workshop](https://catalog.us-east-1.prod.workshops.aws/workshops/a7011c82-e4af-4a52-80fa-fcd61f1dacd9/en-US/introduction) is a great next step.
1717

18+
???+ tip "Java Compatability"
19+
Powertools for AWS Lambda (Java) supports all Java version from 8 up to 21 as well as the
20+
[corresponding Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
21+
22+
AspectJ does not yet support Java 21 [[1]](https://github.com/eclipse-aspectj/aspectj/issues/260), [[2]](https://github.com/eclipse-aspectj/aspectj/blob/master/docs/dist/doc/JavaVersionCompatibility.md).
23+
If you need to use aspects - either Powertools features leveraging aspects or other libraries - you should use the JDK 17 compiler and target either the Java 17 or Java 21
24+
Lambda runtimes.
25+
1826
## Tenets
1927

2028
This project separates core utilities that will be available in other runtimes vs general utilities that might not be available across all runtimes.
@@ -285,5 +293,7 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
285293
| **POWERTOOLS_METRICS_NAMESPACE** | Sets namespace used for metrics | [Metrics](./core/metrics) |
286294
| **POWERTOOLS_LOGGER_SAMPLE_RATE** | Debug log sampling | [Logging](./core/logging) |
287295
| **POWERTOOLS_LOG_LEVEL** | Sets logging level | [Logging](./core/logging) |
296+
| **POWERTOOLS_LOGGER_LOG_EVENT** | Enables/Disables whether to log the incoming event when using the aspect | [Logging](./core/logging) |
288297
| **POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Enables/Disables tracing mode to capture method response | [Tracing](./core/tracing) |
289298
| **POWERTOOLS_TRACER_CAPTURE_ERROR** | Enables/Disables tracing mode to capture method error | [Tracing](./core/tracing) |
299+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<version>2.0.0-SNAPSHOT</version>
88
<properties>
99
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10-
<cdk.version>2.93.0</cdk.version>
10+
<cdk.version>2.100.0</cdk.version>
1111
<constructs.version>[10.0.0,11.0.0)</constructs.version>
1212
<junit.version>5.10.0</junit.version>
1313
</properties>

examples/powertools-examples-core-utilities/gradle/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ compileJava {
1818
}
1919

2020
repositories {
21+
mavenLocal()
2122
mavenCentral()
2223
}
2324

@@ -27,8 +28,8 @@ dependencies {
2728
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
2829
implementation 'com.amazonaws:aws-lambda-java-events:3.11.0'
2930
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2'
30-
aspect 'software.amazon.lambda:powertools-tracing:1.17.0'
31-
aspect 'software.amazon.lambda:powertools-logging:1.17.0'
32-
aspect 'software.amazon.lambda:powertools-metrics:1.17.0'
31+
aspect 'software.amazon.lambda:powertools-tracing:1.19.0-SNAPSHOT'
32+
aspect 'software.amazon.lambda:powertools-logging:1.19.0-SNAPSHOT'
33+
aspect 'software.amazon.lambda:powertools-metrics:1.19.0-SNAPSHOT'
3334
}
3435

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ extra_javascript:
8585

8686
extra:
8787
powertools:
88-
version: 1.17.0 # to update after each release (we do not want snapshot version here)
88+
version: 1.18.0 # to update after each release (we do not want snapshot version here)
8989

9090
repo_url: https://github.com/aws-powertools/powertools-lambda-java
9191
edit_uri: edit/main/docs

0 commit comments

Comments
 (0)