Implement concurrency test for Async Servlets
MODIFY
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/JettyServlet3Test.groovy
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/JettyServlet3Test.groovy
@@ -146,6 +146,11 @@ class JettyServlet3TestAsync extends JettyServlet3Test {
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/807
return false
}
+
+ @Override
+ boolean testConcurrency() {
+ return true
+ }
}
class JettyServlet3TestFakeAsync extends JettyServlet3Test {
@@ -160,6 +165,11 @@ class JettyServlet3TestFakeAsync extends JettyServlet3Test {
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/807
return false
}
+
+ @Override
+ boolean testConcurrency() {
+ return true
+ }
}
class JettyServlet3TestForward extends JettyDispatchTest {

MODIFY
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/TestServlet3.groovy
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/TestServlet3.groovy
@@ -77,6 +77,11 @@ class TestServlet3 {
resp.writer.print(endpoint.body)
context.complete()
break
+ case INDEXED_CHILD:
+ Span.current().setAttribute("test.request.id", req.getParameter("id") as long)
+ resp.status = endpoint.status
+ context.complete()
+ break
case QUERY_PARAM:
resp.status = endpoint.status
resp.writer.print(req.queryString)
@@ -122,6 +127,10 @@ class TestServlet3 {
resp.status = endpoint.status
resp.writer.print(endpoint.body)
break
+ case INDEXED_CHILD:
+ Span.current().setAttribute("test.request.id", req.getParameter("id") as long)
+ resp.status = endpoint.status
+ break
case QUERY_PARAM:
resp.status = endpoint.status
resp.writer.print(req.queryString)

MODIFY
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/TomcatServlet3Test.groovy
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/TomcatServlet3Test.groovy
@@ -311,6 +311,11 @@ class TomcatServlet3TestAsync extends TomcatServlet3Test {
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/807
return false
}
+
+ @Override
+ boolean testConcurrency() {
+ return true
+ }
}
class TomcatServlet3TestFakeAsync extends TomcatServlet3Test {
@@ -325,6 +330,11 @@ class TomcatServlet3TestFakeAsync extends TomcatServlet3Test {
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/807
return false
}
+
+ @Override
+ boolean testConcurrency() {
+ return true
+ }
}
class TomcatServlet3TestForward extends TomcatDispatchTest {

Implement concurrency test for Async Servlets (#2899)