Use more semantic attributes (#1905)

This commit is contained in:
Trask Stalnaker 2020-12-14 19:45:38 -08:00 committed by GitHub
parent e2264222ce
commit 84873ea687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -8,6 +8,7 @@ package io.opentelemetry.javaagent.instrumentation.struts2;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.attributes.SemanticAttributes;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.instrumentation.api.tracer.BaseTracer;
@ -29,9 +30,9 @@ public class Struts2Tracer extends BaseTracer {
Span strutsSpan = tracer.spanBuilder(spanName).startSpan();
strutsSpan.setAttribute("code.namespace", actionClass.getName());
strutsSpan.setAttribute(SemanticAttributes.CODE_NAMESPACE, actionClass.getName());
if (method != null) {
strutsSpan.setAttribute("code.function", method);
strutsSpan.setAttribute(SemanticAttributes.CODE_FUNCTION, method);
}
return strutsSpan;