/** Sleuth host corresponds to annotation/binaryAnnotation.host in zipkin. */ @Test public void annotationsIncludeHost() { span.log("http/request/retry"); span.tag("spring-boot/version", "1.3.1.RELEASE"); io.zipkin.Span result = ZipkinMessageListener.convert(span, host); assertThat(result.annotations.get(0).endpoint).isEqualTo(endpoint); assertThat(result.binaryAnnotations.get(0).endpoint) .isEqualTo(result.annotations.get(0).endpoint); }
/** Sleuth timestamps are millisecond granularity while zipkin is microsecond. */ @Test public void convertsTimestampAndDurationToMicroseconds() { long start = System.currentTimeMillis(); span.log("http/request/retry"); // System.currentTimeMillis io.zipkin.Span result = ZipkinMessageListener.convert(span, host); assertThat(result.timestamp).isEqualTo(span.getBegin() * 1000); assertThat(result.duration).isEqualTo((span.getEnd() - span.getBegin()) * 1000); assertThat(result.annotations.get(0).timestamp) .isGreaterThanOrEqualTo(start * 1000) .isLessThanOrEqualTo(System.currentTimeMillis() * 1000); }