use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITTracingServerInterceptor method serverParserTestWithStreamingResponse.
@Test
public void serverParserTestWithStreamingResponse() throws Exception {
grpcTracing = grpcTracing.toBuilder().serverParser(new GrpcServerParser() {
int responsesSent = 0;
@Override
protected <M> void onMessageSent(M message, SpanCustomizer span) {
span.tag("grpc.message_sent." + responsesSent++, message.toString());
}
}).build();
init();
Iterator<HelloReply> replies = GreeterGrpc.newBlockingStub(client).sayHelloWithManyReplies(HELLO_REQUEST);
assertThat(replies).hasSize(10);
// all response messages are tagged to the same span
Span span = spans.take();
assertThat(span.tags()).hasSize(10);
}
use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITTracingServerInterceptor 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");
}
use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITHttp method takeSpan.
/**
* Call this to block until a span was reported
*/
protected Span takeSpan() throws InterruptedException {
Span result = spans.take();
assertThat(result.annotations()).extracting(Annotation::value).doesNotContain(CONTEXT_LEAK);
return result;
}
use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITHttpServer method httpPathTagExcludesQueryParams.
@Test
public void httpPathTagExcludesQueryParams() throws Exception {
get("/foo?z=2&yAA=1");
Span span = takeSpan();
assertThat(span.tags()).containsEntry("http.path", "/foo");
}
use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITHttpServer method usesExistingTraceId.
@Test
public void usesExistingTraceId() throws Exception {
String path = "/foo";
final String traceId = "463ac35c9f6413ad";
final String parentId = traceId;
final String spanId = "48485a3953bb6124";
get(new Request.Builder().url(url(path)).header("X-B3-TraceId", traceId).header("X-B3-ParentSpanId", parentId).header("X-B3-SpanId", spanId).header("X-B3-Sampled", "1").build());
Span span = takeSpan();
assertThat(span.traceId()).isEqualTo(traceId);
assertThat(span.parentId()).isEqualTo(parentId);
assertThat(span.id()).isEqualTo(spanId);
}
Aggregations