Skip to content

Commit d3b5a72

Browse files
committed
Merge, accepting both sides for deleted files
2 parents 8586bf6 + 897f7e9 commit d3b5a72

File tree

72 files changed

+3157
-1042
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3157
-1042
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Artifacts Size
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- 'powertools-cloudformation/**'
9+
- 'powertools-core/**'
10+
- 'powertools-serialization/**'
11+
- 'powertools-logging/**'
12+
- 'powertools-sqs/**'
13+
- 'powertools-tracing/**'
14+
- 'powertools-validation/**'
15+
- 'powertools-parameters/**'
16+
- 'powertools-idempotency/**'
17+
- 'powertools-metrics/**'
18+
- 'pom.xml'
19+
jobs:
20+
codecheck:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
24+
- name: Setup java JDK 11
25+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
26+
with:
27+
distribution: 'corretto'
28+
java-version: 11
29+
- name: Build with Maven
30+
run: mvn clean package --file pom.xml -DskipTests
31+
- name: Get artifacts size & build report
32+
id: artifacts-size-report
33+
run: |
34+
echo '## :floppy_disk: Artifacts Size Report' > report.md
35+
echo '| Module | Version | Size (KB) |' >> report.md
36+
echo '| --- | --- | --- |' >> report.md
37+
artifact_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
38+
for artifact in $(cat target/powertools-parent-*.buildinfo | grep 'outputs.*.jar' | grep -v 'sources.jar'); do
39+
artifact_name=$(echo "$artifact" | cut -d '=' -f2)
40+
artifact_name=${artifact_name%-$artifact_version.jar}
41+
artifact_size=$(grep "${artifact%%.filename*}.length" target/powertools-parent-*.buildinfo | cut -d '=' -f2)
42+
printf "| %s | %s | %.2f |\n" "$artifact_name" "$artifact_version" "$(bc <<< "scale=2; $artifact_size/1000")" >> report.md
43+
done
44+
- name: Find potential existing report
45+
uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # 2.4.0
46+
id: find-comment
47+
with:
48+
issue-number: ${{ github.event.pull_request.number }}
49+
comment-author: 'github-actions[bot]'
50+
body-includes: Artifacts Size Report
51+
- name: Write artifacts size report in comment
52+
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # 3.0.2
53+
with:
54+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
55+
issue-number: ${{ github.event.pull_request.number }}
56+
body-path: 'report.md'
57+
edit-mode: replace
File renamed without changes.

docs/core/logging.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ You can set a Correlation ID using `correlationIdPath` attribute by passing a [J
347347
"functionName": "test",
348348
"functionMemorySize": 128,
349349
"functionArn": "arn:aws:lambda:eu-west-1:12345678910:function:test",
350-
"lambda_request_id": "52fdfc07-2182-154f-163f-5f0f9a621d72",
350+
"function_request_id": "52fdfc07-2182-154f-163f-5f0f9a621d72",
351351
"correlation_id": "correlation_id_value"
352352
}
353353
```
@@ -397,7 +397,7 @@ for known event sources, where either a request ID or X-Ray Trace ID are present
397397
"functionName": "test",
398398
"functionMemorySize": 128,
399399
"functionArn": "arn:aws:lambda:eu-west-1:12345678910:function:test",
400-
"lambda_request_id": "52fdfc07-2182-154f-163f-5f0f9a621d72",
400+
"function_request_id": "52fdfc07-2182-154f-163f-5f0f9a621d72",
401401
"correlation_id": "correlation_id_value"
402402
}
403403
```
@@ -510,7 +510,7 @@ this means that custom keys can be persisted across invocations. If you want all
510510
"functionName": "test",
511511
"functionMemorySize": 128,
512512
"functionArn": "arn:aws:lambda:eu-west-1:12345678910:function:test",
513-
"lambda_request_id": "52fdfc07-2182-154f-163f-5f0f9a621d72",
513+
"function_request_id": "52fdfc07-2182-154f-163f-5f0f9a621d72",
514514
"specialKey": "value"
515515
}
516516
```
@@ -527,7 +527,7 @@ this means that custom keys can be persisted across invocations. If you want all
527527
"functionName": "test",
528528
"functionMemorySize": 128,
529529
"functionArn": "arn:aws:lambda:eu-west-1:12345678910:function:test",
530-
"lambda_request_id": "52fdfc07-2182-154f-163f-5f0f9a621d72"
530+
"function_request_id": "52fdfc07-2182-154f-163f-5f0f9a621d72"
531531
}
532532
```
533533

docs/stylesheets/extra.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
}
44

55
.highlight .hll {
6-
background-color: lavender
6+
[data-md-color-scheme="default"] {
7+
background-color: lavender;
8+
}
79
}
810

