コード例 #1
0
  /** 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);
  }
コード例 #2
0
  /** 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);
  }