Better span names for netty (#247)

This commit is contained in:
Trask Stalnaker 2020-03-19 19:01:32 -07:00 committed by GitHub
parent 5089a05c44
commit 11566b7e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 4 deletions

View File

@ -17,6 +17,7 @@ package io.opentelemetry.auto.instrumentation.netty40;
import static io.opentelemetry.auto.tooling.ClassLoaderMatcher.hasClassesNamed;
import static io.opentelemetry.auto.tooling.bytebuddy.matcher.AgentElementMatchers.implementsInterface;
import static io.opentelemetry.trace.Span.Kind.CLIENT;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.named;
@ -104,7 +105,7 @@ public class ChannelFutureListenerInstrumentation extends Instrumenter.Default {
final Scope parentScope = NettyHttpServerDecorator.TRACER.withSpan(parentSpan);
final Span errorSpan =
NettyHttpServerDecorator.TRACER.spanBuilder("netty.connect").startSpan();
NettyHttpServerDecorator.TRACER.spanBuilder("CONNECT").setSpanKind(CLIENT).startSpan();
errorSpan.setAttribute(Tags.COMPONENT, "netty");
try (final Scope scope = NettyHttpServerDecorator.TRACER.withSpan(errorSpan)) {
NettyHttpServerDecorator.DECORATE.onError(errorSpan, cause);

View File

@ -92,7 +92,7 @@ class Netty40ClientTest extends HttpClientTest {
// for up to a total of 10 seconds (default connection time limit)
for (def i = 1; i < size; i++) {
span(i) {
operationName "netty.connect"
operationName "CONNECT"
childOf span(0)
errored true
tags {

View File

@ -17,6 +17,7 @@ package io.opentelemetry.auto.instrumentation.netty41;
import static io.opentelemetry.auto.tooling.ClassLoaderMatcher.hasClassesNamed;
import static io.opentelemetry.auto.tooling.bytebuddy.matcher.AgentElementMatchers.implementsInterface;
import static io.opentelemetry.trace.Span.Kind.CLIENT;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.named;
@ -104,7 +105,7 @@ public class ChannelFutureListenerInstrumentation extends Instrumenter.Default {
final Scope parentScope = NettyHttpServerDecorator.TRACER.withSpan(parentSpan);
final Span errorSpan =
NettyHttpServerDecorator.TRACER.spanBuilder("netty.connect").startSpan();
NettyHttpServerDecorator.TRACER.spanBuilder("CONNECT").setSpanKind(CLIENT).startSpan();
errorSpan.setAttribute(Tags.COMPONENT, "netty");
try (final Scope scope = NettyHttpServerDecorator.TRACER.withSpan(errorSpan)) {
NettyHttpServerDecorator.DECORATE.onError(errorSpan, cause);

View File

@ -102,7 +102,7 @@ class Netty41ClientTest extends HttpClientTest {
// for up to a total of 10 seconds (default connection time limit)
for (def i = 1; i < size; i++) {
span(i) {
operationName "netty.connect"
operationName "CONNECT"
childOf span(0)
errored true
tags {