jetty 9.4 behave differently from earlier versions
MODIFY
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/JettyServlet3Test.groovy
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/JettyServlet3Test.groovy
@@ -20,6 +20,15 @@ import org.eclipse.jetty.servlet.ServletContextHandler
abstract class JettyServlet3Test extends AbstractServlet3Test<Server, ServletContextHandler> {
+ private static final boolean IS_BEFORE_94 = isBefore94()
+
+ static isBefore94() {
+ def version = Server.getVersion().split("\\.")
+ def major = Integer.parseInt(version[0])
+ def minor = Integer.parseInt(version[1])
+ return major < 9 || (major == 9 && minor < 4)
+ }
+
@Override
boolean testNotFound() {
false
@@ -32,12 +41,12 @@ abstract class JettyServlet3Test extends AbstractServlet3Test<Server, ServletCon
@Override
boolean hasResponseSpan(ServerEndpoint endpoint) {
- return endpoint == EXCEPTION || super.hasResponseSpan(endpoint)
+ return (IS_BEFORE_94 && endpoint == EXCEPTION) || super.hasResponseSpan(endpoint)
}
@Override
void responseSpan(TraceAssert trace, int index, Object controllerSpan, Object handlerSpan, String method, ServerEndpoint endpoint) {
- if (endpoint == EXCEPTION) {
+ if (IS_BEFORE_94 && endpoint == EXCEPTION) {
sendErrorSpan(trace, index, handlerSpan)
}
super.responseSpan(trace, index, controllerSpan, handlerSpan, method, endpoint)

MODIFY
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/JettyServletHandlerTest.groovy
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/JettyServletHandlerTest.groovy
@@ -15,14 +15,23 @@ import org.eclipse.jetty.servlet.ServletHandler
class JettyServletHandlerTest extends AbstractServlet3Test<Server, ServletHandler> {
+ private static final boolean IS_BEFORE_94 = isBefore94()
+
+ static isBefore94() {
+ def version = Server.getVersion().split("\\.")
+ def major = Integer.parseInt(version[0])
+ def minor = Integer.parseInt(version[1])
+ return major < 9 || (major == 9 && minor < 4)
+ }
+
@Override
boolean hasResponseSpan(ServerEndpoint endpoint) {
- return endpoint == EXCEPTION || super.hasResponseSpan(endpoint)
+ return (IS_BEFORE_94 && endpoint == EXCEPTION) || super.hasResponseSpan(endpoint)
}
@Override
void responseSpan(TraceAssert trace, int index, Object controllerSpan, Object handlerSpan, String method, ServerEndpoint endpoint) {
- if (endpoint == EXCEPTION) {
+ if (IS_BEFORE_94 && endpoint == EXCEPTION) {
sendErrorSpan(trace, index, handlerSpan)
}
super.responseSpan(trace, index, controllerSpan, handlerSpan, method, endpoint)

jetty 9.4 behave differently from earlier versions (#2335)