Skip to content

Commit 65da2a8

Browse files
authored
Merge pull request #78 from newrelic/upgrade-aws-s3-artifact
Upgrade AWS dependencies and general code cleanup
2 parents 3fec8d0 + 44401d7 commit 65da2a8

20 files changed

+1415
-1278
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # pin@v4
12-
- uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # pin@v1
12+
- uses: gradle/actions/wrapper-validation@v3
1313
- name: Set up JDK 11
1414
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # pin@v4
1515
with:

CONTRIBUTING.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,8 @@ Before we can accept a pull request, you must sign our [Contributor Licensing Ag
3737
Minimally, the [test suite](#testing-guidelines) must pass for us to accept a PR. Ideally, we would love it if you also added appropriate tests if you're implementing a feature!
3838

3939
## Coding Style Guidelines
40-
Our code base is formatted according to the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html).
41-
42-
The project is configured to use the [google-java-format-gradle-plugin](https://github.com/sherter/google-java-format-gradle-plugin) which can be utilized as follows:
43-
44-
* Execute the task `googleJavaFormat` to format all `*.java` files in the project:
45-
46-
`./gradlew goJF`
47-
48-
* Execute the task `verifyGoogleJavaFormat` to verify that all `*.java` files are formatted properly:
49-
50-
`./gradlew verGJF`
40+
- Use the style provided in `dev-tools/code-style/java-agent-code-style.xml` in the project.
41+
- We encourage you to reduce tech debt you might find in the area. Leave the code better than you found it.
5142

5243
## Testing Guidelines
5344
The AWS Lambda OpenTracing Java SDK comes with tests in `src/test` that can be run with `./gradlew test`.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ This SDK provides Open Tracing instrumentation for AWS Lambda. Releases for this
66

77
Versioning will have the following format: {majorVersion}.{minorVersion}.{pointVersion}
88

9+
### Version 3.0.0
10+
11+
Version 3.0.0 of this library made changes to the versions of AWS dependencies. The following dependencies are now used:
12+
- `com.amazonaws:aws-lambda-java-core:1.2.3` (previous version: 1.1.0)
13+
- `com.amazonaws:aws-lambda-java-events:3.15.0` (previous version: 2.2.7)
14+
- `software.amazon.awssdk:s3:2.31.43` (replaces com.amazonaws:aws-java-sdk-s3:1.12.771)
15+
- `software.amazon.awssdk:s3-event-notifications:2.31.43` (replaces com.amazonaws:aws-java-sdk-s3:1.12.771)
16+
17+
It is recommended that functions that utilize the New Relic AWS Lamdba OpenTracing Java SDK utilize the same (or higher) versions
18+
of the underlying AWS libraries as noted above. Functions that are unable to upgrade should remain on version 2.2.0 of this library.
19+
920
### Supported OpenTracing Versions
1021

1122
* OpenTracing 0.31.0: [com.newrelic.opentracing:java-aws-lambda:1.0.0](https://mvnrepository.com/artifact/com.newrelic.opentracing/java-aws-lambda/1.0.0)

build.gradle

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ buildscript {
77
}
88

99
}
10-
dependencies {
11-
classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.9"
12-
}
1310
}
1411

1512
plugins {
@@ -25,8 +22,6 @@ java {
2522
withJavadocJar()
2623
}
2724

28-
apply plugin: 'com.github.sherter.google-java-format'
29-
3025
repositories {
3126
mavenCentral()
3227
maven {
@@ -35,12 +30,12 @@ repositories {
3530
}
3631

3732
dependencies {
38-
implementation 'com.amazonaws:aws-lambda-java-core:1.1.0'
39-
// 2.2.7 is earliest version that has all needed event sources
40-
implementation 'com.amazonaws:aws-lambda-java-events:2.2.7'
41-
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.771'
42-
implementation 'com.amazonaws:aws-java-sdk-kinesis:1.11.163'
43-
implementation 'com.amazonaws:aws-java-sdk-dynamodb:1.11.163'
33+
implementation 'software.amazon.awssdk:s3:2.31.43'
34+
implementation 'software.amazon.awssdk:s3-event-notifications:2.31.43'
35+
36+
implementation 'com.amazonaws:aws-lambda-java-core:1.2.3'
37+
implementation 'com.amazonaws:aws-lambda-java-events:3.15.0'
38+
4439
implementation('io.opentracing:opentracing-api:0.33.0')
4540
implementation('io.opentracing:opentracing-util:0.33.0')
4641
implementation('io.opentracing:opentracing-noop:0.33.0')
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<code_scheme name="java-agent">
2+
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
3+
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
4+
<option name="RIGHT_MARGIN" value="160" />
5+
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
6+
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
7+
<option name="JD_P_AT_EMPTY_LINES" value="false" />
8+
<codeStyleSettings language="JAVA">
9+
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
10+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
11+
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
12+
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
13+
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACES" value="true" />
14+
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
15+
<option name="CALL_PARAMETERS_WRAP" value="1" />
16+
<option name="METHOD_PARAMETERS_WRAP" value="1" />
17+
<option name="RESOURCE_LIST_WRAP" value="1" />
18+
<option name="EXTENDS_LIST_WRAP" value="1" />
19+
<option name="THROWS_LIST_WRAP" value="1" />
20+
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
21+
<option name="THROWS_KEYWORD_WRAP" value="1" />
22+
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
23+
<option name="BINARY_OPERATION_WRAP" value="1" />
24+
<option name="TERNARY_OPERATION_WRAP" value="5" />
25+
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
26+
<option name="IF_BRACE_FORCE" value="3" />
27+
<option name="DOWHILE_BRACE_FORCE" value="3" />
28+
<option name="WHILE_BRACE_FORCE" value="3" />
29+
<option name="FOR_BRACE_FORCE" value="3" />
30+
<option name="VARIABLE_ANNOTATION_WRAP" value="2" />
31+
</codeStyleSettings>
32+
</code_scheme>

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
group = com.newrelic.opentracing
2-
version = 2.3.0
2+
version = 3.0.0

src/main/java/com/newrelic/opentracing/aws/EnhancedSpanBuilder.java

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,66 +10,72 @@
1010
import io.opentracing.Tracer;
1111

1212
public class EnhancedSpanBuilder {
13-
private final Tracer.SpanBuilder spanBuilder;
13+
private final Tracer.SpanBuilder spanBuilder;
1414

15-
public static EnhancedSpanBuilder basedOn(Tracer tracer, String operationName) {
16-
return new EnhancedSpanBuilder(tracer.buildSpan(operationName));
17-
}
15+
public static EnhancedSpanBuilder basedOn(Tracer tracer, String operationName) {
16+
return new EnhancedSpanBuilder(tracer.buildSpan(operationName));
17+
}
1818

19-
private EnhancedSpanBuilder(Tracer.SpanBuilder innerSpanBuilder) {
20-
spanBuilder = innerSpanBuilder;
21-
}
19+
private EnhancedSpanBuilder(Tracer.SpanBuilder innerSpanBuilder) {
20+
spanBuilder = innerSpanBuilder;
21+
}
2222

23-
public EnhancedSpanBuilder asChildOf(SpanContext spanContext) {
24-
this.spanBuilder.asChildOf(spanContext);
25-
return this;
26-
}
23+
public EnhancedSpanBuilder asChildOf(SpanContext spanContext) {
24+
this.spanBuilder.asChildOf(spanContext);
25+
return this;
26+
}
2727

28-
/** Same as {@link Span#setTag(String, String)}, but for the span to be built. */
29-
EnhancedSpanBuilder withTag(String key, String value) {
30-
this.spanBuilder.withTag(key, value);
31-
return this;
32-
}
28+
/**
29+
* Same as {@link Span#setTag(String, String)}, but for the span to be built.
30+
*/
31+
EnhancedSpanBuilder withTag(String key, String value) {
32+
this.spanBuilder.withTag(key, value);
33+
return this;
34+
}
3335

34-
/** Same as {@link Span#setTag(String, boolean)}, but for the span to be built. */
35-
EnhancedSpanBuilder withTag(String key, boolean value) {
36-
this.spanBuilder.withTag(key, value);
37-
return this;
38-
}
36+
/**
37+
* Same as {@link Span#setTag(String, boolean)}, but for the span to be built.
38+
*/
39+
EnhancedSpanBuilder withTag(String key, boolean value) {
40+
this.spanBuilder.withTag(key, value);
41+
return this;
42+
}
3943

40-
/** Same as {@link Span#setTag(String, Number)}, but for the span to be built. */
41-
EnhancedSpanBuilder withTag(String key, Number value) {
42-
this.spanBuilder.withTag(key, value);
43-
return this;
44-
}
44+
/**
45+
* Same as {@link Span#setTag(String, Number)}, but for the span to be built.
46+
*/
47+
EnhancedSpanBuilder withTag(String key, Number value) {
48+
this.spanBuilder.withTag(key, value);
49+
return this;
50+
}
4551

46-
/**
47-
* A shorthand for withTag("key", "value").
48-
*
49-
* <p>If parent==null, this is a noop.
50-
*/
51-
EnhancedSpanBuilder optionallyWithTag(String key, String value) {
52-
if (value != null) {
53-
this.spanBuilder.withTag(key, value);
52+
/**
53+
* A shorthand for withTag("key", "value").
54+
*
55+
* <p>If parent==null, this is a noop.
56+
*/
57+
EnhancedSpanBuilder optionallyWithTag(String key, String value) {
58+
if (value != null) {
59+
this.spanBuilder.withTag(key, value);
60+
}
61+
return this;
5462
}
55-
return this;
56-
}
5763

58-
EnhancedSpanBuilder optionallyWithTag(String key, boolean value) {
59-
if (value) {
60-
this.spanBuilder.withTag(key, true);
64+
EnhancedSpanBuilder optionallyWithTag(String key, boolean value) {
65+
if (value) {
66+
this.spanBuilder.withTag(key, true);
67+
}
68+
return this;
6169
}
62-
return this;
63-
}
6470

65-
EnhancedSpanBuilder optionallyWithTag(String key, Number value) {
66-
if (value != null) {
67-
this.spanBuilder.withTag(key, value);
71+
EnhancedSpanBuilder optionallyWithTag(String key, Number value) {
72+
if (value != null) {
73+
this.spanBuilder.withTag(key, value);
74+
}
75+
return this;
6876
}
69-
return this;
70-
}
7177

72-
public Span start() {
73-
return this.spanBuilder.start();
74-
}
78+
public Span start() {
79+
return this.spanBuilder.start();
80+
}
7581
}

0 commit comments

Comments
 (0)