use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class CassandraSpanConsumerTest method serviceSpanKeys.
@Test
public void serviceSpanKeys() {
Span span = spanWithoutAnnotationsOrTags;
AggregateCall<?, Void> call = (AggregateCall<?, Void>) consumer.accept(singletonList(span));
assertThat(call.delegate()).filteredOn(c -> c instanceof InsertEntry).extracting("input").containsExactly(entry(FRONTEND.serviceName(), span.name()));
}
use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class TraceTest method cleanupComparator_transitiveKindComparison.
/**
* Comparators are meant to be transitive. This exploits edge cases to fool our comparator.
*/
@Test
public void cleanupComparator_transitiveKindComparison() {
List<Span> trace = new ArrayList<>();
Endpoint aEndpoint = Endpoint.newBuilder().serviceName("a").build();
Endpoint bEndpoint = Endpoint.newBuilder().serviceName("b").build();
Span template = Span.newBuilder().traceId("a").id("a").build();
// when there are at least 32 elements.
for (int i = 0, length = 7; i < length; i++) {
trace.add(template.toBuilder().shared(true).localEndpoint(bEndpoint).build());
trace.add(template.toBuilder().kind(Kind.CLIENT).localEndpoint(bEndpoint).build());
trace.add(template.toBuilder().localEndpoint(aEndpoint).build());
trace.add(template);
trace.add(template.toBuilder().kind(Kind.CLIENT).localEndpoint(aEndpoint).build());
}
Collections.sort(trace, Trace.CLEANUP_COMPARATOR);
assertThat(new LinkedHashSet<>(trace)).extracting(Span::shared, Span::kind, s -> s.localServiceName()).containsExactly(tuple(null, Kind.CLIENT, "a"), tuple(null, Kind.CLIENT, "b"), tuple(null, null, null), tuple(null, null, "a"), tuple(true, null, "b"));
}
use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class V1ThriftSpanWriterTest method writesEmptySpanName.
@Test
public void writesEmptySpanName() {
Span span = Span.newBuilder().traceId("1").id("2").build();
writer.write(span, buf);
assertThat(bytes).containsSequence(ThriftField.TYPE_STRING, 0, 3, 0, 0, 0, // name (empty is 32 zero bits)
0);
}
use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class V1ThriftSpanWriterTest method writesEmptyAnnotationAndBinaryAnnotations.
/**
* For finagle compatibility
*/
@Test
public void writesEmptyAnnotationAndBinaryAnnotations() {
Span span = Span.newBuilder().traceId("1").id("2").build();
writer.write(span, buf);
assertThat(bytes).containsSequence(TYPE_LIST, 0, 6, TYPE_STRUCT, 0, 0, 0, // empty annotations
0).containsSequence(TYPE_LIST, 0, 8, TYPE_STRUCT, 0, 0, 0, // empty binary annotations
0);
}
use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class InMemoryStorageTest method getTraces_byTraceIds.
@Test
public void getTraces_byTraceIds() throws IOException {
Span trace1Span1 = Span.newBuilder().traceId("1").id("1").name("root").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
Span trace1Span2 = Span.newBuilder().traceId("1").parentId("1").id("2").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
Span trace2Span1 = Span.newBuilder().traceId("2").id("1").name("root").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
Span trace2Span2 = Span.newBuilder().traceId("2").parentId("1").id("2").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
storage.accept(asList(trace1Span1, trace1Span2, trace2Span1, trace2Span2)).execute();
assertThat(storage.getTraces(asList("1", "2")).execute()).containsExactly(asList(trace1Span1, trace1Span2), asList(trace2Span1, trace2Span2));
}
Aggregations