IndexerTest.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:zipkin 作者:
/**
 * Most partition keys will not clash, as they are delimited differently. For example, spans index
 * partition keys are delimited with dots, and annotations with colons.
 *
 * <p>This tests an edge case, where a delimiter exists in a service name.
 */
@Test
public void entriesThatIncreaseGap_treatsIndexesSeparately() throws Exception {
  ConcurrentMap<PartitionKeyToTraceId, Pair<Long>> sharedState = Maps.newConcurrentMap();

  // If indexes were not implemented properly, the span index app.foo would be mistaken as the
  // first service index
  ImmutableSetMultimap<PartitionKeyToTraceId, Long> parsed =
      ImmutableSetMultimap.<PartitionKeyToTraceId, Long>builder()
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800050L)
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800110L)
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800125L)
          .put(new PartitionKeyToTraceId(SERVICE_SPAN_NAME_INDEX, "app.foo", 20), 1467676800000L)
          .build();

  assertThat(Indexer.entriesThatIncreaseGap(sharedState, parsed)).hasSameEntriesAs(
      ImmutableSetMultimap.<PartitionKeyToTraceId, Long>builder()
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800050L)
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800125L)
          .put(new PartitionKeyToTraceId(SERVICE_SPAN_NAME_INDEX, "app.foo", 20), 1467676800000L)
          .build()
  );
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号