Search in sources :

Example 6 with Span

use of com.google.devtools.cloudtrace.v2.Span in project brave by openzipkin.

the class ITTracingFilter_Consumer method onTransportException_addsErrorTag_async.

@Test
public void onTransportException_addsErrorTag_async() throws Exception {
    server.stop();
    RpcContext.getContext().asyncCall(() -> client.get().sayHello("romeo"));
    Span span = spans.take();
    assertThat(span.tags().get("error")).contains("RemotingException");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 7 with Span

use of com.google.devtools.cloudtrace.v2.Span in project brave by openzipkin.

the class ITTracingFilter_Provider method usesExistingTraceId.

@Test
public void usesExistingTraceId() throws Exception {
    final String traceId = "463ac35c9f6413ad";
    final String parentId = traceId;
    final String spanId = "48485a3953bb6124";
    RpcContext.getContext().getAttachments().put("X-B3-TraceId", traceId);
    RpcContext.getContext().getAttachments().put("X-B3-ParentSpanId", parentId);
    RpcContext.getContext().getAttachments().put("X-B3-SpanId", spanId);
    RpcContext.getContext().getAttachments().put("X-B3-Sampled", "1");
    client.get().sayHello("jorge");
    Span span = spans.take();
    assertThat(span.traceId()).isEqualTo(traceId);
    assertThat(span.parentId()).isEqualTo(parentId);
    assertThat(span.id()).isEqualTo(spanId);
    assertThat(span.shared()).isTrue();
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 8 with Span

use of com.google.devtools.cloudtrace.v2.Span in project brave by openzipkin.

the class ITTracingFilter_Provider method defaultSpanNameIsMethodName.

@Test
public void defaultSpanNameIsMethodName() throws Exception {
    client.get().sayHello("jorge");
    Span span = spans.take();
    assertThat(span.name()).isEqualTo("genericservice/sayhello");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 9 with Span

use of com.google.devtools.cloudtrace.v2.Span in project brave by openzipkin.

the class ITTracingClientInterceptor method clientParserTest.

@Test
public void clientParserTest() throws Exception {
    closeClient(client);
    tracing = tracing.toBuilder().clientParser(new GrpcClientParser() {

        @Override
        protected <M> void onMessageSent(M message, SpanCustomizer span) {
            span.tag("grpc.message_sent", message.toString());
            if (tracing.tracing().currentTraceContext().get() != null) {
                span.tag("grpc.message_sent.visible", "true");
            }
        }

        @Override
        protected <M> void onMessageReceived(M message, SpanCustomizer span) {
            span.tag("grpc.message_received", message.toString());
            if (tracing.tracing().currentTraceContext().get() != null) {
                span.tag("grpc.message_received.visible", "true");
            }
        }

        @Override
        protected <ReqT, RespT> String spanName(MethodDescriptor<ReqT, RespT> methodDescriptor) {
            return methodDescriptor.getType().name();
        }
    }).build();
    client = newClient();
    GreeterGrpc.newBlockingStub(client).sayHello(HELLO_REQUEST);
    Span span = spans.take();
    assertThat(span.name()).isEqualTo("unary");
    assertThat(span.tags()).containsKeys("grpc.message_received", "grpc.message_sent", "grpc.message_received.visible", "grpc.message_sent.visible");
}
Also used : SpanCustomizer(brave.SpanCustomizer) Span(zipkin2.Span) Test(org.junit.Test)

Example 10 with Span

use of com.google.devtools.cloudtrace.v2.Span in project brave by openzipkin.

the class ITTracingClientInterceptor method defaultSpanNameIsMethodName.

@Test
public void defaultSpanNameIsMethodName() throws Exception {
    GreeterGrpc.newBlockingStub(client).sayHello(HELLO_REQUEST);
    Span span = spans.take();
    assertThat(span.name()).isEqualTo("helloworld.greeter/sayhello");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)334 Test (org.junit.Test)237 Test (org.junit.jupiter.api.Test)84 ArrayList (java.util.ArrayList)45 Endpoint (zipkin2.Endpoint)43 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)41 Span (io.opentelemetry.proto.trace.v1.Span)35 List (java.util.List)23 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)20 V1Span (zipkin2.v1.V1Span)17 Span (com.google.devtools.cloudtrace.v2.Span)16 Map (java.util.Map)15 AggregateCall (zipkin2.internal.AggregateCall)13 Arrays.asList (java.util.Arrays.asList)11 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)11 Annotation (wavefront.report.Annotation)11 Trace (com.google.devtools.cloudtrace.v1.Trace)10 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)10 AttributeValue (com.google.devtools.cloudtrace.v2.AttributeValue)10 ByteString (com.google.protobuf.ByteString)9