use of com.google.devtools.cloudtrace.v2.Span in project zipkin by openzipkin.
the class ITDependencies method duplicateAddress.
/**
* This test confirms that the span store can process trace with intermediate spans like the below
* properly.
* <p>
* span1: SR SS span2: intermediate call span3: CS SR SS CR: Dependency 1
*/
@Test
protected void duplicateAddress(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
String traceId = newTraceId();
Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
V1SpanConverter converter = V1SpanConverter.create();
List<Span> trace = new ArrayList<>();
converter.convert(V1Span.newBuilder().traceId(traceId).id("20").name("get").timestamp(TODAY * 1000L).duration(350L * 1000L).addAnnotation(TODAY * 1000, "sr", frontend).addAnnotation((TODAY + 350) * 1000, "ss", frontend).addBinaryAnnotation("ca", frontend).addBinaryAnnotation("sa", frontend).build(), trace);
converter.convert(V1Span.newBuilder().traceId(traceId).parentId("21").id("22").name("get").timestamp((TODAY + 50) * 1000L).duration(250L * 1000L).addAnnotation((TODAY + 50) * 1000, "cs", frontend).addAnnotation((TODAY + 300) * 1000, "cr", frontend).addBinaryAnnotation("ca", backend).addBinaryAnnotation("sa", backend).build(), trace);
processDependencies(trace);
assertThat(store().getDependencies(TODAY + 1000, 1000L).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build());
}
use of com.google.devtools.cloudtrace.v2.Span in project zipkin by openzipkin.
the class ITDependencies method oneway.
/**
* Span starts on one host and ends on the other. In both cases, a response is neither sent nor
* received.
*/
@Test
protected void oneway(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
String traceId = newTraceId();
Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
List<Span> trace = asList(Span.newBuilder().traceId(traceId).id("10").timestamp((TODAY + 50) * 1000).kind(Kind.CLIENT).localEndpoint(frontend).build(), Span.newBuilder().traceId(traceId).id("10").shared(true).timestamp((TODAY + 100) * 1000).kind(Kind.SERVER).localEndpoint(backend).build());
processDependencies(trace);
assertThat(store().getDependencies(endTs(trace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build());
}
use of com.google.devtools.cloudtrace.v2.Span in project zipkin by openzipkin.
the class ITDependencies method instrumentedClientAndServer.
@Test
protected void instrumentedClientAndServer(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
String traceId = newTraceId();
Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
Endpoint db = suffixServiceName(TestObjects.DB, testSuffix);
List<Span> trace = asList(Span.newBuilder().traceId(traceId).id("10").name("get").timestamp((TODAY + 50L) * 1000L).duration(250L * 1000L).kind(Kind.CLIENT).localEndpoint(frontend).build(), Span.newBuilder().traceId(traceId).id("10").name("get").shared(true).timestamp((TODAY + 100) * 1000L).duration(150L * 1000L).kind(Kind.SERVER).localEndpoint(backend).build(), Span.newBuilder().traceId(traceId).parentId("10").id("11").name("get").timestamp((TODAY + 150L) * 1000L).duration(50L * 1000L).kind(Kind.CLIENT).localEndpoint(backend).remoteEndpoint(db).build());
processDependencies(trace);
assertThat(store().getDependencies(endTs(trace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build(), DependencyLink.newBuilder().parent(backend.serviceName()).child(db.serviceName()).callCount(1).build());
}
use of com.google.devtools.cloudtrace.v2.Span in project zipkin by openzipkin.
the class ITDependenciesHeavy method manyLinks.
/**
* Ensure there's no query limit problem around links
*/
@Test
protected void manyLinks() throws Exception {
// Larger than 10, which is the default ES search limit that tripped this
int count = 1000;
List<Span> spans = new ArrayList<>(count);
for (int i = 1; i <= count; i++) {
String traceId = newTraceId();
Endpoint web = FRONTEND.toBuilder().serviceName("web-" + i).build();
Endpoint app = BACKEND.toBuilder().serviceName("app-" + i).build();
Endpoint db = DB.toBuilder().serviceName("db-" + i).build();
spans.add(Span.newBuilder().traceId(traceId).id("10").name("get").timestamp((TODAY + 50L) * 1000L).duration(250L * 1000L).kind(Kind.CLIENT).localEndpoint(web).build());
spans.add(Span.newBuilder().traceId(traceId).id("10").name("get").shared(true).timestamp((TODAY + 100) * 1000L).duration(150 * 1000L).kind(Kind.SERVER).localEndpoint(app).build());
spans.add(Span.newBuilder().traceId(traceId).parentId("10").id("11").name("get").timestamp((TODAY + 150L) * 1000L).duration(50L * 1000L).kind(Kind.CLIENT).localEndpoint(app).remoteEndpoint(db).build());
}
processDependencies(spans);
List<DependencyLink> links = store().getDependencies(endTs(spans), DAY).execute();
// web-? -> app-?, app-? -> db-?
assertThat(links).hasSize(count * 2);
assertThat(links).extracting(DependencyLink::callCount).allSatisfy(callCount -> assertThat(callCount).isEqualTo(1));
}
use of com.google.devtools.cloudtrace.v2.Span in project zipkin by openzipkin.
the class ITSearchEnabledFalse method getTraces_indexDataReturnsNothing.
@Test
protected void getTraces_indexDataReturnsNothing(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
Span clientSpan = newClientSpan(testSuffix);
accept(clientSpan);
assertGetTracesReturnsEmpty(requestBuilder().build());
assertGetTracesReturnsEmpty(requestBuilder().serviceName(clientSpan.localServiceName()).build());
assertGetTracesReturnsEmpty(requestBuilder().spanName(clientSpan.name()).build());
assertGetTracesReturnsEmpty(requestBuilder().annotationQuery(clientSpan.tags()).build());
assertGetTracesReturnsEmpty(requestBuilder().minDuration(clientSpan.duration()).build());
}
Aggregations