Skip to content

Commit fb14c6f

Browse files
authored
Code review sweep (run 25243457683) (#18504)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
1 parent 3038190 commit fb14c6f

12 files changed

Lines changed: 29 additions & 21 deletions

File tree

instrumentation/servlet/servlet-common/bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/servlet/ServletContextPath.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public final class ServletContextPath {
2727
private static final ContextKey<ServletContextPath> CONTEXT_KEY =
2828
ContextKey.named("opentelemetry-servlet-context-path-key");
2929

30+
@Nullable private final String contextPath;
31+
32+
private ServletContextPath(@Nullable String contextPath) {
33+
this.contextPath = contextPath;
34+
}
35+
3036
public static <REQUEST> Context init(
3137
Context context, Function<REQUEST, String> contextPathExtractor, REQUEST request) {
3238
ServletContextPath servletContextPath = context.get(CONTEXT_KEY);
@@ -45,12 +51,6 @@ public static <REQUEST> Context init(
4551
return context.with(CONTEXT_KEY, new ServletContextPath(contextPath));
4652
}
4753

48-
@Nullable private final String contextPath;
49-
50-
private ServletContextPath(@Nullable String contextPath) {
51-
this.contextPath = contextPath;
52-
}
53-
5454
/**
5555
* Returns a concatenation of a servlet context path stored in the given {@code context} and a
5656
* given {@code spanName}. If there is no servlet path stored in the context, returns {@code

instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/AsyncRequestCompletionListener.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@
1212
import io.opentelemetry.instrumentation.servlet.internal.ServletResponseContext;
1313
import java.util.concurrent.atomic.AtomicBoolean;
1414

15-
public class AsyncRequestCompletionListener<REQUEST, RESPONSE>
16-
implements ServletAsyncListener<RESPONSE> {
15+
class AsyncRequestCompletionListener<REQUEST, RESPONSE> implements ServletAsyncListener<RESPONSE> {
1716
private final ServletHelper<REQUEST, RESPONSE> servletHelper;
1817
private final Instrumenter<ServletRequestContext<REQUEST>, ServletResponseContext<RESPONSE>>
1918
instrumenter;
2019
private final ServletRequestContext<REQUEST> requestContext;
2120
private final Context context;
2221
private final AtomicBoolean responseHandled = new AtomicBoolean();
2322

24-
public AsyncRequestCompletionListener(
23+
AsyncRequestCompletionListener(
2524
ServletHelper<REQUEST, RESPONSE> servletHelper,
2625
Instrumenter<ServletRequestContext<REQUEST>, ServletResponseContext<RESPONSE>> instrumenter,
2726
ServletRequestContext<REQUEST> requestContext,

instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/AsyncRunnableWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import io.opentelemetry.context.Context;
99
import io.opentelemetry.context.Scope;
1010

11-
public class AsyncRunnableWrapper<REQUEST> implements Runnable {
11+
class AsyncRunnableWrapper<REQUEST> implements Runnable {
1212
private final ServletHelper<REQUEST, ?> helper;
1313
private final Runnable runnable;
1414
private final Context context;
@@ -19,7 +19,7 @@ private AsyncRunnableWrapper(ServletHelper<REQUEST, ?> helper, Runnable runnable
1919
this.context = Context.current();
2020
}
2121

22-
public static <REQUEST> Runnable wrap(ServletHelper<REQUEST, ?> helper, Runnable runnable) {
22+
static <REQUEST> Runnable wrap(ServletHelper<REQUEST, ?> helper, Runnable runnable) {
2323
if (runnable == null || runnable instanceof AsyncRunnableWrapper) {
2424
return runnable;
2525
}

instrumentation/servlet/servlet-common/library/src/main/java/io/opentelemetry/instrumentation/servlet/internal/ServletRequestParametersExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ public void onEnd(
6767
setAttributes(request, attributes::put);
6868
}
6969

70-
private static AttributeKey<List<String>> parameterAttributeKey(String headerName) {
70+
private static AttributeKey<List<String>> parameterAttributeKey(String parameterName) {
7171
return parameterKeysCache.computeIfAbsent(
72-
headerName, ServletRequestParametersExtractor::createKey);
72+
parameterName, ServletRequestParametersExtractor::createKey);
7373
}
7474

7575
private static AttributeKey<List<String>> createKey(String parameterName) {

instrumentation/spring/spring-batch-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/batch/v3_0/chunk/TracingChunkExecutionListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void beforeChunk(ChunkContext chunkContext) {
3737
}
3838

3939
Context context = chunkInstrumenter().start(parentContext, chunkContextAndBuilder);
40-
// beforeJob & afterJob always execute on the same thread
40+
// beforeChunk & afterChunk always execute on the same thread
4141
Scope scope = context.makeCurrent();
4242
CONTEXT_AND_SCOPE.set(chunkContext, new ContextAndScope(context, scope));
4343
}
@@ -73,7 +73,7 @@ public int getOrder() {
7373
}
7474

7575
// equals() and hashCode() methods guarantee that only one instance of
76-
// TracingJobExecutionListener will be present in an ordered set of listeners
76+
// TracingChunkExecutionListener will be present in an ordered set of listeners
7777

7878
@Override
7979
public boolean equals(@Nullable Object o) {

instrumentation/spring/spring-boot-actuator-autoconfigure-2.0/javaagent/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies {
2929
latestDepTestLibrary("ch.qos.logback:logback-classic:latest.release")
3030
}
3131

32-
tasks.withType<Test>().configureEach {
32+
tasks.test {
3333
// required on jdk17
3434
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
3535
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")

instrumentation/spring/spring-boot-autoconfigure/metadata.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@ description: >
44
and spring-webflux to instrument Spring Boot applications. It does not produce telemetry on its
55
own. This instrumentation is mostly used as part of the Spring Boot starter.
66
library_link: https://spring.io/projects/spring-boot
7+
configurations:
8+
- name: otel.instrumentation.kafka.autoconfigure-interceptor
9+
declarative_name: java.kafka.autoconfigure_interceptor
10+
description: >
11+
Enable automatic configuration of tracing interceptors on
12+
`ConcurrentKafkaListenerContainerFactory` using a `BeanPostProcessor`. You may disable this if
13+
you wish to manually configure these interceptors.
14+
type: boolean
15+
default: true

instrumentation/spring/spring-boot-autoconfigure/testing/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/AbstractKafkaInstrumentationAutoConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public abstract class AbstractKafkaInstrumentationAutoConfigurationTest {
1919

2020
protected abstract void factoryTestAssertion(AssertableApplicationContext context);
2121

22-
protected final ApplicationContextRunner contextRunner =
22+
private final ApplicationContextRunner contextRunner =
2323
new ApplicationContextRunner()
2424
.withConfiguration(autoConfigurations())
2525
.withBean("openTelemetry", OpenTelemetry.class, OpenTelemetry::noop);

instrumentation/spring/spring-boot-autoconfigure/testing/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/AbstractMicrometerBridgeAutoConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public abstract class AbstractMicrometerBridgeAutoConfigurationTest {
2323

2424
protected abstract Class<?> getMeterRegistryClass();
2525

26-
protected final ApplicationContextRunner contextRunner =
26+
private final ApplicationContextRunner contextRunner =
2727
new ApplicationContextRunner()
2828
.withBean(OpenTelemetry.class, OpenTelemetry::noop)
2929
.withConfiguration(autoConfigurations());

instrumentation/spring/spring-boot-autoconfigure/testing/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/AbstractR2DbcInstrumentationAutoConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public abstract class AbstractR2DbcInstrumentationAutoConfigurationTest {
2121

2222
protected abstract AutoConfigurations autoConfigurations();
2323

24-
protected final ApplicationContextRunner contextRunner =
24+
private final ApplicationContextRunner contextRunner =
2525
new ApplicationContextRunner()
2626
.withConfiguration(autoConfigurations())
2727
.withBean("openTelemetry", OpenTelemetry.class, testing()::getOpenTelemetry);

0 commit comments

Comments
 (0)