diff --git a/dd-java-agent/instrumentation/glassfish/src/test/groovy/GlassFishServerTest.groovy b/dd-java-agent/instrumentation/glassfish/src/test/groovy/GlassFishServerTest.groovy index 653c4616b2..db48bdb9bb 100644 --- a/dd-java-agent/instrumentation/glassfish/src/test/groovy/GlassFishServerTest.groovy +++ b/dd-java-agent/instrumentation/glassfish/src/test/groovy/GlassFishServerTest.groovy @@ -101,6 +101,7 @@ class GlassFishServerTest extends HttpServerTest { } tags { "servlet.context" "/$context" + "servlet.path" endpoint.path "span.origin.type" { it.startsWith("TestServlets\$") || it == DefaultServlet.name } defaultTags(true) diff --git a/dd-java-agent/instrumentation/jetty-8/src/main/java/datadog/trace/instrumentation/jetty8/JettyDecorator.java b/dd-java-agent/instrumentation/jetty-8/src/main/java/datadog/trace/instrumentation/jetty8/JettyDecorator.java index 7fbd3b889e..16101b2fbb 100644 --- a/dd-java-agent/instrumentation/jetty-8/src/main/java/datadog/trace/instrumentation/jetty8/JettyDecorator.java +++ b/dd-java-agent/instrumentation/jetty-8/src/main/java/datadog/trace/instrumentation/jetty8/JettyDecorator.java @@ -56,6 +56,7 @@ public class JettyDecorator assert span != null; if (request != null) { span.setTag("servlet.context", request.getContextPath()); + span.setTag("servlet.path", request.getServletPath()); } return super.onRequest(span, request); } diff --git a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy index 8322337bb5..39f2c66e01 100644 --- a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy +++ b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy @@ -102,6 +102,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/$jspFileName" "http.status_code" 200 defaultTags() } @@ -177,6 +178,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/getQuery.jsp" "http.status_code" 200 defaultTags() } @@ -249,6 +251,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/post.jsp" "http.status_code" 200 defaultTags() } @@ -318,6 +321,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/$jspFileName" "http.status_code" 500 "error" true "error.type" { String tagExceptionType -> @@ -408,6 +412,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/includes/includeHtml.jsp" "http.status_code" 200 defaultTags() } @@ -476,6 +481,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/includes/includeMulti.jsp" "http.status_code" 200 defaultTags() } @@ -600,6 +606,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/$jspFileName" "http.status_code" 500 errorTags(JasperException, String) defaultTags() diff --git a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy index fac699d4b4..b0b0c33cc1 100644 --- a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy +++ b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy @@ -101,6 +101,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/$forwardFromFileName" "http.status_code" 200 defaultTags() } @@ -203,6 +204,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/forwards/forwardToHtml.jsp" "http.status_code" 200 defaultTags() } @@ -271,6 +273,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/forwards/forwardToIncludeMulti.jsp" "http.status_code" 200 defaultTags() } @@ -426,6 +429,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/forwards/forwardToJspForward.jsp" "http.status_code" 200 defaultTags() } @@ -552,6 +556,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/forwards/forwardToCompileError.jsp" "http.status_code" 500 errorTags(JasperException, String) defaultTags() @@ -637,6 +642,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { "component" "java-web-servlet" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" + "servlet.path" "/forwards/forwardToNonExistent.jsp" "http.status_code" 404 defaultTags() } diff --git a/dd-java-agent/instrumentation/servlet/request-2/src/main/java/datadog/trace/instrumentation/servlet2/Servlet2Decorator.java b/dd-java-agent/instrumentation/servlet/request-2/src/main/java/datadog/trace/instrumentation/servlet2/Servlet2Decorator.java index 6b3378679b..9853d4ded6 100644 --- a/dd-java-agent/instrumentation/servlet/request-2/src/main/java/datadog/trace/instrumentation/servlet2/Servlet2Decorator.java +++ b/dd-java-agent/instrumentation/servlet/request-2/src/main/java/datadog/trace/instrumentation/servlet2/Servlet2Decorator.java @@ -62,6 +62,7 @@ public class Servlet2Decorator assert span != null; if (request != null) { span.setTag("servlet.context", request.getContextPath()); + span.setTag("servlet.path", request.getServletPath()); } return super.onRequest(span, request); } diff --git a/dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/Servlet3Decorator.java b/dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/Servlet3Decorator.java index 1ce2a8873e..45cb915f75 100644 --- a/dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/Servlet3Decorator.java +++ b/dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/Servlet3Decorator.java @@ -57,6 +57,7 @@ public class Servlet3Decorator assert span != null; if (request != null) { span.setTag("servlet.context", request.getContextPath()); + span.setTag("servlet.path", request.getServletPath()); } return super.onRequest(span, request); } diff --git a/dd-java-agent/instrumentation/servlet/request-3/src/test/groovy/AbstractServlet3Test.groovy b/dd-java-agent/instrumentation/servlet/request-3/src/test/groovy/AbstractServlet3Test.groovy index bc4a25b570..84718d17e9 100644 --- a/dd-java-agent/instrumentation/servlet/request-3/src/test/groovy/AbstractServlet3Test.groovy +++ b/dd-java-agent/instrumentation/servlet/request-3/src/test/groovy/AbstractServlet3Test.groovy @@ -83,6 +83,7 @@ abstract class AbstractServlet3Test extends HttpServerTest