From 5b370d6a778b2c1e12584385cdda395856664acd Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 24 Jun 2024 12:05:46 +0200
Subject: [PATCH 1/6] build(deps-dev): bump
com.amazonaws:amazon-sqs-java-extended-client-lib (#1650)
Bumps [com.amazonaws:amazon-sqs-java-extended-client-lib](https://github.com/awslabs/amazon-sqs-java-extended-client-lib) from 2.0.4 to 2.1.0.
---
powertools-e2e-tests/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/powertools-e2e-tests/pom.xml b/powertools-e2e-tests/pom.xml
index f4aaf3715..6eb67d4d5 100644
--- a/powertools-e2e-tests/pom.xml
+++ b/powertools-e2e-tests/pom.xml
@@ -84,7 +84,7 @@
com.amazonaws
amazon-sqs-java-extended-client-lib
- 2.0.4
+ 2.1.0
test
From 8a1092185e546af3d33f3afb2c6d9a51ed50f4e8 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 24 Jun 2024 11:32:16 +0000
Subject: [PATCH 2/6] build(deps): bump aws.sdk.version from 2.25.26 to 2.26.7
(#1660)
Bumps `aws.sdk.version` from 2.25.26 to 2.26.7.
Updates `software.amazon.awssdk:url-connection-client` from 2.25.26 to 2.26.7
Updates `software.amazon.awssdk:sdk-core` from 2.25.26 to 2.26.7
Updates `software.amazon.awssdk:kinesis` from 2.25.26 to 2.26.7
Updates `software.amazon.awssdk:sqs` from 2.25.26 to 2.26.7
Updates `software.amazon.awssdk:dynamodb-enhanced` from 2.25.26 to 2.26.7
---
updated-dependencies:
- dependency-name: software.amazon.awssdk:url-connection-client
dependency-type: direct:development
update-type: version-update:semver-minor
- dependency-name: software.amazon.awssdk:sdk-core
dependency-type: direct:production
update-type: version-update:semver-minor
- dependency-name: software.amazon.awssdk:kinesis
dependency-type: direct:development
update-type: version-update:semver-minor
- dependency-name: software.amazon.awssdk:sqs
dependency-type: direct:development
update-type: version-update:semver-minor
- dependency-name: software.amazon.awssdk:dynamodb-enhanced
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
examples/powertools-examples-batch/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/powertools-examples-batch/pom.xml b/examples/powertools-examples-batch/pom.xml
index 3d94982fd..b9a523d04 100644
--- a/examples/powertools-examples-batch/pom.xml
+++ b/examples/powertools-examples-batch/pom.xml
@@ -14,7 +14,7 @@
11
11
1.9.20.1
- 2.25.26
+ 2.26.7
From 814b3fbae9b3482b61f8a0ae8bacb0c44416bd6d Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 24 Jun 2024 11:33:16 +0000
Subject: [PATCH 3/6] build(deps): bump
software.amazon.payloadoffloading:payloadoffloading-common (#1661)
Bumps [software.amazon.payloadoffloading:payloadoffloading-common](https://github.com/awslabs/payload-offloading-java-common-lib-for-aws) from 2.1.3 to 2.2.0.
- [Release notes](https://github.com/awslabs/payload-offloading-java-common-lib-for-aws/releases)
- [Commits](https://github.com/awslabs/payload-offloading-java-common-lib-for-aws/compare/v2.1.3...v2.2.0)
---
updated-dependencies:
- dependency-name: software.amazon.payloadoffloading:payloadoffloading-common
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index d96c51d2f..61946007a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,7 +73,7 @@
2.17.0
2.25.35
2.15.1
- 2.1.3
+ 2.2.0
UTF-8
1.2.3
3.11.2
From 1074aab205149b89423e82e1e6738690357c9d98 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 24 Jun 2024 11:34:13 +0000
Subject: [PATCH 4/6] build(deps): bump jackson.version from 2.17.0 to 2.17.1
(#1664)
Bumps `jackson.version` from 2.17.0 to 2.17.1.
Updates `com.fasterxml.jackson.core:jackson-databind` from 2.17.0 to 2.17.1
- [Commits](https://github.com/FasterXML/jackson/commits)
Updates `com.fasterxml.jackson.core:jackson-core` from 2.17.0 to 2.17.1
- [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.17.0...jackson-core-2.17.1)
Updates `com.fasterxml.jackson.datatype:jackson-datatype-jsr310` from 2.17.0 to 2.17.1
---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-databind
dependency-type: direct:production
update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.core:jackson-core
dependency-type: direct:production
update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jsr310
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 61946007a..0b51e0086 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,7 +70,7 @@
2.20.0
2.23.1
2.0.7
- 2.17.0
+ 2.17.1
2.25.35
2.15.1
2.2.0
From 42b8325b893d2bfe5c413388ed427e76c64f3d29 Mon Sep 17 00:00:00 2001
From: jdoherty
Date: Mon, 24 Jun 2024 12:37:04 +0100
Subject: [PATCH 5/6] feat: upgraded embedded metrics library for high
resolution metrics (#1550)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* upgraded embedded metrics library and associated tests
* Removing LambdaJsonLayout from logging in examples (#1545)
* updated formatting and changed assertion for sonar
* fix example
* do not build on java 8 for v2 (oopsy)
* spotbugs fix
* update documentation
---------
Co-authored-by: ritigupt <102658810+ritigupt@users.noreply.github.com>
Co-authored-by: Scott Gerring
Co-authored-by: Jerome Van Der Linden
Co-authored-by: Jérôme Van Der Linden <117538+jeromevdl@users.noreply.github.com>
---
docs/core/metrics.md | 112 ++++++------------
.../sam/src/main/java/helloworld/App.java | 3 +
pom.xml | 2 +-
.../lambda/powertools/e2e/Function.java | 14 ++-
.../amazon/lambda/powertools/e2e/Input.java | 10 ++
.../amazon/lambda/powertools/MetricsE2ET.java | 39 +++++-
.../powertools/metrics/MetricsLoggerTest.java | 11 ++
...rtoolsMetricsTooManyDimensionsHandler.java | 11 +-
.../internal/LambdaMetricsAspectTest.java | 6 +-
spotbugs-exclude.xml | 4 +
10 files changed, 123 insertions(+), 89 deletions(-)
diff --git a/docs/core/metrics.md b/docs/core/metrics.md
index e06ab6d10..165c26e1c 100644
--- a/docs/core/metrics.md
+++ b/docs/core/metrics.md
@@ -28,9 +28,7 @@ If you're new to Amazon CloudWatch, there are two terminologies you must be awar
## Install
- Depending on your version of Java (either Java 1.8 or 11+), the configuration slightly changes.
-
-=== "Maven Java 11+"
+=== "Maven"
```xml hl_lines="3-7 16 18 24-27"
@@ -75,52 +73,7 @@ If you're new to Amazon CloudWatch, there are two terminologies you must be awar
```
-=== "Maven Java 1.8"
-
- ```xml hl_lines="3-7 16 18 24-27"
-
- ...
-
- software.amazon.lambda
- powertools-metrics
- {{ powertools.version }}
-
- ...
-
- ...
-
-
-
- ...
-
- org.codehaus.mojo
- aspectj-maven-plugin
- 1.14.0
-
- 1.8
- 1.8
- 1.8
-
-
- software.amazon.lambda
- powertools-metrics
-
-
-
-
-
-
- compile
-
-
-
-
- ...
-
-
- ```
-
-=== "Gradle Java 11+"
+=== "Gradle"
```groovy hl_lines="3 11"
plugins {
@@ -140,34 +93,14 @@ If you're new to Amazon CloudWatch, there are two terminologies you must be awar
targetCompatibility = 11
```
-=== "Gradle Java 1.8"
-
- ```groovy hl_lines="3 11"
- plugins {
- id 'java'
- id 'io.freefair.aspectj.post-compile-weaving' version '6.6.3'
- }
-
- repositories {
- mavenCentral()
- }
-
- dependencies {
- aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}'
- }
-
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
- ```
-
## Getting started
Metric has two global settings that will be used across all metrics emitted:
-Setting | Description | Environment variable | Constructor parameter
-------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | -------------------------------------------------
-**Metric namespace** | Logical container where all metrics will be placed e.g. `ServerlessAirline` | `POWERTOOLS_METRICS_NAMESPACE` | `namespace`
-**Service** | Optionally, sets **service** metric dimension across all metrics e.g. `payment` | `POWERTOOLS_SERVICE_NAME` | `service`
+| Setting | Description | Environment variable | Constructor parameter |
+|----------------------|---------------------------------------------------------------------------------|--------------------------------|-----------------------|
+| **Metric namespace** | Logical container where all metrics will be placed e.g. `ServerlessAirline` | `POWERTOOLS_METRICS_NAMESPACE` | `namespace` |
+| **Service** | Optionally, sets **service** metric dimension across all metrics e.g. `payment` | `POWERTOOLS_SERVICE_NAME` | `service` |
!!! tip "Use your application or main service as the metric namespace to easily group all metrics"
@@ -198,7 +131,7 @@ Setting | Description | Environment variable | Constructor parameter
@Override
@Metrics(namespace = "ExampleApplication", service = "booking")
public Object handleRequest(Object input, Context context) {
- ...
+ // ...
}
}
```
@@ -224,7 +157,7 @@ You can create metrics using `putMetric`, and manually create dimensions for all
public Object handleRequest(Object input, Context context) {
metricsLogger.putDimensions(DimensionSet.of("environment", "prod"));
metricsLogger.putMetric("SuccessfulBooking", 1, Unit.COUNT);
- ...
+ // ...
}
}
```
@@ -234,6 +167,35 @@ You can create metrics using `putMetric`, and manually create dimensions for all
!!! note "Metrics overflow"
CloudWatch EMF supports a max of 100 metrics. Metrics utility will flush all metrics when adding the 100th metric while subsequent metrics will be aggregated into a new EMF object, for your convenience.
+
+### Adding high-resolution metrics
+
+You can create [high-resolution metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html#high-resolution-metrics)
+passing a `storageResolution` to the `putMetric` method:
+
+=== "HigResMetricsHandler.java"
+
+ ```java hl_lines="3 13"
+ import software.amazon.lambda.powertools.metrics.Metrics;
+ import software.amazon.cloudwatchlogs.emf.logger.MetricsLogger;
+ import software.amazon.cloudwatchlogs.emf.model.StorageResolution;
+
+ public class MetricsEnabledHandler implements RequestHandler