当前位置: 首页>>代码示例>>Java>>正文


Java InMemoryStorage类代码示例

本文整理汇总了Java中zipkin.storage.InMemoryStorage的典型用法代码示例。如果您正苦于以下问题:Java InMemoryStorage类的具体用法?Java InMemoryStorage怎么用?Java InMemoryStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InMemoryStorage类属于zipkin.storage包,在下文中一共展示了InMemoryStorage类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: acceptsTrace

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
@Test
public void acceptsTrace() {
  storage = new InMemoryStorage();
  StorageConsumer storageConsumer = new StorageConsumer() {
    @Override Logger log() {
      return logger;
    }

    @Override protected StorageComponent tryCompute() {
      return storage;
    }
  };

  storageConsumer.accept(TestObjects.TRACE);
  assertThat(logger.lines())
      .extracting("level", "text")
      .containsExactly(tuple(LogLevel.DebugLevel, "Wrote 3 spans"));

  assertThat(storage.spanStore().getRawTrace(
      TestObjects.TRACE.get(0).traceIdHigh,
      TestObjects.TRACE.get(0).traceId
  )).isEqualTo(TestObjects.TRACE);
}
 
开发者ID:openzipkin,项目名称:zipkin-sparkstreaming,代码行数:24,代码来源:StorageConsumerTest.java

示例2: get_memoizes

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
@Test(timeout = 1000L)
public void get_memoizes() throws InterruptedException {
  AtomicInteger provisionCount = new AtomicInteger();

  StorageConsumer storageConsumer = new StorageConsumer() {
    @Override protected StorageComponent tryCompute() {
      provisionCount.incrementAndGet();
      return new InMemoryStorage();
    }
  };

  int getCount = 1000;
  CountDownLatch latch = new CountDownLatch(getCount);
  ExecutorService exec = Executors.newFixedThreadPool(10);
  for (int i = 0; i < getCount; i++) {
    exec.execute(() -> {
      storageConsumer.get();
      latch.countDown();
    });
  }
  latch.await();
  exec.shutdown();
  exec.awaitTermination(1, TimeUnit.SECONDS);

  assertThat(provisionCount.get()).isEqualTo(1);
}
 
开发者ID:openzipkin,项目名称:zipkin-sparkstreaming,代码行数:27,代码来源:StorageConsumerTest.java

