use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class ITSpanStoreHeavy method getTraces_manyTraces.
/**
* Formerly, a bug was present where cassandra didn't index more than bucket count traces per
* millisecond. This stores a lot of spans to ensure indexes work under high-traffic scenarios.
*/
@Test
protected void getTraces_manyTraces(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
Span span = spanBuilder(testSuffix).build();
Map.Entry<String, String> tag = span.tags().entrySet().iterator().next();
int traceCount = 1000;
Span[] traces = new Span[traceCount];
traces[0] = span;
IntStream.range(1, traces.length).forEach(i -> traces[i] = spanBuilder(testSuffix).timestamp((TODAY + i) * 1000).duration(10L).build());
accept(traces);
assertGetTracesReturnsCount(requestBuilder().limit(traceCount).build(), traceCount);
QueryRequest.Builder builder = requestBuilder().limit(traceCount).serviceName(span.localServiceName());
assertGetTracesReturnsCount(builder.build(), traceCount);
assertGetTracesReturnsCount(builder.remoteServiceName(span.remoteServiceName()).build(), traceCount);
assertGetTracesReturnsCount(builder.spanName(span.name()).build(), traceCount);
assertGetTracesReturnsCount(builder.parseAnnotationQuery(tag.getKey() + "=" + tag.getValue()).build(), traceCount);
}
use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class ITSpanStoreHeavy method traceWithManySpans.
// Bugs have happened in the past where trace limit was mistaken for span count.
@Test
protected void traceWithManySpans(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
Span span = spanBuilder(testSuffix).build();
int traceCount = 101;
Span[] spans = new Span[traceCount];
spans[0] = span;
IntStream.range(1, spans.length).forEach(i -> spans[i] = span.toBuilder().parentId(span.id()).id(i).timestamp((TODAY + i) * 1000).duration(10L).build());
accept(spans);
assertGetTracesReturns(requestBuilder().build(), asList(spans));
assertGetTraceReturns(span.traceId(), asList(spans));
}
use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class StrictTraceIdTest method traces.
List<List<Span>> traces() {
// 64-bit trace ID
Span span1 = Span.newBuilder().traceId(CLIENT_SPAN.traceId().substring(16)).id("1").name("1").putTag("foo", "1").timestamp(TODAY * 1000L).localEndpoint(FRONTEND).build();
// 128-bit trace ID prefixed by above
Span span2 = span1.toBuilder().traceId(CLIENT_SPAN.traceId()).name("2").putTag("foo", "2").build();
// Different 128-bit trace ID prefixed by above
Span span3 = span1.toBuilder().traceId("1" + span1.traceId()).name("3").putTag("foo", "3").build();
return new ArrayList<>(asList(asList(span1), asList(span2), asList(span3)));
}
use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class SpanConverterTest method server_clientAddress.
/**
* This shows a historical finagle span, which has client-side socket info.
*/
@Test
public void server_clientAddress() {
Span v2 = Span.newBuilder().traceId("1").id("2").name("get").kind(Kind.SERVER).localEndpoint(BACKEND).remoteEndpoint(FRONTEND.toBuilder().port(63840).build()).timestamp(TODAY).duration(207000L).addAnnotation(TODAY + 500L, "Gc(9,0.PSScavenge,2015-09-17 12:37:02 +0000,304.milliseconds+762.microseconds)").putTag("srv/finagle.version", "6.28.0").shared(true).build();
V1Span v1 = V1Span.newBuilder().traceId("1").id("2").name("get").addAnnotation(v2.timestampAsLong(), "sr", v2.localEndpoint()).addAnnotation(v2.timestampAsLong() + 500L, "Gc(9,0.PSScavenge,2015-09-17 12:37:02 +0000,304.milliseconds+762.microseconds)", v2.localEndpoint()).addAnnotation(v2.timestampAsLong() + v2.durationAsLong(), "ss", v2.localEndpoint()).addBinaryAnnotation("srv/finagle.version", "6.28.0", v2.localEndpoint().toBuilder().port(0).build()).addBinaryAnnotation("sa", v2.localEndpoint()).addBinaryAnnotation("ca", v2.remoteEndpoint()).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class CassandraSpanConsumerTest method searchDisabled_doesntIndex.
@Test
public void searchDisabled_doesntIndex() {
consumer = spanConsumer(CassandraStorage.newBuilder().searchEnabled(false));
Span span = spanWithoutAnnotationsOrTags.toBuilder().addAnnotation(TODAY * 1000L, "annotation").putTag("foo", "bar").duration(10000L).build();
assertThat(consumer.accept(singletonList(span))).extracting("input.annotation_query").satisfies(q -> assertThat(q).isNull());
}
Aggregations