911
.md-typeset table:not([class]) {

examples/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ Each example can be copied from its subdirectory and used independently of the r
55

66
## Examples
77

8-
* [powertools-examples-core-utilities](powertools-examples-core-utilities) - Demonstrates the core logging, tracing, and metrics modules with different build tools
9-
* [SAM](powertools-examples-core-utilities/sam)
10-
* [CDK](powertools-examples-core-utilities/cdk)
8+
* [powertools-examples-core](powertools-examples-core) - Demonstrates the core logging, tracing, and metrics modules with different build tools
9+
* [SAM](./powertools-examples-core/sam)
10+
* [CDK](./powertools-examples-core/cdk)
11+
* [Serverless](./powertools-examples-core/serverless)
1112
* [powertools-examples-idempotency](powertools-examples-idempotency) - An idempotent HTTP API
1213
* [powertools-examples-parameters](powertools-examples-parameters) - Uses the parameters module to provide runtime parameters to a function
1314
* [powertools-examples-serialization](powertools-examples-serialization) - Uses the serialization module to serialize and deserialize API Gateway & SQS payloads
@@ -54,7 +55,7 @@ The first command will build the source of your application. The second command
5455

5556
You can find your API Gateway Endpoint URL in the output values displayed after deployment.
5657

57-
If you're not using SAM, you can look for examples for other tools under [powertools-examples-core-utilities](./powertools-examples-core-utilities)
58+
If you're not using SAM, you can look for examples for other tools under [powertools-examples-core](./powertools-examples-core)
5859

5960
### External examples
6061

examples/pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
</description>
3030

3131
<modules>
32-
<module>powertools-examples-core-utilities/sam</module>
33-
<module>powertools-examples-core-utilities/cdk/app</module>
34-
<module>powertools-examples-core-utilities/cdk/infra</module>
32+
<module>powertools-examples-core/sam</module>
33+
<module>powertools-examples-core/cdk/app</module>
34+
<module>powertools-examples-core/cdk/infra</module>
35+
<module>powertools-examples-core/serverless</module>
3536
<module>powertools-examples-idempotency</module>
3637
<module>powertools-examples-parameters</module>
3738
<module>powertools-examples-serialization</module>

examples/powertools-examples-batch/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
<log4j.version>2.20.0</log4j.version>
1515
<maven.compiler.source>1.8</maven.compiler.source>
1616
<maven.compiler.target>1.8</maven.compiler.target>
17-
<sdk.version>2.20.133</sdk.version>
18-
<aspectj.version>1.9.20</aspectj.version>
17+
<sdk.version>2.20.152</sdk.version>
1918
</properties>
2019

2120
<dependencies>

examples/powertools-examples-cloudformation/pom.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44

55
<groupId>software.amazon.lambda.examples</groupId>
6-
<version>2.0.0-SNAPSHOT</version>
6+
<version>1.17.0-SNAPSHOT</version>
77
<artifactId>powertools-examples-cloudformation</artifactId>
88
<packaging>jar</packaging>
99

@@ -14,9 +14,8 @@
1414
<maven.compiler.source>1.8</maven.compiler.source>
1515
<maven.compiler.target>1.8</maven.compiler.target>
1616
<lambda.core.version>1.2.3</lambda.core.version>
17-
<lambda.events.version>3.11.2</lambda.events.version>
18-
<aws.sdk.version>2.20.136</aws.sdk.version>
19-
<aspectj.version>1.9.20</aspectj.version>
17+
<lambda.events.version>3.11.3</lambda.events.version>
18+
<aws.sdk.version>2.20.162</aws.sdk.version>
2019
</properties>
2120
<dependencyManagement>
2221
<dependencies>

examples/powertools-examples-core-utilities/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ We provide examples for the following infrastructure-as-code tools:
99

1010
* [AWS SAM](sam/)
1111
* [AWS CDK](cdk/)
12+
* [Serverless framework](serverless/)
1213

1314
We also provide an example showing the integration of SAM, Powertools, and Gradle:
1415

15-
* [AWS SAM with a Gradle build](../powertools-examples-core-utilities/gradle/)
16+
* [AWS SAM with a Gradle build](gradle/)
1617

1718
For each of the tools, the example application is the same, and consists of the following files:
1819

examples/powertools-examples-core-utilities/cdk/app/src/main/java/helloworld/App.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@
4646
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
4747
private final static Logger log = LogManager.getLogger(App.class);
4848

49-
@Logging(logEvent = true, samplingRate = 0.7)
49+
// This is controlled by POWERTOOLS_LOGGER_SAMPLE_RATE environment variable
50+
// @Logging(logEvent = true, samplingRate = 0.7)
51+
// This is controlled by POWERTOOLS_METRICS_NAMESPACE environment variable
52+
// @Metrics(namespace = "ServerlessAirline", service = "payment", captureColdStart = true)
53+
// This is controlled by POWERTOOLS_TRACER_CAPTURE_ERROR environment variable
5054
@Tracing(captureMode = CaptureMode.RESPONSE_AND_ERROR)
51-
@Metrics(namespace = "ServerlessAirline", service = "payment", captureColdStart = true)
5255
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
5356
Map<String, String> headers = new HashMap<>();
5457

@@ -84,18 +87,25 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
8487
return response
8588
.withStatusCode(200)
8689
.withBody(output);
90+
<<<<<<<< HEAD:examples/powertools-examples-core-utilities/cdk/app/src/main/java/helloworld/App.java
8791
} catch (IOException e) {
92+
========
93+
} catch (RuntimeException | IOException e) {
94+
>>>>>>>> main:examples/powertools-examples-core/serverless/src/main/java/helloworld/App.java
8895
return response
8996
.withBody("{}")
9097
.withStatusCode(500);
9198
}
9299
}
93100

101+
<<<<<<<< HEAD:examples/powertools-examples-core-utilities/cdk/app/src/main/java/helloworld/App.java
94102
@Tracing
95103
private void log() {
96104
log.info("inside threaded logging for function");
97105
}
98106

107+
========
108+
>>>>>>>> main:examples/powertools-examples-core/serverless/src/main/java/helloworld/App.java
99109
@Tracing(namespace = "getPageContents", captureMode = CaptureMode.DISABLED)
100110
private String getPageContents(String address) throws IOException {
101111
URL url = new URL(address);

0 commit comments

Comments
 (0)