Skip to content

Commit 9b675c1

Browse files
committed
Merge PR #370: Update aws-xray-propagator module to follow style guide
2 parents 7b2ef70 + 09009ae commit 9b675c1

File tree

9 files changed

+21
-10
lines changed

9 files changed

+21
-10
lines changed

aws-xray-propagator/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ dependencies {
1111
api("io.opentelemetry:opentelemetry-api")
1212
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
1313
compileOnly("io.opentelemetry:opentelemetry-api-incubator")
14+
15+
annotationProcessor("com.google.auto.service:auto-service")
16+
compileOnly("com.google.auto.service:auto-service-annotations")
17+
1418
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
1519
testImplementation("io.opentelemetry:opentelemetry-sdk-trace")
1620
testImplementation("io.opentelemetry:opentelemetry-sdk-testing")

aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/AwsXrayLambdaPropagator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55

66
package io.opentelemetry.contrib.awsxray.propagator;
77

8+
import static java.util.Collections.singletonMap;
9+
810
import io.opentelemetry.api.trace.Span;
911
import io.opentelemetry.context.Context;
1012
import io.opentelemetry.context.propagation.TextMapGetter;
1113
import io.opentelemetry.context.propagation.TextMapPropagator;
1214
import io.opentelemetry.context.propagation.TextMapSetter;
13-
import java.util.Collections;
1415
import java.util.List;
1516
import java.util.Map;
1617
import java.util.Set;
@@ -75,7 +76,7 @@ public <C> Context extract(Context context, @Nullable C carrier, TextMapGetter<C
7576
}
7677
return xrayPropagator.extract(
7778
xrayContext,
78-
Collections.singletonMap(AwsXrayPropagator.TRACE_HEADER_KEY, traceHeader),
79+
singletonMap(AwsXrayPropagator.TRACE_HEADER_KEY, traceHeader),
7980
MapGetter.INSTANCE);
8081
}
8182

aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/AwsXrayPropagator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package io.opentelemetry.contrib.awsxray.propagator;
77

88
import static io.opentelemetry.api.internal.OtelEncodingUtils.isValidBase16String;
9+
import static java.util.Collections.singletonList;
910

1011
import io.opentelemetry.api.baggage.Baggage;
1112
import io.opentelemetry.api.baggage.BaggageBuilder;
@@ -20,7 +21,6 @@
2021
import io.opentelemetry.context.propagation.TextMapGetter;
2122
import io.opentelemetry.context.propagation.TextMapPropagator;
2223
import io.opentelemetry.context.propagation.TextMapSetter;
23-
import java.util.Collections;
2424
import java.util.List;
2525
import java.util.Set;
2626
import java.util.logging.Logger;
@@ -80,7 +80,7 @@ public final class AwsXrayPropagator implements TextMapPropagator {
8080
private static final String INVALID_LINEAGE = "-1:11111111:0";
8181
private static final int NUM_OF_LINEAGE_DELIMITERS = 2;
8282

83-
private static final List<String> FIELDS = Collections.singletonList(TRACE_HEADER_KEY);
83+
private static final List<String> FIELDS = singletonList(TRACE_HEADER_KEY);
8484

8585
private static final AwsXrayPropagator INSTANCE = new AwsXrayPropagator();
8686

aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/internal/AwsConfigurablePropagator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package io.opentelemetry.contrib.awsxray.propagator.internal;
77

8+
import com.google.auto.service.AutoService;
89
import io.opentelemetry.context.propagation.TextMapPropagator;
910
import io.opentelemetry.contrib.awsxray.propagator.AwsXrayPropagator;
1011
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
@@ -14,7 +15,8 @@
1415
* A {@link ConfigurablePropagatorProvider} which allows enabling the {@link AwsXrayPropagator} with
1516
* the propagator name {@code xray}.
1617
*/
17-
public final class AwsConfigurablePropagator implements ConfigurablePropagatorProvider {
18+
@AutoService(ConfigurablePropagatorProvider.class)
19+
public class AwsConfigurablePropagator implements ConfigurablePropagatorProvider {
1820
@Override
1921
public TextMapPropagator getPropagator(ConfigProperties config) {
2022
return AwsXrayPropagator.getInstance();

aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/internal/AwsXrayComponentProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55

66
package io.opentelemetry.contrib.awsxray.propagator.internal;
77

8+
import com.google.auto.service.AutoService;
89
import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties;
910
import io.opentelemetry.context.propagation.TextMapPropagator;
1011
import io.opentelemetry.contrib.awsxray.propagator.AwsXrayPropagator;
1112
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider;
1213

14+
@AutoService(ComponentProvider.class)
15+
@SuppressWarnings("rawtypes")
1316
public class AwsXrayComponentProvider implements ComponentProvider<TextMapPropagator> {
1417
@Override
1518
public Class<TextMapPropagator> getType() {

aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/internal/AwsXrayLambdaComponentProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55

66
package io.opentelemetry.contrib.awsxray.propagator.internal;
77

8+
import com.google.auto.service.AutoService;
89
import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties;
910
import io.opentelemetry.context.propagation.TextMapPropagator;
1011
import io.opentelemetry.contrib.awsxray.propagator.AwsXrayLambdaPropagator;
1112
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider;
1213

14+
@AutoService(ComponentProvider.class)
15+
@SuppressWarnings("rawtypes")
1316
public class AwsXrayLambdaComponentProvider implements ComponentProvider<TextMapPropagator> {
1417
@Override
1518
public Class<TextMapPropagator> getType() {

aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/internal/AwsXrayLambdaConfigurablePropagator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package io.opentelemetry.contrib.awsxray.propagator.internal;
77

8+
import com.google.auto.service.AutoService;
89
import io.opentelemetry.context.propagation.TextMapPropagator;
910
import io.opentelemetry.contrib.awsxray.propagator.AwsXrayLambdaPropagator;
1011
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
@@ -14,7 +15,8 @@
1415
* A {@link ConfigurablePropagatorProvider} which allows enabling the {@link
1516
* AwsXrayLambdaPropagator} with the propagator name {@code xray-lambda}.
1617
*/
17-
public final class AwsXrayLambdaConfigurablePropagator implements ConfigurablePropagatorProvider {
18+
@AutoService(ConfigurablePropagatorProvider.class)
19+
public class AwsXrayLambdaConfigurablePropagator implements ConfigurablePropagatorProvider {
1820
@Override
1921
public TextMapPropagator getPropagator(ConfigProperties config) {
2022
return AwsXrayLambdaPropagator.getInstance();

aws-xray-propagator/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider

Lines changed: 0 additions & 2 deletions
This file was deleted.

aws-xray-propagator/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)