Skip to content

Commit d616eaf

Browse files
authored
Merge branch 'v2' into phipag/fix-pom-maven-central2
2 parents ab429f4 + af31d6f commit d616eaf

File tree

6 files changed

+75
-38
lines changed

6 files changed

+75
-38
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,9 @@ jobs:
270270
id-token: write
271271
environment: Docs
272272
steps:
273-
- id: download_source
274-
name: Download artifacts
275-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.6.1
276-
with:
277-
name: source
273+
- id: checkout
274+
name: Checkout repository
275+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
278276
- name: Build
279277
run: |
280278
mkdir -p dist
@@ -290,4 +288,4 @@ jobs:
290288
run: |
291289
aws s3 sync \
292290
dist \
293-
s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-java/
291+
s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-java/${{ inputs.version }}/

docs/roadmap.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Security and operational excellence take precedence above all else. This means b
1717

1818
Our top priority is to establish the processes and infrastructure needed for a fully automated and secure end-to-end release process of new versions to Maven Central.
1919

20-
- [ ] Implement GitHub workflows and create infrastructure to release to Maven Central
20+
- [x] [Implement GitHub workflows](https://github.com/aws-powertools/powertools-lambda-java/issues/1231){target="\_blank"} and create infrastructure to release to Maven Central
2121
- [x] [Implement end-to-end tests](https://github.com/aws-powertools/powertools-lambda-java/issues/1815){target="\_blank"}
2222
- [x] Implement [OpenSSF Scorecard](https://openssf.org/projects/scorecard/){target="\_blank"}
2323

@@ -27,9 +27,10 @@ As part of a new major version `v2` release, we prioritize the Java project's co
2727

2828
##### Core Utilities
2929

30-
- [ ] [Review public interfaces and reduce public API surface area](https://github.com/aws-powertools/powertools-lambda-java/issues/1283){target="\_blank"}
30+
- [x] [Review public interfaces and reduce public API surface area](https://github.com/aws-powertools/powertools-lambda-java/issues/1283){target="\_blank"}
3131
- [x] [Release Logging `v2` module](https://github.com/aws-powertools/powertools-lambda-java/issues/965){target="\_blank"} allowing customers to choose the logging framework and adding support for logging deeply nested objects as JSON
3232
- [x] [Support high resolution metrics](https://github.com/aws-powertools/powertools-lambda-java/issues/1041){target="\_blank"}
33+
- [x] [Improve modularity of metrics module](https://github.com/aws-powertools/powertools-lambda-java/issues/1848){target="\_blank"} to remove coupling with EMF library and enable future support for additional metrics providers / backends
3334

3435
##### Ecosystem
3536

docs/upgrade.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,53 @@ public class PaymentFunction implements RequestHandler<APIGatewayProxyRequestEve
162162
## Updated Metrics utility interface
163163

164164
<!-- - Remove deprecated methods: https://github.com/aws-powertools/powertools-lambda-java/pull/1624/files#diff-0afede8005aa2baeba2770f66d611bf0e8ee3969205be27e803682a7f2d6520a -->
165+
<!-- - Re-designed metrics module: https://github.com/aws-powertools/powertools-lambda-java/issues/1848 -->
165166

166-
The Metrics utility is currently undergoing changes to the public interface as part of GitHub issue [#1848](https://github.com/aws-powertools/powertools-lambda-java/issues/1848). We will keep this upgrade guide updated with the most recent changes as soon as they are released. Stay tuned for updates!
167+
The Metrics utility was redesigned to be more modular and allow for the addition of new metrics providers in the future. The same EMF-based metrics logging still applies but will be called via an updated public interface. Consider the following list to understand some of changes:
168+
169+
- `#!java @Metrics` was renamed to `#!java @FlushMetrics`
170+
- `#!java MetricsLogger.metricsLogger()` was renamed to `#!java MetricsFactory.getMetricsInstance()`
171+
- `put*` calls such as `#!java putMetric()` where replaced with `add*` nomenclature such as `#!java addMetric()`
172+
- All direct imports from `software.amazon.cloudwatchlogs.emf` need to be replaced with Powertools counterparts from `software.amazon.lambda.powertools.metrics` (see example below)
173+
- The `withSingleMetric` and `withMetricsLogger` methods were removed in favor of `#!java metrics.flushSingleMetric()`
174+
- It is no longer valid to skip declaration of a namespace. If no namespace is provided, an exception will be raised instead of using the default `aws-embedded-metrics` namespace.
175+
176+
The following example shows a common Lambda handler using the Metrics utility and required refactorings.
177+
178+
```diff
179+
// Metrics is not a decorator anymore but the replacement for the `MetricsLogger` Singleton
180+
import software.amazon.lambda.powertools.metrics.Metrics;
181+
+ import software.amazon.lambda.powertools.metrics.FlushMetrics;
182+
- import software.amazon.lambda.powertools.metrics.MetricsUtils;
183+
+ import software.amazon.lambda.powertools.metrics.MetricsFactory;
184+
- import software.amazon.cloudwatchlogs.emf.logger.MetricsLogger;
185+
- import software.amazon.cloudwatchlogs.emf.model.DimensionSet;
186+
- import software.amazon.cloudwatchlogs.emf.model.Unit;
187+
+ import software.amazon.lambda.powertools.metrics.model.DimensionSet;
188+
+ import software.amazon.lambda.powertools.metrics.model.MetricUnit;
189+
190+
public class MetricsEnabledHandler implements RequestHandler<Object, Object> {
191+
192+
// This is still a Singleton
193+
- MetricsLogger metricsLogger = MetricsUtils.metricsLogger();
194+
+ Metrics metrics = MetricsFactory.getMetricsInstance();
195+
196+
@Override
197+
- @Metrics(namespace = "ExampleApplication", service = "booking")
198+
+ @FlushMetrics(namespace = "ExampleApplication", service = "booking")
199+
public Object handleRequest(Object input, Context context) {
200+
- metricsLogger.putDimensions(DimensionSet.of("environment", "prod"));
201+
+ metrics.addDimension(DimensionSet.of("environment", "prod"));
202+
// New method overload for adding 2D dimensions more conveniently
203+
+ metrics.addDimension("environment", "prod");
204+
- metricsLogger.putMetric("SuccessfulBooking", 1, Unit.COUNT);
205+
+ metrics.addMetric("SuccessfulBooking", 1, MetricUnit.COUNT);
206+
...
207+
}
208+
}
209+
```
210+
211+
Learn more about the redesigned Metrics utility in the [Metrics documentation](./core/metrics.md).
167212

168213
## Deprecated capture mode related `@Tracing` annotation parameters
169214

pom.xml

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@
2727
<description>
2828
A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier.
2929
</description>
30+
<scm>
31+
<url>https://github.com/aws-powertools/powertools-lambda-java</url>
32+
<connection>scm:git:git://github.com/aws-powertools/powertools-lambda-java.git</connection>
33+
<developerConnection>scm:git:ssh://github.com:aws-powertools/powertools-lambda-java.git</developerConnection>
34+
</scm>
35+
<developers>
36+
<developer>
37+
<name>Powertools for AWS team</name>
38+
<email>aws-powertools-maintainers@amazon.com</email>
39+
<organization>Amazon Web Services Inc.</organization>
40+
<organizationUrl>https://aws.amazon.com</organizationUrl>
41+
</developer>
42+
</developers>
3043
<url>https://aws.amazon.com/lambda/</url>
3144
<issueManagement>
3245
<system>GitHub Issues</system>
@@ -87,7 +100,6 @@
87100
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
88101
<maven-gpg-plugin.version>3.2.1</maven-gpg-plugin.version>
89102
<junit.version>5.10.0</junit.version>
90-
<aws-embedded-metrics.version>1.0.6</aws-embedded-metrics.version>
91103
<aspectj-maven-plugin.version>1.14</aspectj-maven-plugin.version>
92104
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
93105
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
@@ -505,28 +517,6 @@
505517
<id>release</id>
506518
<build>
507519
<plugins>
508-
<plugin>
509-
<groupId>org.apache.maven.plugins</groupId>
510-
<artifactId>maven-enforcer-plugin</artifactId>
511-
<version>3.5.0</version>
512-
<executions>
513-
<execution>
514-
<id>enforce-snapshot-versions</id>
515-
<phase>validate</phase>
516-
<goals>
517-
<goal>enforce</goal>
518-
</goals>
519-
<configuration>
520-
<rules>
521-
<requireSnapshotVersion>
522-
<message>Release build should not have snapshot dependencies!</message>
523-
</requireSnapshotVersion>
524-
</rules>
525-
<fail>true</fail>
526-
</configuration>
527-
</execution>
528-
</executions>
529-
</plugin>
530520
<plugin>
531521
<groupId>org.apache.maven.plugins</groupId>
532522
<artifactId>maven-gpg-plugin</artifactId>

powertools-e2e-tests/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@
174174
</dependency>
175175
</dependencies>
176176

177-
178177
<profiles>
179178
<profile>
180179
<id>default</id>

powertools-parameters/powertools-parameters-tests/pom.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
<name>Powertools for AWS Lambda (Java) library Parameters - Tests</name>
1414
<artifactId>powertools-parameters-tests</artifactId>
1515
<description>Powertools parameters tests that cut across all the parameters providers</description>
16-
<properties>
17-
<!-- Don't deploy the tests -->
18-
<maven.deploy.skip>true</maven.deploy.skip>
19-
</properties>
2016

2117
<dependencies>
2218
<dependency>
@@ -183,8 +179,16 @@
183179
</buildArgs>
184180
</configuration>
185181
</plugin>
182+
<plugin>
183+
<groupId>org.apache.maven.plugins</groupId>
184+
<artifactId>maven-deploy-plugin</artifactId>
185+
<version>3.1.2</version>
186+
<configuration>
187+
<skip>true</skip>
188+
</configuration>
189+
</plugin>
186190
</plugins>
187191
</build>
188192
</profile>
189193
</profiles>
190-
</project>
194+
</project>

0 commit comments

Comments
 (0)