Search in sources :

Example 1 with InMemoryStorage

use of zipkin.storage.InMemoryStorage in project zipkin by openzipkin.

the class ScribeCollectorTest method check_failsWhenNotStarted.

@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();
    }
}
Also used : InMemoryStorage(zipkin.storage.InMemoryStorage) CheckResult(zipkin.Component.CheckResult) Test(org.junit.Test)

Example 2 with InMemoryStorage

use of zipkin.storage.InMemoryStorage in project zipkin by openzipkin.

the class CassandraDependenciesTest method processDependencies.

/**
   * 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);
}
Also used : InMemoryStorage(zipkin.storage.InMemoryStorage) DependencyLink(zipkin.DependencyLink)

Example 3 with InMemoryStorage

use of zipkin.storage.InMemoryStorage in project zipkin by openzipkin.

the class ElasticsearchHttpDependenciesTest method processDependencies.

/**
   * The current implementation does not include dependency aggregation. It includes retrieval of
   * pre-aggregated links.
   */
@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 midnightUTC = midnightUTC(guessTimestamp(MergeById.apply(spans).get(0)) / 1000);
    InternalForTests.writeDependencyLinks(storage(), links, midnightUTC);
}
Also used : InMemoryStorage(zipkin.storage.InMemoryStorage) DependencyLink(zipkin.DependencyLink)

Example 4 with InMemoryStorage

use of zipkin.storage.InMemoryStorage in project zipkin by openzipkin.

the class ElasticsearchDependenciesTest method processDependencies.

/**
   * 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(guessTimestamp(MergeById.apply(spans).get(0)) / 1000);
    writeDependencyLinks(links, midnight);
}
Also used : InMemoryStorage(zipkin.storage.InMemoryStorage) DependencyLink(zipkin.DependencyLink)

Example 5 with InMemoryStorage

use of zipkin.storage.InMemoryStorage in project zipkin by openzipkin.

the class CassandraDependenciesTest method processDependencies.

/**
   * 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(guessTimestamp(MergeById.apply(spans).get(0)) / 1000);
    new CassandraDependenciesWriter(storage.session.get()).write(links, midnight);
}
Also used : InMemoryStorage(zipkin.storage.InMemoryStorage) DependencyLink(zipkin.DependencyLink)

Aggregations

InMemoryStorage (zipkin.storage.InMemoryStorage)6 DependencyLink (zipkin.DependencyLink)4 Test (org.junit.Test)2 CheckResult (zipkin.Component.CheckResult)1