Move constant away from deprecated class
MODIFY
instrumentation/servlet/servlet-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/AsyncDispatchAdvice.java
instrumentation/servlet/servlet-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/AsyncDispatchAdvice.java
package io.opentelemetry.javaagent.instrumentation.servlet.v3_0;
-import static io.opentelemetry.instrumentation.api.tracer.HttpServerTracer.CONTEXT_ATTRIBUTE;
+import static io.opentelemetry.javaagent.instrumentation.servlet.ServletHelper.CONTEXT_ATTRIBUTE;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Context;

MODIFY
instrumentation/servlet/servlet-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v5_0/async/AsyncDispatchAdvice.java
instrumentation/servlet/servlet-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v5_0/async/AsyncDispatchAdvice.java
package io.opentelemetry.javaagent.instrumentation.servlet.v5_0.async;
-import static io.opentelemetry.instrumentation.api.tracer.HttpServerTracer.CONTEXT_ATTRIBUTE;
+import static io.opentelemetry.javaagent.instrumentation.servlet.ServletHelper.CONTEXT_ATTRIBUTE;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Context;

MODIFY
instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/BaseServletHelper.java
instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/BaseServletHelper.java
@@ -16,7 +16,6 @@ import io.opentelemetry.instrumentation.api.servlet.AppServerBridge;
import io.opentelemetry.instrumentation.api.servlet.MappingResolver;
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
-import io.opentelemetry.instrumentation.api.tracer.HttpServerTracer;
import io.opentelemetry.instrumentation.servlet.ServletAccessor;
import io.opentelemetry.instrumentation.servlet.naming.ServletSpanNameProvider;
import java.util.function.Function;
@@ -65,12 +64,12 @@ public abstract class BaseServletHelper<REQUEST, RESPONSE> {
}
public Context getServerContext(REQUEST request) {
- Object context = accessor.getRequestAttribute(request, HttpServerTracer.CONTEXT_ATTRIBUTE);
+ Object context = accessor.getRequestAttribute(request, ServletHelper.CONTEXT_ATTRIBUTE);
return context instanceof Context ? (Context) context : null;
}
private void attachServerContext(Context context, REQUEST request) {
- accessor.setRequestAttribute(request, HttpServerTracer.CONTEXT_ATTRIBUTE, context);
+ accessor.setRequestAttribute(request, ServletHelper.CONTEXT_ATTRIBUTE, context);
}
public void recordException(Context context, Throwable throwable) {

MODIFY
instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHelper.java
instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHelper.java
@@ -15,6 +15,7 @@ public class ServletHelper<REQUEST, RESPONSE> extends BaseServletHelper<REQUEST,
ServletHelper.class.getName() + ".AsyncListener";
private static final String ASYNC_LISTENER_RESPONSE_ATTRIBUTE =
ServletHelper.class.getName() + ".AsyncListenerResponse";
+ public static final String CONTEXT_ATTRIBUTE = ServletHelper.class.getName() + ".Context";
public ServletHelper(
Instrumenter<ServletRequestContext<REQUEST>, ServletResponseContext<RESPONSE>> instrumenter,

MODIFY
instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHelper.java
instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHelper.java
@@ -9,7 +9,6 @@ import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.servlet.AppServerBridge;
-import io.opentelemetry.instrumentation.api.tracer.HttpServerTracer;
import io.opentelemetry.javaagent.instrumentation.servlet.ServletHelper;
import org.apache.coyote.Request;
import org.apache.coyote.Response;
@@ -34,7 +33,7 @@ public class TomcatHelper<REQUEST, RESPONSE> {
public Context start(Context parentContext, Request request) {
Context context = instrumenter.start(parentContext, request);
- request.setAttribute(HttpServerTracer.CONTEXT_ATTRIBUTE, context);
+ request.setAttribute(ServletHelper.CONTEXT_ATTRIBUTE, context);
return context;
}

Move constant away from deprecated class (#4487)