Add servlet.path tag

This commit is contained in:
Tyler Benson 2019-11-11 15:54:21 -08:00
parent fecaa8d084
commit fdf2241e5f
8 changed files with 19 additions and 0 deletions

View File

@ -101,6 +101,7 @@ class GlassFishServerTest extends HttpServerTest<GlassFish, Servlet3Decorator> {
} }
tags { tags {
"servlet.context" "/$context" "servlet.context" "/$context"
"servlet.path" endpoint.path
"span.origin.type" { it.startsWith("TestServlets\$") || it == DefaultServlet.name } "span.origin.type" { it.startsWith("TestServlets\$") || it == DefaultServlet.name }
defaultTags(true) defaultTags(true)

View File

@ -56,6 +56,7 @@ public class JettyDecorator
assert span != null; assert span != null;
if (request != null) { if (request != null) {
span.setTag("servlet.context", request.getContextPath()); span.setTag("servlet.context", request.getContextPath());
span.setTag("servlet.path", request.getServletPath());
} }
return super.onRequest(span, request); return super.onRequest(span, request);
} }

View File

@ -102,6 +102,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/$jspFileName"
"http.status_code" 200 "http.status_code" 200
defaultTags() defaultTags()
} }
@ -177,6 +178,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/getQuery.jsp"
"http.status_code" 200 "http.status_code" 200
defaultTags() defaultTags()
} }
@ -249,6 +251,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/post.jsp"
"http.status_code" 200 "http.status_code" 200
defaultTags() defaultTags()
} }
@ -318,6 +321,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/$jspFileName"
"http.status_code" 500 "http.status_code" 500
"error" true "error" true
"error.type" { String tagExceptionType -> "error.type" { String tagExceptionType ->
@ -408,6 +412,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/includes/includeHtml.jsp"
"http.status_code" 200 "http.status_code" 200
defaultTags() defaultTags()
} }
@ -476,6 +481,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/includes/includeMulti.jsp"
"http.status_code" 200 "http.status_code" 200
defaultTags() defaultTags()
} }
@ -600,6 +606,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/$jspFileName"
"http.status_code" 500 "http.status_code" 500
errorTags(JasperException, String) errorTags(JasperException, String)
defaultTags() defaultTags()

View File

@ -101,6 +101,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/$forwardFromFileName"
"http.status_code" 200 "http.status_code" 200
defaultTags() defaultTags()
} }
@ -203,6 +204,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/forwards/forwardToHtml.jsp"
"http.status_code" 200 "http.status_code" 200
defaultTags() defaultTags()
} }
@ -271,6 +273,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/forwards/forwardToIncludeMulti.jsp"
"http.status_code" 200 "http.status_code" 200
defaultTags() defaultTags()
} }
@ -426,6 +429,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/forwards/forwardToJspForward.jsp"
"http.status_code" 200 "http.status_code" 200
defaultTags() defaultTags()
} }
@ -552,6 +556,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/forwards/forwardToCompileError.jsp"
"http.status_code" 500 "http.status_code" 500
errorTags(JasperException, String) errorTags(JasperException, String)
defaultTags() defaultTags()
@ -637,6 +642,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
"component" "java-web-servlet" "component" "java-web-servlet"
"span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain"
"servlet.context" "/$jspWebappContext" "servlet.context" "/$jspWebappContext"
"servlet.path" "/forwards/forwardToNonExistent.jsp"
"http.status_code" 404 "http.status_code" 404
defaultTags() defaultTags()
} }

View File

@ -62,6 +62,7 @@ public class Servlet2Decorator
assert span != null; assert span != null;
if (request != null) { if (request != null) {
span.setTag("servlet.context", request.getContextPath()); span.setTag("servlet.context", request.getContextPath());
span.setTag("servlet.path", request.getServletPath());
} }
return super.onRequest(span, request); return super.onRequest(span, request);
} }

View File

@ -57,6 +57,7 @@ public class Servlet3Decorator
assert span != null; assert span != null;
if (request != null) { if (request != null) {
span.setTag("servlet.context", request.getContextPath()); span.setTag("servlet.context", request.getContextPath());
span.setTag("servlet.path", request.getServletPath());
} }
return super.onRequest(span, request); return super.onRequest(span, request);
} }

View File

@ -83,6 +83,7 @@ abstract class AbstractServlet3Test<SERVER, CONTEXT> extends HttpServerTest<SERV
} }
tags { tags {
"servlet.context" "/$context" "servlet.context" "/$context"
"servlet.path" endpoint.path
"span.origin.type" { it == servlet.name || it == ApplicationFilterChain.name } "span.origin.type" { it == servlet.name || it == ApplicationFilterChain.name }
defaultTags(true) defaultTags(true)

View File

@ -126,6 +126,7 @@ class SpringBootBasedTest extends HttpServerTest<ConfigurableApplicationContext,
} }
tags { tags {
"span.origin.type" ApplicationFilterChain.name "span.origin.type" ApplicationFilterChain.name
"servlet.path" endpoint.path
defaultTags(true) defaultTags(true)
"$Tags.COMPONENT" serverDecorator.component() "$Tags.COMPONENT" serverDecorator.component()