示例3: setup

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
@Before
public void setup() {
  store = new InMemoryStorage();
  metrics = new InMemoryCollectorMetrics();

  collector = new SQSCollector.Builder()
      .queueUrl(sqsRule.queueUrl())
      .parallelism(2)
      .waitTimeSeconds(1) // using short wait time to make test teardown faster
      .endpointConfiguration(new EndpointConfiguration(sqsRule.queueUrl(), "us-east-1"))
      .credentialsProvider(new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x")))
      .metrics(metrics)
      .sampler(CollectorSampler.ALWAYS_SAMPLE)
      .storage(store)
      .build()
      .start();
}
 
开发者ID:openzipkin,项目名称:zipkin-aws,代码行数:18,代码来源:SQSCollectorTest.java

示例4: TestLazyRegisterEventProcessorFactoryWithHost

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
TestLazyRegisterEventProcessorFactoryWithHost() {
  super(EventHubCollector.newBuilder()
      .connectionString(
          "endpoint=sb://someurl.net;SharedAccessKeyName=dumbo;SharedAccessKey=uius7y8ewychsih")
      .storageConnectionString("UseDevelopmentStorage=true")
      .storage(new InMemoryStorage()));
}
 
开发者ID:openzipkin,项目名称:zipkin-azure,代码行数:8,代码来源:LazyRegisterEventProcessorFactoryWithHostTest.java

示例5: check_failsWhenNotStarted

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
@Test
public void check_failsWhenNotStarted() {
  try (ScribeCollector scribe =
           ScribeCollector.builder().storage(new InMemoryStorage()).port(12345).build()) {

    CheckResult result = scribe.check();
    assertThat(result.ok).isFalse();
    assertThat(result.exception)
        .isInstanceOf(IllegalStateException.class);

    scribe.start();
    assertThat(scribe.check().ok).isTrue();
  }
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:15,代码来源:ScribeCollectorTest.java

示例6: start_failsWhenCantBindPort

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
@Test
public void start_failsWhenCantBindPort() {
  thrown.expect(ChannelException.class);
  thrown.expectMessage("Failed to bind to: 0.0.0.0/0.0.0.0:12345");

  ScribeCollector.Builder builder =
      ScribeCollector.builder().storage(new InMemoryStorage()).port(12345);

  try (ScribeCollector first = builder.build().start()) {
    try (ScribeCollector samePort = builder.build().start()) {
    }
  }
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:14,代码来源:ScribeCollectorTest.java

示例7: processDependencies

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
/**
 * The current implementation does not include dependency aggregation. It includes retrieval of
 * pre-aggregated links.
 *
 * <p>This uses {@link InMemorySpanStore} to prepare links and {@link CassandraDependenciesWriter}
 * to store them.
 *
 * <p>Note: The zipkin-dependencies-spark doesn't use any of these classes: it reads and writes to
 * the keyspace directly.
 */
@Override
public void processDependencies(List<Span> spans) {
  InMemoryStorage mem = new InMemoryStorage();
  mem.spanConsumer().accept(spans);
  List<DependencyLink> links = mem.spanStore().getDependencies(TODAY + DAY, null);

  // This gets or derives a timestamp from the spans
  long midnight = midnightUTC(MergeById.apply(spans).get(0).timestamp / 1000);
  new CassandraDependenciesWriter(storage.session.get()).write(links, midnight);
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:21,代码来源:CassandraDependenciesTest.java

示例8: processDependencies

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
/**
 * The current implementation does not include dependency aggregation. It includes retrieval of
 * pre-aggregated links.
 *
 * <p>This uses {@link InMemorySpanStore} to prepare links and {@link #writeDependencyLinks(List,
 * long)}} to store them.
 */
@Override
public void processDependencies(List<Span> spans) {
  InMemoryStorage mem = new InMemoryStorage();
  mem.spanConsumer().accept(spans);
  List<DependencyLink> links = mem.spanStore().getDependencies(TODAY + DAY, null);

  // This gets or derives a timestamp from the spans
  long midnight = midnightUTC(MergeById.apply(spans).get(0).timestamp / 1000);
  writeDependencyLinks(links, midnight);
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:18,代码来源:ElasticsearchDependenciesTest.java

示例9: unsampledSpansArentStored

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
@Test
public void unsampledSpansArentStored() {
  collector = Collector.builder(Collector.class)
      .sampler(CollectorSampler.create(0f))
      .storage(new InMemoryStorage()).build();

  collector.accept(asList(span(Long.MIN_VALUE)), NOOP);

  assertThat(collector.storage.spanStore().getServiceNames()).isEmpty();
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:11,代码来源:CollectorTest.java

示例10: storage

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
@Bean
StorageComponent storage() {
    return new InMemoryStorage();
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:5,代码来源:EventHubCollectorAutoConfigurationTest.java

示例11: getBuilder

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
private EventHubCollector.Builder getBuilder(){
    return EventHubCollector.builder()
            .storage(new InMemoryStorage());

}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:6,代码来源:ZipkinEventProcessorTest.java

示例12: storage

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
@Bean
StorageComponent storage() {
  return new InMemoryStorage();
}
 
开发者ID:openzipkin,项目名称:zipkin-azure,代码行数:5,代码来源:ZipkinEventHubCollectorAutoConfigurationTest.java

示例13: storage

import zipkin.storage.InMemoryStorage; //导入依赖的package包/类
@Bean StorageComponent storage() {
  return new InMemoryStorage();
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:4,代码来源:ZipkinServerConfiguration.java


注:本文中的zipkin.storage.InMemoryStorage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。