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 1/5] 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 2/5] 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 3/5] 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 4/5] 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 { + + MetricsLogger metricsLogger = MetricsUtils.metricsLogger(); + + @Override + @Metrics(namespace = "ExampleApplication", service = "booking") + public Object handleRequest(Object input, Context context) { + // ... + metricsLogger.putMetric("SuccessfulBooking", 1, Unit.COUNT, StorageResolution.HIGH); + } + } + ``` + +!!! info "When is it useful?" + High-resolution metrics are data with a granularity of one second and are very useful in several situations such as telemetry, time series, real-time incident management, and others. + ### Flushing metrics The `@Metrics` annotation **validates**, **serializes**, and **flushes** all your metrics. During metrics validation, diff --git a/examples/powertools-examples-core-utilities/sam/src/main/java/helloworld/App.java b/examples/powertools-examples-core-utilities/sam/src/main/java/helloworld/App.java index b1a701b8f..e7c410042 100644 --- a/examples/powertools-examples-core-utilities/sam/src/main/java/helloworld/App.java +++ b/examples/powertools-examples-core-utilities/sam/src/main/java/helloworld/App.java @@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory; import org.slf4j.MDC; import software.amazon.cloudwatchlogs.emf.model.DimensionSet; +import software.amazon.cloudwatchlogs.emf.model.StorageResolution; import software.amazon.cloudwatchlogs.emf.model.Unit; import software.amazon.lambda.powertools.logging.Logging; import software.amazon.lambda.powertools.metrics.Metrics; @@ -64,6 +65,8 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv metric.setDimensions(DimensionSet.of("AnotherService1", "CustomService1")); }); + metricsLogger().putMetric("CustomMetric3", 1, Unit.COUNT, StorageResolution.HIGH); + MDC.put("test", "willBeLogged"); APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent() diff --git a/pom.xml b/pom.xml index 0b51e0086..168243622 100644 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ 3.3.0 3.2.4 5.10.2 - 1.0.6 + 4.1.2 0.6.0 1.6.0 diff --git a/powertools-e2e-tests/handlers/metrics/src/main/java/software/amazon/lambda/powertools/e2e/Function.java b/powertools-e2e-tests/handlers/metrics/src/main/java/software/amazon/lambda/powertools/e2e/Function.java index d9cf575c3..a86e515f7 100644 --- a/powertools-e2e-tests/handlers/metrics/src/main/java/software/amazon/lambda/powertools/e2e/Function.java +++ b/powertools-e2e-tests/handlers/metrics/src/main/java/software/amazon/lambda/powertools/e2e/Function.java @@ -18,9 +18,15 @@ import com.amazonaws.services.lambda.runtime.RequestHandler; import software.amazon.cloudwatchlogs.emf.logger.MetricsLogger; import software.amazon.cloudwatchlogs.emf.model.DimensionSet; +import software.amazon.cloudwatchlogs.emf.model.StorageResolution; import software.amazon.cloudwatchlogs.emf.model.Unit; import software.amazon.lambda.powertools.metrics.Metrics; import software.amazon.lambda.powertools.metrics.MetricsUtils; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.time.temporal.ChronoUnit; +import java.time.Instant; + public class Function implements RequestHandler { @@ -29,11 +35,17 @@ public class Function implements RequestHandler { @Metrics(captureColdStart = true) public String handleRequest(Input input, Context context) { + Instant currentTimeTruncatedPlusThirty = + LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES).toInstant(ZoneOffset.UTC).plusSeconds(30); + metricsLogger.setTimestamp(currentTimeTruncatedPlusThirty); + DimensionSet dimensionSet = new DimensionSet(); input.getDimensions().forEach((key, value) -> dimensionSet.addDimension(key, value)); metricsLogger.putDimensions(dimensionSet); - input.getMetrics().forEach((key, value) -> metricsLogger.putMetric(key, value, Unit.COUNT)); + input.getMetrics().forEach((key, value) -> metricsLogger.putMetric(key, value, Unit.COUNT, + input.getHighResolution().equalsIgnoreCase("true") ? StorageResolution.HIGH : + StorageResolution.STANDARD)); return "OK"; } diff --git a/powertools-e2e-tests/handlers/metrics/src/main/java/software/amazon/lambda/powertools/e2e/Input.java b/powertools-e2e-tests/handlers/metrics/src/main/java/software/amazon/lambda/powertools/e2e/Input.java index 18c4eb747..1328ded77 100644 --- a/powertools-e2e-tests/handlers/metrics/src/main/java/software/amazon/lambda/powertools/e2e/Input.java +++ b/powertools-e2e-tests/handlers/metrics/src/main/java/software/amazon/lambda/powertools/e2e/Input.java @@ -21,6 +21,8 @@ public class Input { private Map dimensions; + private String highResolution; + public Input() { } @@ -32,6 +34,14 @@ public void setMetrics(Map metrics) { this.metrics = metrics; } + public String getHighResolution() { + return highResolution; + } + + public void setHighResolution(String highResolution) { + this.highResolution = highResolution; + } + public Map getDimensions() { return dimensions; } diff --git a/powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/MetricsE2ET.java b/powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/MetricsE2ET.java index 80673b995..235255dff 100644 --- a/powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/MetricsE2ET.java +++ b/powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/MetricsE2ET.java @@ -18,6 +18,10 @@ import static software.amazon.lambda.powertools.testutils.Infrastructure.FUNCTION_NAME_OUTPUT; import static software.amazon.lambda.powertools.testutils.lambda.LambdaInvoker.invokeFunction; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.time.temporal.ChronoUnit; import java.util.Collections; import java.util.List; import java.util.Map; @@ -66,12 +70,20 @@ public static void tearDown() { @Test public void test_recordMetrics() { // GIVEN + + Instant currentTimeTruncatedToMinutes = + LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES).toInstant(ZoneOffset.UTC); + String event1 = - "{ \"metrics\": {\"orders\": 1, \"products\": 4}, \"dimensions\": { \"Environment\": \"test\"} }"; + "{ \"metrics\": {\"orders\": 1, \"products\": 4}, \"dimensions\": { \"Environment\": \"test\"}, \"highResolution\": \"false\"}"; + String event2 = + "{ \"metrics\": {\"orders\": 1, \"products\": 8}, \"dimensions\": { \"Environment\": \"test\"}, \"highResolution\": \"true\"}"; // WHEN InvocationResult invocationResult = invokeFunction(functionName, event1); + invokeFunction(functionName, event2); + // THEN MetricsFetcher metricsFetcher = new MetricsFetcher(); List coldStart = @@ -84,18 +96,35 @@ public void test_recordMetrics() { List orderMetrics = metricsFetcher.fetchMetrics(invocationResult.getStart(), invocationResult.getEnd(), 60, namespace, "orders", Collections.singletonMap("Environment", "test")); - assertThat(orderMetrics.get(0)).isEqualTo(1); + assertThat(orderMetrics.get(0)).isEqualTo(2); List productMetrics = metricsFetcher.fetchMetrics(invocationResult.getStart(), invocationResult.getEnd(), 60, namespace, "products", Collections.singletonMap("Environment", "test")); - assertThat(productMetrics.get(0)).isEqualTo(4); + + // When searching across a 1 minute time period with a period of 60 we find both metrics and the sum is 12 + + assertThat(productMetrics.get(0)).isEqualTo(12); + orderMetrics = metricsFetcher.fetchMetrics(invocationResult.getStart(), invocationResult.getEnd(), 60, namespace, "orders", Collections.singletonMap("Service", service)); - assertThat(orderMetrics.get(0)).isEqualTo(1); + assertThat(orderMetrics.get(0)).isEqualTo(2); productMetrics = metricsFetcher.fetchMetrics(invocationResult.getStart(), invocationResult.getEnd(), 60, namespace, "products", Collections.singletonMap("Service", service)); - assertThat(productMetrics.get(0)).isEqualTo(4); + assertThat(productMetrics.get(0)).isEqualTo(12); + + Instant searchStartTime = currentTimeTruncatedToMinutes.plusSeconds(15); + Instant searchEndTime = currentTimeTruncatedToMinutes.plusSeconds(45); + + List productMetricDataResult = + metricsFetcher.fetchMetrics(searchStartTime, searchEndTime, 1, namespace, + "products", Collections.singletonMap("Environment", "test")); + +// We are searching across the time period the metric was created but with a period of 1 second. Only the high resolution metric will be available at this point + + assertThat(productMetricDataResult.get(0)).isEqualTo(8); + + } } diff --git a/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/MetricsLoggerTest.java b/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/MetricsLoggerTest.java index 0402e3cc5..26ae41a00 100644 --- a/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/MetricsLoggerTest.java +++ b/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/MetricsLoggerTest.java @@ -25,6 +25,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.Map; import java.util.function.Consumer; import org.junit.jupiter.api.AfterEach; @@ -35,6 +37,7 @@ import software.amazon.cloudwatchlogs.emf.config.SystemWrapper; import software.amazon.cloudwatchlogs.emf.logger.MetricsLogger; import software.amazon.cloudwatchlogs.emf.model.DimensionSet; +import software.amazon.cloudwatchlogs.emf.model.StorageResolution; import software.amazon.cloudwatchlogs.emf.model.Unit; class MetricsLoggerTest { @@ -245,6 +248,7 @@ private void testLogger(Consumer> methodToTest) { { metricsLogger.setDimensions(DimensionSet.of("Dimension1", "Value1")); metricsLogger.putMetric("Metric1", 1, Unit.COUNT); + metricsLogger.putMetric("Metric2", 1, Unit.COUNT, StorageResolution.HIGH); }); assertThat(out.toString()) @@ -263,6 +267,13 @@ private void testLogger(Consumer> methodToTest) { assertThat(aws.get("CloudWatchMetrics")) .asString() .contains("Namespace=GlobalName"); + + ArrayList cloudWatchMetrics = (ArrayList) aws.get("CloudWatchMetrics"); + LinkedHashMap values = + (java.util.LinkedHashMap) cloudWatchMetrics.get(0); + ArrayList metricArray = (ArrayList) values.get("Metrics"); + LinkedHashMap metricValues = (LinkedHashMap) metricArray.get(1); + assertThat(metricValues).containsEntry("StorageResolution", 1); }); } } diff --git a/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/handlers/PowertoolsMetricsTooManyDimensionsHandler.java b/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/handlers/PowertoolsMetricsTooManyDimensionsHandler.java index bc8a6e949..fd406b9cd 100644 --- a/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/handlers/PowertoolsMetricsTooManyDimensionsHandler.java +++ b/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/handlers/PowertoolsMetricsTooManyDimensionsHandler.java @@ -26,13 +26,14 @@ public class PowertoolsMetricsTooManyDimensionsHandler implements RequestHandler { @Override - @Metrics + @Metrics(namespace = "ExampleApplication",service = "booking") public Object handleRequest(Object input, Context context) { MetricsLogger metricsLogger = metricsLogger(); - - metricsLogger.setDimensions(IntStream.range(1, 15) - .mapToObj(value -> DimensionSet.of("Dimension" + value, "DimensionValue" + value)) - .toArray(DimensionSet[]::new)); + DimensionSet dimensionSet = new DimensionSet(); + for (int i = 0; i < 35; i++) { + dimensionSet.addDimension("Dimension" + i, "value" + i); + } + metricsLogger.setDimensions(dimensionSet); return null; } diff --git a/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspectTest.java b/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspectTest.java index 81e10ed22..d27af1fdf 100644 --- a/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspectTest.java +++ b/powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspectTest.java @@ -40,6 +40,7 @@ import org.mockito.Mock; import org.mockito.MockedStatic; import software.amazon.cloudwatchlogs.emf.config.SystemWrapper; +import software.amazon.cloudwatchlogs.emf.exception.DimensionSetExceededException; import software.amazon.lambda.powertools.common.internal.LambdaHandlerProcessor; import software.amazon.lambda.powertools.metrics.MetricsUtils; import software.amazon.lambda.powertools.metrics.ValidationException; @@ -389,9 +390,10 @@ public void exceptionWhenTooManyDimensionsSet() { requestHandler = new PowertoolsMetricsTooManyDimensionsHandler(); - assertThatExceptionOfType(ValidationException.class) + assertThatExceptionOfType(DimensionSetExceededException.class) .isThrownBy(() -> requestHandler.handleRequest("input", context)) - .withMessage("Number of Dimensions must be in range of 0-9. Actual size: 14."); + .withMessage( + "Maximum number of dimensions allowed are 30. Account for default dimensions if not using setDimensions."); } } diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index ee44f7b4d..e959204ad 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -233,6 +233,10 @@ + + + + From 1317da4ad623dec472fbadb0f22486980356ee1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 11:38:26 +0000 Subject: [PATCH 5/5] build(deps): bump aws.xray.recorder.version from 2.15.1 to 2.16.0 (#1662) Bumps `aws.xray.recorder.version` from 2.15.1 to 2.16.0. Updates `com.amazonaws:aws-xray-recorder-sdk-core` from 2.15.1 to 2.16.0 - [Release notes](https://github.com/aws/aws-xray-sdk-java/releases) - [Changelog](https://github.com/aws/aws-xray-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-xray-sdk-java/compare/v2.15.1...v2.16.0) Updates `com.amazonaws:aws-xray-recorder-sdk-aws-sdk-core` from 2.15.1 to 2.16.0 - [Release notes](https://github.com/aws/aws-xray-sdk-java/releases) - [Changelog](https://github.com/aws/aws-xray-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-xray-sdk-java/compare/v2.15.1...v2.16.0) Updates `com.amazonaws:aws-xray-recorder-sdk-aws-sdk-v2` from 2.15.1 to 2.16.0 - [Release notes](https://github.com/aws/aws-xray-sdk-java/releases) - [Changelog](https://github.com/aws/aws-xray-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-xray-sdk-java/compare/v2.15.1...v2.16.0) Updates `com.amazonaws:aws-xray-recorder-sdk-aws-sdk-v2-instrumentor` from 2.15.1 to 2.16.0 - [Release notes](https://github.com/aws/aws-xray-sdk-java/releases) - [Changelog](https://github.com/aws/aws-xray-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-xray-sdk-java/compare/v2.15.1...v2.16.0) --- updated-dependencies: - dependency-name: com.amazonaws:aws-xray-recorder-sdk-core dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.amazonaws:aws-xray-recorder-sdk-aws-sdk-core dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.amazonaws:aws-xray-recorder-sdk-aws-sdk-v2 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.amazonaws:aws-xray-recorder-sdk-aws-sdk-v2-instrumentor 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 168243622..acfe00fd1 100644 --- a/pom.xml +++ b/pom.xml @@ -72,7 +72,7 @@ 2.0.7 2.17.1 2.25.35 - 2.15.1 + 2.16.0 2.2.0 UTF-8 1.2.3