use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class ITDependencies method instrumentedProducerAndConsumer.
@Test
protected void instrumentedProducerAndConsumer(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
String traceId = newTraceId();
Endpoint kafka = suffixServiceName(TestObjects.KAFKA, testSuffix);
Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
List<Span> trace = asList(Span.newBuilder().traceId(traceId).id("10").name("send").timestamp((TODAY + 50L) * 1000L).duration(1).kind(Kind.PRODUCER).localEndpoint(frontend).remoteEndpoint(kafka).build(), Span.newBuilder().traceId(traceId).parentId("10").id("11").name("receive").timestamp((TODAY + 100) * 1000L).duration(1).kind(Kind.CONSUMER).remoteEndpoint(kafka).localEndpoint(backend).build());
processDependencies(trace);
assertThat(store().getDependencies(endTs(trace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(kafka.serviceName()).callCount(1).build(), DependencyLink.newBuilder().parent(kafka.serviceName()).child(backend.serviceName()).callCount(1).build());
}
use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class ITDependencies method annotationNamedErrorIsntError.
/**
* A timeline annotation named error is not a failed span. A tag/binary annotation is.
*/
@Test
protected void annotationNamedErrorIsntError(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).addAnnotation((TODAY + 72) * 1000, "error").build());
processDependencies(trace);
assertThat(store().getDependencies(endTs(trace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build());
}
use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class ITDependencies method getDependencies_linksMixedTraceId.
/**
* This tests that dependency linking ignores the high-bits of the trace ID when grouping spans
* for dependency links. This allows environments with 64-bit instrumentation to participate in
* the same trace as 128-bit instrumentation.
*/
@Test
protected void getDependencies_linksMixedTraceId(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> mixedTrace = asList(Span.newBuilder().traceId(traceId).id("1").name("get").kind(Kind.SERVER).timestamp(TODAY * 1000L).duration(350 * 1000L).localEndpoint(frontend).build(), // the server dropped traceIdHigh
Span.newBuilder().traceId(traceId.substring(16)).parentId("1").id("2").name("get").kind(Kind.SERVER).shared(true).timestamp((TODAY + 100) * 1000L).duration(250 * 1000L).localEndpoint(backend).build(), Span.newBuilder().traceId(traceId).parentId("1").id("2").kind(Kind.CLIENT).timestamp((TODAY + 50) * 1000L).duration(300 * 1000L).localEndpoint(frontend).build());
processDependencies(mixedTrace);
assertThat(store().getDependencies(endTs(mixedTrace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build());
}
use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class ElasticsearchSpanConsumerTest method searchDisabled_doesntAddTimestampMillis.
/**
* Less overhead as a span json isn't rewritten to include a millis timestamp
*/
@Test
void searchDisabled_doesntAddTimestampMillis() throws Exception {
storage.close();
storage = ElasticsearchStorage.newBuilder(() -> WebClient.of(server.httpUri())).searchEnabled(false).build();
ensureIndexTemplates(storage);
// for the bulk request
server.enqueue(SUCCESS_RESPONSE);
Span span = Span.newBuilder().traceId("20").id("20").name("get").timestamp(TODAY * 1000).build();
storage.spanConsumer().accept(asList(span)).execute();
assertThat(server.takeRequest().request().contentUtf8()).doesNotContain("timestamp_millis");
}
use of zipkin2.TestObjects.TODAY in project zipkin by openzipkin.
the class ElasticsearchSpanStoreTest method searchDisabled_doesntMakeRemoteQueryRequests.
@Test
void searchDisabled_doesntMakeRemoteQueryRequests() throws Exception {
storage.close();
storage = ElasticsearchStorage.newBuilder(() -> WebClient.of(server.httpUri())).searchEnabled(false).build();
// skip template check
ElasticsearchSpanStore spanStore = new ElasticsearchSpanStore(storage);
QueryRequest request = QueryRequest.newBuilder().endTs(TODAY).lookback(DAY).limit(10).build();
assertThat(spanStore.getTraces(request).execute()).isEmpty();
assertThat(spanStore.getServiceNames().execute()).isEmpty();
assertThat(spanStore.getSpanNames("icecream").execute()).isEmpty();
assertThat(server.takeRequest(100, TimeUnit.MILLISECONDS)).isNull();
}
Aggregations