use of zipkin.Span in project zipkin by openzipkin.
the class CassandraSpanConsumerTest method dontLogTimestampMissingOnMidTierServerSpan.
@Test
public void dontLogTimestampMissingOnMidTierServerSpan() {
Span span = TestObjects.TRACE.get(0);
accept(span);
verify(mockAppender, never()).doAppend(considerSwitchStrategyLog());
}
use of zipkin.Span in project zipkin by openzipkin.
the class CassandraSpanConsumerTest method doesntIndexSpansMissingDuration.
/**
* {@link Span#duration} == 0 is likely to be a mistake, and coerces to null. It is not helpful to
* index rows who have no duration.
*/
@Test
public void doesntIndexSpansMissingDuration() {
Span span = Span.builder().traceId(1L).id(1L).name("get").duration(0L).build();
accept(span);
assertThat(rowCount(Schema.TABLE_TRACE_BY_SERVICE_SPAN)).isZero();
}
use of zipkin.Span in project zipkin by openzipkin.
the class CassandraSpanStoreTest method rawTraceStoredWithoutAdjustments.
/** Cassandra indexing is performed separately, allowing the raw span to be stored unaltered. */
@Test
public void rawTraceStoredWithoutAdjustments() {
Span rawSpan = TestObjects.TRACE.get(0).toBuilder().timestamp(null).duration(null).build();
accept(rawSpan);
// At query time, timestamp and duration are added.
assertThat(store().getTrace(rawSpan.traceIdHigh, rawSpan.traceId)).containsExactly(ApplyTimestampAndDuration.apply(rawSpan));
// Unlike other stores, Cassandra can show that timestamp and duration weren't reported
assertThat(store().getRawTrace(rawSpan.traceIdHigh, rawSpan.traceId)).containsExactly(rawSpan);
}
use of zipkin.Span in project zipkin by openzipkin.
the class CassandraUtilTest method annotationKeys_skipsCoreAndAddressAnnotations.
@Test
public void annotationKeys_skipsCoreAndAddressAnnotations() throws Exception {
Span span = TestObjects.TRACE.get(1);
assertThat(span.annotations).extracting(a -> a.value).matches(Constants.CORE_ANNOTATIONS::containsAll);
assertThat(span.binaryAnnotations).extracting(b -> b.key).containsOnly(Constants.SERVER_ADDR, Constants.CLIENT_ADDR);
assertThat(CassandraUtil.annotationKeys(span)).isEmpty();
}
use of zipkin.Span in project zipkin by openzipkin.
the class ElasticsearchSpanConsumer method indexSpans.
BulkSpanIndexer indexSpans(BulkSpanIndexer indexer, List<Span> spans) throws IOException {
for (Span span : spans) {
Long timestamp = guessTimestamp(span);
Long timestampMillis;
// which index to store this span into
String index;
if (timestamp != null) {
timestampMillis = TimeUnit.MICROSECONDS.toMillis(timestamp);
index = indexNameFormatter.indexNameForTimestamp(timestampMillis);
} else {
timestampMillis = null;
index = indexNameFormatter.indexNameForTimestamp(System.currentTimeMillis());
}
indexer.add(index, span, timestampMillis);
}
return indexer;
}
Aggregations