Search in sources :

Example 1 with BulkCallBuilder

use of zipkin2.elasticsearch.internal.BulkCallBuilder in project zipkin by openzipkin.

the class InternalForTests method writeDependencyLinks.

public static void writeDependencyLinks(ElasticsearchStorage es, List<DependencyLink> links, long midnightUTC) {
    String index = ((ElasticsearchSpanConsumer) es.spanConsumer()).formatTypeAndTimestampForInsert("dependency", midnightUTC);
    BulkCallBuilder indexer = new BulkCallBuilder(es, es.version(), "indexlinks");
    for (DependencyLink link : links) indexer.index(index, "dependency", link, DEPENDENCY_LINK_WRITER);
    try {
        indexer.build().execute();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : BulkCallBuilder(zipkin2.elasticsearch.internal.BulkCallBuilder) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) DependencyLink(zipkin2.DependencyLink)

Example 2 with BulkCallBuilder

use of zipkin2.elasticsearch.internal.BulkCallBuilder in project zipkin by openzipkin.

the class BulkRequestBenchmarks method buildAndWriteRequest_singleSpan.

@Benchmark
public HttpRequest buildAndWriteRequest_singleSpan() {
    BulkCallBuilder builder = new BulkCallBuilder(es, V6_0, "index-span");
    builder.index(spanIndex, "span", CLIENT_SPAN, BulkIndexWriter.SPAN);
    HttpCall.RequestSupplier supplier = builder.build().request;
    HttpRequestWriter request = HttpRequest.streaming(supplier.headers());
    supplier.writeBody(request::tryWrite);
    return request;
}
Also used : HttpCall(zipkin2.elasticsearch.internal.client.HttpCall) HttpRequestWriter(com.linecorp.armeria.common.HttpRequestWriter) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 3 with BulkCallBuilder

use of zipkin2.elasticsearch.internal.BulkCallBuilder in project zipkin by openzipkin.

the class BulkRequestBenchmarks method buildAndWriteRequest_tenSpans.

@Benchmark
public HttpRequest buildAndWriteRequest_tenSpans() {
    BulkCallBuilder builder = new BulkCallBuilder(es, V6_0, "index-span");
    for (int i = 0; i < 10; i++) {
        builder.index(spanIndex, "span", CLIENT_SPAN, BulkIndexWriter.SPAN);
    }
    HttpCall.RequestSupplier supplier = builder.build().request;
    HttpRequestWriter request = HttpRequest.streaming(supplier.headers());
    supplier.writeBody(request::tryWrite);
    return request;
}
Also used : HttpCall(zipkin2.elasticsearch.internal.client.HttpCall) HttpRequestWriter(com.linecorp.armeria.common.HttpRequestWriter) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Aggregations

HttpRequestWriter (com.linecorp.armeria.common.HttpRequestWriter)2 Benchmark (org.openjdk.jmh.annotations.Benchmark)2 HttpCall (zipkin2.elasticsearch.internal.client.HttpCall)2 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 DependencyLink (zipkin2.DependencyLink)1 BulkCallBuilder (zipkin2.elasticsearch.internal.BulkCallBuilder)1