Remove servlet.context span attribute (#1783)

This commit is contained in:
Trask Stalnaker 2020-11-28 10:50:26 -08:00 committed by GitHub
parent cc07597ef4
commit 66b4088450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 49 deletions

View File

@ -54,7 +54,6 @@ public class HttpJspPageInstrumentation implements TypeInstrumentation {
@Advice.Local("otelSpan") Span span, @Advice.Local("otelSpan") Span span,
@Advice.Local("otelScope") Scope scope) { @Advice.Local("otelScope") Scope scope) {
span = tracer().startSpan(tracer().spanNameOnRender(req), Kind.INTERNAL); span = tracer().startSpan(tracer().spanNameOnRender(req), Kind.INTERNAL);
span.setAttribute("servlet.context", req.getContextPath());
tracer().onRender(span, req); tracer().onRender(span, req);
scope = span.makeCurrent(); scope = span.makeCurrent();
} }

View File

@ -10,7 +10,6 @@ import io.opentelemetry.instrumentation.api.tracer.BaseTracer;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import javax.servlet.RequestDispatcher; import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.HttpJspPage; import javax.servlet.jsp.HttpJspPage;
import org.apache.jasper.JspCompilationContext; import org.apache.jasper.JspCompilationContext;
@ -32,11 +31,6 @@ public class JspTracer extends BaseTracer {
public void onCompile(Span span, JspCompilationContext jspCompilationContext) { public void onCompile(Span span, JspCompilationContext jspCompilationContext) {
if (jspCompilationContext != null) { if (jspCompilationContext != null) {
ServletContext servletContext = jspCompilationContext.getServletContext();
if (servletContext != null) {
span.setAttribute("servlet.context", servletContext.getContextPath());
}
Compiler compiler = jspCompilationContext.getCompiler(); Compiler compiler = jspCompilationContext.getCompiler();
if (compiler != null) { if (compiler != null) {
span.setAttribute("jsp.compiler", compiler.getClass().getName()); span.setAttribute("jsp.compiler", compiler.getClass().getName());

View File

@ -113,7 +113,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Compile /$jspFileName" name "Compile /$jspFileName"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.$jspClassNamePrefix$jspClassName" "jsp.classFQCN" "org.apache.jsp.$jspClassNamePrefix$jspClassName"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -123,7 +122,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Render /$jspFileName" name "Render /$jspFileName"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -174,7 +172,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Compile /getQuery.jsp" name "Compile /getQuery.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.getQuery_jsp" "jsp.classFQCN" "org.apache.jsp.getQuery_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -184,7 +181,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Render /getQuery.jsp" name "Render /getQuery.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -232,7 +228,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Compile /post.jsp" name "Compile /post.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.post_jsp" "jsp.classFQCN" "org.apache.jsp.post_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -242,7 +237,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Render /post.jsp" name "Render /post.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -299,7 +293,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Compile /$jspFileName" name "Compile /$jspFileName"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.$jspClassName" "jsp.classFQCN" "org.apache.jsp.$jspClassName"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -321,7 +314,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
} }
} }
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -371,7 +363,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Compile /includes/includeHtml.jsp" name "Compile /includes/includeHtml.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.includes.includeHtml_jsp" "jsp.classFQCN" "org.apache.jsp.includes.includeHtml_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -381,7 +372,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Render /includes/includeHtml.jsp" name "Render /includes/includeHtml.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -425,7 +415,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Compile /includes/includeMulti.jsp" name "Compile /includes/includeMulti.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.includes.includeMulti_jsp" "jsp.classFQCN" "org.apache.jsp.includes.includeMulti_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -435,7 +424,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Render /includes/includeMulti.jsp" name "Render /includes/includeMulti.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -444,7 +432,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Compile /common/javaLoopH2.jsp" name "Compile /common/javaLoopH2.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -454,7 +441,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Render /common/javaLoopH2.jsp" name "Render /common/javaLoopH2.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -463,7 +449,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Compile /common/javaLoopH2.jsp" name "Compile /common/javaLoopH2.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -473,7 +458,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
name "Render /common/javaLoopH2.jsp" name "Render /common/javaLoopH2.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -519,7 +503,6 @@ class JspInstrumentationBasicTests extends AgentTestRunner {
errored true errored true
errorEvent(JasperException, String) errorEvent(JasperException, String)
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.$jspClassNamePrefix$jspClassName" "jsp.classFQCN" "org.apache.jsp.$jspClassNamePrefix$jspClassName"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }

View File

@ -111,7 +111,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /$forwardFromFileName" name "Compile /$forwardFromFileName"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.$jspForwardFromClassPrefix$jspForwardFromClassName" "jsp.classFQCN" "org.apache.jsp.$jspForwardFromClassPrefix$jspForwardFromClassName"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -121,7 +120,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /$forwardFromFileName" name "Render /$forwardFromFileName"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -130,7 +128,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /$forwardDestFileName" name "Compile /$forwardDestFileName"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.$jspForwardDestClassPrefix$jspForwardDestClassName" "jsp.classFQCN" "org.apache.jsp.$jspForwardDestClassPrefix$jspForwardDestClassName"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -140,7 +137,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /$forwardDestFileName" name "Render /$forwardDestFileName"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.forwardOrigin" "/$forwardFromFileName" "jsp.forwardOrigin" "/$forwardFromFileName"
"jsp.requestURL" baseUrl + "/$forwardDestFileName" "jsp.requestURL" baseUrl + "/$forwardDestFileName"
} }
@ -190,7 +186,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /forwards/forwardToHtml.jsp" name "Compile /forwards/forwardToHtml.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.forwards.forwardToHtml_jsp" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToHtml_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -200,7 +195,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /forwards/forwardToHtml.jsp" name "Render /forwards/forwardToHtml.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -244,7 +238,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /forwards/forwardToIncludeMulti.jsp" name "Compile /forwards/forwardToIncludeMulti.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.forwards.forwardToIncludeMulti_jsp" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToIncludeMulti_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -254,7 +247,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /forwards/forwardToIncludeMulti.jsp" name "Render /forwards/forwardToIncludeMulti.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -263,7 +255,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /includes/includeMulti.jsp" name "Compile /includes/includeMulti.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.includes.includeMulti_jsp" "jsp.classFQCN" "org.apache.jsp.includes.includeMulti_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -273,7 +264,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /includes/includeMulti.jsp" name "Render /includes/includeMulti.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp" "jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp"
"jsp.requestURL" baseUrl + "/includes/includeMulti.jsp" "jsp.requestURL" baseUrl + "/includes/includeMulti.jsp"
} }
@ -283,7 +273,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /common/javaLoopH2.jsp" name "Compile /common/javaLoopH2.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -293,7 +282,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /common/javaLoopH2.jsp" name "Render /common/javaLoopH2.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp" "jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp"
"jsp.requestURL" baseUrl + "/includes/includeMulti.jsp" "jsp.requestURL" baseUrl + "/includes/includeMulti.jsp"
} }
@ -303,7 +291,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /common/javaLoopH2.jsp" name "Compile /common/javaLoopH2.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -313,7 +300,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /common/javaLoopH2.jsp" name "Render /common/javaLoopH2.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp" "jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp"
"jsp.requestURL" baseUrl + "/includes/includeMulti.jsp" "jsp.requestURL" baseUrl + "/includes/includeMulti.jsp"
} }
@ -358,7 +344,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /forwards/forwardToJspForward.jsp" name "Compile /forwards/forwardToJspForward.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.forwards.forwardToJspForward_jsp" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToJspForward_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -368,7 +353,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /forwards/forwardToJspForward.jsp" name "Render /forwards/forwardToJspForward.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -377,7 +361,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /forwards/forwardToSimpleJava.jsp" name "Compile /forwards/forwardToSimpleJava.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.forwards.forwardToSimpleJava_jsp" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToSimpleJava_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -387,7 +370,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /forwards/forwardToSimpleJava.jsp" name "Render /forwards/forwardToSimpleJava.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.forwardOrigin" "/forwards/forwardToJspForward.jsp" "jsp.forwardOrigin" "/forwards/forwardToJspForward.jsp"
"jsp.requestURL" baseUrl + "/forwards/forwardToSimpleJava.jsp" "jsp.requestURL" baseUrl + "/forwards/forwardToSimpleJava.jsp"
} }
@ -397,7 +379,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /common/loop.jsp" name "Compile /common/loop.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.common.loop_jsp" "jsp.classFQCN" "org.apache.jsp.common.loop_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -407,7 +388,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /common/loop.jsp" name "Render /common/loop.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.forwardOrigin" "/forwards/forwardToJspForward.jsp" "jsp.forwardOrigin" "/forwards/forwardToJspForward.jsp"
"jsp.requestURL" baseUrl + "/common/loop.jsp" "jsp.requestURL" baseUrl + "/common/loop.jsp"
} }
@ -453,7 +433,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /forwards/forwardToCompileError.jsp" name "Compile /forwards/forwardToCompileError.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.forwards.forwardToCompileError_jsp" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToCompileError_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -464,7 +443,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
errored true errored true
errorEvent(JasperException, String) errorEvent(JasperException, String)
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }
@ -474,7 +452,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
errored true errored true
errorEvent(JasperException, String) errorEvent(JasperException, String)
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.compileError_jsp" "jsp.classFQCN" "org.apache.jsp.compileError_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -519,7 +496,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Compile /forwards/forwardToNonExistent.jsp" name "Compile /forwards/forwardToNonExistent.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.classFQCN" "org.apache.jsp.forwards.forwardToNonExistent_jsp" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToNonExistent_jsp"
"jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler"
} }
@ -529,7 +505,6 @@ class JspInstrumentationForwardTests extends AgentTestRunner {
name "Render /forwards/forwardToNonExistent.jsp" name "Render /forwards/forwardToNonExistent.jsp"
errored false errored false
attributes { attributes {
"servlet.context" "/$jspWebappContext"
"jsp.requestURL" reqUrl "jsp.requestURL" reqUrl
} }
} }