Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public final class ServletContextPath {
private static final ContextKey<ServletContextPath> CONTEXT_KEY =
ContextKey.named("opentelemetry-servlet-context-path-key");

@Nullable private final String contextPath;

private ServletContextPath(@Nullable String contextPath) {
this.contextPath = contextPath;
}

public static <REQUEST> Context init(
Context context, Function<REQUEST, String> contextPathExtractor, REQUEST request) {
ServletContextPath servletContextPath = context.get(CONTEXT_KEY);
Expand All @@ -45,12 +51,6 @@ public static <REQUEST> Context init(
return context.with(CONTEXT_KEY, new ServletContextPath(contextPath));
}

@Nullable private final String contextPath;

private ServletContextPath(@Nullable String contextPath) {
this.contextPath = contextPath;
}

/**
* Returns a concatenation of a servlet context path stored in the given {@code context} and a
* given {@code spanName}. If there is no servlet path stored in the context, returns {@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@
import io.opentelemetry.instrumentation.servlet.internal.ServletResponseContext;
import java.util.concurrent.atomic.AtomicBoolean;

public class AsyncRequestCompletionListener<REQUEST, RESPONSE>
implements ServletAsyncListener<RESPONSE> {
class AsyncRequestCompletionListener<REQUEST, RESPONSE> implements ServletAsyncListener<RESPONSE> {
private final ServletHelper<REQUEST, RESPONSE> servletHelper;
private final Instrumenter<ServletRequestContext<REQUEST>, ServletResponseContext<RESPONSE>>
instrumenter;
private final ServletRequestContext<REQUEST> requestContext;
private final Context context;
private final AtomicBoolean responseHandled = new AtomicBoolean();

public AsyncRequestCompletionListener(
AsyncRequestCompletionListener(
ServletHelper<REQUEST, RESPONSE> servletHelper,
Instrumenter<ServletRequestContext<REQUEST>, ServletResponseContext<RESPONSE>> instrumenter,
ServletRequestContext<REQUEST> requestContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;

public class AsyncRunnableWrapper<REQUEST> implements Runnable {
class AsyncRunnableWrapper<REQUEST> implements Runnable {
private final ServletHelper<REQUEST, ?> helper;
private final Runnable runnable;
private final Context context;
Expand All @@ -19,7 +19,7 @@ private AsyncRunnableWrapper(ServletHelper<REQUEST, ?> helper, Runnable runnable
this.context = Context.current();
}

public static <REQUEST> Runnable wrap(ServletHelper<REQUEST, ?> helper, Runnable runnable) {
static <REQUEST> Runnable wrap(ServletHelper<REQUEST, ?> helper, Runnable runnable) {
if (runnable == null || runnable instanceof AsyncRunnableWrapper) {
return runnable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public void onEnd(
setAttributes(request, attributes::put);
}

private static AttributeKey<List<String>> parameterAttributeKey(String headerName) {
private static AttributeKey<List<String>> parameterAttributeKey(String parameterName) {
return parameterKeysCache.computeIfAbsent(
headerName, ServletRequestParametersExtractor::createKey);
parameterName, ServletRequestParametersExtractor::createKey);
}

private static AttributeKey<List<String>> createKey(String parameterName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void beforeChunk(ChunkContext chunkContext) {
}

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

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

@Override
public boolean equals(@Nullable Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies {
latestDepTestLibrary("ch.qos.logback:logback-classic:latest.release")
}

tasks.withType<Test>().configureEach {
tasks.test {
// required on jdk17
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ description: >
and spring-webflux to instrument Spring Boot applications. It does not produce telemetry on its
own. This instrumentation is mostly used as part of the Spring Boot starter.
library_link: https://spring.io/projects/spring-boot
configurations:
- name: otel.instrumentation.kafka.autoconfigure-interceptor
declarative_name: java.kafka.autoconfigure_interceptor
description: >
Enable automatic configuration of tracing interceptors on
`ConcurrentKafkaListenerContainerFactory` using a `BeanPostProcessor`. You may disable this if
you wish to manually configure these interceptors.
type: boolean
default: true
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class AbstractKafkaInstrumentationAutoConfigurationTest {

protected abstract void factoryTestAssertion(AssertableApplicationContext context);

protected final ApplicationContextRunner contextRunner =
private final ApplicationContextRunner contextRunner =
new ApplicationContextRunner()
.withConfiguration(autoConfigurations())
.withBean("openTelemetry", OpenTelemetry.class, OpenTelemetry::noop);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class AbstractMicrometerBridgeAutoConfigurationTest {

protected abstract Class<?> getMeterRegistryClass();

protected final ApplicationContextRunner contextRunner =
private final ApplicationContextRunner contextRunner =
new ApplicationContextRunner()
.withBean(OpenTelemetry.class, OpenTelemetry::noop)
.withConfiguration(autoConfigurations());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public abstract class AbstractR2DbcInstrumentationAutoConfigurationTest {

protected abstract AutoConfigurations autoConfigurations();

protected final ApplicationContextRunner contextRunner =
private final ApplicationContextRunner contextRunner =
new ApplicationContextRunner()
.withConfiguration(autoConfigurations())
.withBean("openTelemetry", OpenTelemetry.class, testing()::getOpenTelemetry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class AbstractRestClientInstrumentationAutoConfigurationTest {

protected abstract ClientHttpRequestInterceptor getInterceptor(OpenTelemetry openTelemetry);

protected final ApplicationContextRunner contextRunner =
private final ApplicationContextRunner contextRunner =
new ApplicationContextRunner()
.withBean(OpenTelemetry.class, OpenTelemetry::noop)
.withBean(RestClient.class, RestClient::create)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public abstract class AbstractSpringWebInstrumentationAutoConfigurationTest {

protected abstract AutoConfigurations autoConfigurations();

protected final ApplicationContextRunner contextRunner =
private final ApplicationContextRunner contextRunner =
new ApplicationContextRunner()
.withBean(OpenTelemetry.class, OpenTelemetry::noop)
.withBean(RestTemplate.class, RestTemplate::new)
Expand Down
Loading