Clean up old operation name terminology (#3282)
This commit is contained in:
parent
b8cddc0dd8
commit
b25ac0f1ad
|
@ -274,8 +274,4 @@ class Aws0ClientTest extends AgentInstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
String expectedOperationName(String method) {
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -244,8 +244,4 @@ abstract class AbstractAws1ClientTest extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
String expectedOperationName(String method) {
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -544,8 +544,4 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
String expectedOperationName(String method) {
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,8 +78,4 @@ class Elasticsearch5RestClientTest extends AgentInstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
String expectedOperationName(String method) {
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,8 +73,4 @@ class Elasticsearch6RestClientTest extends AgentInstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
String expectedOperationName(String method) {
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,8 +120,4 @@ class Elasticsearch7RestClientTest extends AgentInstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
String expectedOperationName(String method) {
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpURLConnection> implements
|
|||
}
|
||||
}
|
||||
span(1) {
|
||||
name expectedOperationName("GET")
|
||||
name "HTTP GET"
|
||||
kind CLIENT
|
||||
childOf span(0)
|
||||
attributes {
|
||||
|
@ -124,7 +124,7 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpURLConnection> implements
|
|||
}
|
||||
}
|
||||
span(3) {
|
||||
name expectedOperationName("GET")
|
||||
name "HTTP GET"
|
||||
kind CLIENT
|
||||
childOf span(0)
|
||||
attributes {
|
||||
|
@ -172,7 +172,7 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpURLConnection> implements
|
|||
}
|
||||
}
|
||||
span(1) {
|
||||
name expectedOperationName("GET")
|
||||
name "HTTP GET"
|
||||
kind CLIENT
|
||||
childOf span(0)
|
||||
attributes {
|
||||
|
@ -230,7 +230,7 @@ class HttpUrlConnectionTest extends HttpClientTest<HttpURLConnection> implements
|
|||
}
|
||||
}
|
||||
span(1) {
|
||||
name expectedOperationName("POST")
|
||||
name "HTTP POST"
|
||||
kind CLIENT
|
||||
childOf span(0)
|
||||
attributes {
|
||||
|
|
|
@ -38,7 +38,7 @@ class UrlConnectionTest extends AgentInstrumentationSpecification {
|
|||
errorEvent ConnectException, String
|
||||
}
|
||||
span(1) {
|
||||
name expectedOperationName("GET")
|
||||
name "HTTP GET"
|
||||
kind CLIENT
|
||||
childOf span(0)
|
||||
status ERROR
|
||||
|
@ -60,8 +60,4 @@ class UrlConnectionTest extends AgentInstrumentationSpecification {
|
|||
|
||||
url = new URI("$scheme://localhost:$UNUSABLE_PORT").toURL()
|
||||
}
|
||||
|
||||
String expectedOperationName(String method) {
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ abstract class JaxRsClientTest extends HttpClientTest<Invocation.Builder> implem
|
|||
trace(0, 2) {
|
||||
span(0) {
|
||||
hasNoParent()
|
||||
name expectedOperationName(method)
|
||||
name "HTTP $method"
|
||||
kind CLIENT
|
||||
status ERROR
|
||||
attributes {
|
||||
|
|
|
@ -56,10 +56,6 @@ abstract class PlayWsClientTestBaseBase<REQUEST> extends HttpClientTest<REQUEST>
|
|||
system?.terminate()
|
||||
}
|
||||
|
||||
String expectedOperationName() {
|
||||
return "play-ws.request"
|
||||
}
|
||||
|
||||
@Override
|
||||
int maxRedirects() {
|
||||
3
|
||||
|
|
|
@ -16,18 +16,15 @@ import rx.__OpenTelemetryTracingUtil;
|
|||
|
||||
public class TracedOnSubscribe<T> implements Observable.OnSubscribe<T> {
|
||||
private final Observable.OnSubscribe<T> delegate;
|
||||
private final String operationName;
|
||||
private final String spanName;
|
||||
private final Context parentContext;
|
||||
private final BaseTracer tracer;
|
||||
private final SpanKind spanKind;
|
||||
|
||||
public TracedOnSubscribe(
|
||||
Observable<T> originalObservable,
|
||||
String operationName,
|
||||
BaseTracer tracer,
|
||||
SpanKind spanKind) {
|
||||
Observable<T> originalObservable, String spanName, BaseTracer tracer, SpanKind spanKind) {
|
||||
delegate = __OpenTelemetryTracingUtil.extractOnSubscribe(originalObservable);
|
||||
this.operationName = operationName;
|
||||
this.spanName = spanName;
|
||||
this.tracer = tracer;
|
||||
this.spanKind = spanKind;
|
||||
|
||||
|
@ -36,7 +33,7 @@ public class TracedOnSubscribe<T> implements Observable.OnSubscribe<T> {
|
|||
|
||||
@Override
|
||||
public void call(Subscriber<? super T> subscriber) {
|
||||
Context context = tracer.startSpan(parentContext, operationName, spanKind);
|
||||
Context context = tracer.startSpan(parentContext, spanName, spanKind);
|
||||
decorateSpan(Span.fromContext(context));
|
||||
try (Scope ignored = context.makeCurrent()) {
|
||||
delegate.call(new TracedSubscriber<>(context, subscriber, tracer));
|
||||
|
|
|
@ -25,17 +25,14 @@ public class AdviceUtils {
|
|||
|
||||
public static final String CONTEXT_ATTRIBUTE = AdviceUtils.class.getName() + ".Context";
|
||||
|
||||
public static String parseOperationName(Object handler) {
|
||||
public static String spanNameForHandler(Object handler) {
|
||||
String className = SpanNames.spanNameForClass(handler.getClass());
|
||||
String operationName;
|
||||
int lambdaIdx = className.indexOf("$$Lambda$");
|
||||
|
||||
if (lambdaIdx > -1) {
|
||||
operationName = className.substring(0, lambdaIdx) + ".lambda";
|
||||
} else {
|
||||
operationName = className + ".handle";
|
||||
return className.substring(0, lambdaIdx) + ".lambda";
|
||||
}
|
||||
return operationName;
|
||||
return className + ".handle";
|
||||
}
|
||||
|
||||
public static <T> Mono<T> setPublisherSpan(
|
||||
|
|
|
@ -70,19 +70,19 @@ public class HandlerAdapterInstrumentation implements TypeInstrumentation {
|
|||
if (handler != null && context != null) {
|
||||
Span span = Span.fromContext(context);
|
||||
String handlerType;
|
||||
String operationName;
|
||||
String spanName;
|
||||
|
||||
if (handler instanceof HandlerMethod) {
|
||||
// Special case for requests mapped with annotations
|
||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||
operationName = SpanNames.spanNameForMethod(handlerMethod.getMethod());
|
||||
spanName = SpanNames.spanNameForMethod(handlerMethod.getMethod());
|
||||
handlerType = handlerMethod.getMethod().getDeclaringClass().getName();
|
||||
} else {
|
||||
operationName = AdviceUtils.parseOperationName(handler);
|
||||
spanName = AdviceUtils.spanNameForHandler(handler);
|
||||
handlerType = handler.getClass().getName();
|
||||
}
|
||||
|
||||
span.updateName(operationName);
|
||||
span.updateName(spanName);
|
||||
if (SpringWebfluxConfig.captureExperimentalSpanAttributes()) {
|
||||
span.setAttribute("spring-webflux.handler.type", handlerType);
|
||||
}
|
||||
|
|
|
@ -608,8 +608,4 @@ class TwilioClientTest extends AgentInstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
String expectedOperationName(String method) {
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -969,12 +969,8 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
|
||||
String expectedOperationName(String method) {
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
|
||||
String expectedClientSpanName(URI uri, String method) {
|
||||
return expectedOperationName(method)
|
||||
return method != null ? "HTTP $method" : "HTTP request"
|
||||
}
|
||||
|
||||
void assertClientSpanErrorEvent(SpanAssert spanAssert, URI uri, Throwable exception) {
|
||||
|
|
|
@ -25,13 +25,13 @@ class TraceUtils {
|
|||
|
||||
private static final Tracer tracer = GlobalOpenTelemetry.getTracer("test")
|
||||
|
||||
static <T> T runUnderServerTrace(final String rootOperationName, final Callable<T> r) {
|
||||
return ServerTraceUtils.runUnderServerTrace(rootOperationName, r)
|
||||
static <T> T runUnderServerTrace(String spanName, Callable<T> r) {
|
||||
return ServerTraceUtils.runUnderServerTrace(spanName, r)
|
||||
}
|
||||
|
||||
static <T> T runUnderTrace(final String rootOperationName, final Callable<T> r) {
|
||||
static <T> T runUnderTrace(String spanName, Callable<T> r) {
|
||||
try {
|
||||
final Span span = tracer.spanBuilder(rootOperationName).setSpanKind(SpanKind.INTERNAL).startSpan()
|
||||
Span span = tracer.spanBuilder(spanName).setSpanKind(SpanKind.INTERNAL).startSpan()
|
||||
|
||||
try {
|
||||
def result = span.makeCurrent().withCloseable {
|
||||
|
@ -39,7 +39,7 @@ class TraceUtils {
|
|||
}
|
||||
span.end()
|
||||
return result
|
||||
} catch (final Exception e) {
|
||||
} catch (Exception e) {
|
||||
span.setStatus(StatusCode.ERROR)
|
||||
span.recordException(e instanceof ExecutionException ? e.getCause() : e)
|
||||
span.end()
|
||||
|
@ -100,8 +100,8 @@ class TraceUtils {
|
|||
}
|
||||
}
|
||||
|
||||
static <T> T runUnderTraceWithoutExceptionCatch(final String rootOperationName, final Callable<T> r) {
|
||||
final Span span = tracer.spanBuilder(rootOperationName).setSpanKind(SpanKind.INTERNAL).startSpan()
|
||||
static <T> T runUnderTraceWithoutExceptionCatch(String spanName, Callable<T> r) {
|
||||
Span span = tracer.spanBuilder(spanName).setSpanKind(SpanKind.INTERNAL).startSpan()
|
||||
|
||||
try {
|
||||
return span.makeCurrent().withCloseable {
|
||||
|
|
Loading…
Reference in New Issue