Update servlet attr names to match log attr names
MODIFY
instrumentation-core/servlet-2.2/src/main/java/io/opentelemetry/instrumentation/servlet/ServletHttpServerTracer.java
instrumentation-core/servlet-2.2/src/main/java/io/opentelemetry/instrumentation/servlet/ServletHttpServerTracer.java
@@ -32,8 +32,8 @@ public abstract class ServletHttpServerTracer<RESPONSE>
SpanContext spanContext = Span.fromContext(context).getSpanContext();
// we do this e.g. so that servlet containers can use these values in their access logs
- request.setAttribute("traceId", spanContext.getTraceId());
- request.setAttribute("spanId", spanContext.getSpanId());
+ request.setAttribute("trace_id", spanContext.getTraceId());
+ request.setAttribute("span_id", spanContext.getSpanId());
return context;
}

MODIFY
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/TomcatServlet3Test.groovy
instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/TomcatServlet3Test.groovy
@@ -280,8 +280,8 @@ class TestAccessLogValve extends ValveBase implements AccessLog {
void log(Request request, Response response, long time) {
synchronized (loggedIds) {
- loggedIds.add(new Tuple2(request.getAttribute("traceId"),
- request.getAttribute("spanId")))
+ loggedIds.add(new Tuple2(request.getAttribute("trace_id"),
+ request.getAttribute("span_id")))
loggedIds.notifyAll()
}
}

Update servlet attr names to match log attr names (#2593)