use of zipkin2.elasticsearch.ElasticsearchStorage.Builder in project zipkin by openzipkin.
the class ZipkinElasticsearchStorageConfiguration method esClientFactory.
// exposed as a bean so that we can test TLS by swapping it out.
// TODO: see if we can override the TLS via properties instead as that has less surface area.
@Bean
@Qualifier(QUALIFIER)
@ConditionalOnMissingBean
ClientFactory esClientFactory(ZipkinElasticsearchStorageProperties es, MeterRegistry meterRegistry) throws Exception {
ClientFactoryBuilder builder = ClientFactory.builder();
Ssl ssl = es.getSsl();
if (ssl.isNoVerify())
builder.tlsNoVerify();
// Allow use of a custom KeyStore or TrustStore when connecting to Elasticsearch
if (ssl.getKeyStore() != null || ssl.getTrustStore() != null)
configureSsl(builder, ssl);
// TODO: find or raise a bug with Elastic
return builder.useHttp2Preface(false).connectTimeoutMillis(es.getTimeout()).meterRegistry(meterRegistry).build();
}
use of zipkin2.elasticsearch.ElasticsearchStorage.Builder in project zipkin by openzipkin.
the class ITZipkinSelfTracing method assertQueryReturnsResults.
void assertQueryReturnsResults(QueryRequest.Builder builder, List<List<Span>> traces) throws IOException {
QueryRequest query = builder.endTs(System.currentTimeMillis()).lookback(DAY).limit(2).build();
assertThat(inMemoryStorage().getTraces(query).execute()).withFailMessage("Expected results from %s. Current traces: %s", query, traces).isNotEmpty();
}
use of zipkin2.elasticsearch.ElasticsearchStorage.Builder in project zipkin by openzipkin.
the class ITSpanStoreHeavy method getTraces_manyTraces.
/**
* Formerly, a bug was present where cassandra didn't index more than bucket count traces per
* millisecond. This stores a lot of spans to ensure indexes work under high-traffic scenarios.
*/
@Test
protected void getTraces_manyTraces(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
Span span = spanBuilder(testSuffix).build();
Map.Entry<String, String> tag = span.tags().entrySet().iterator().next();
int traceCount = 1000;
Span[] traces = new Span[traceCount];
traces[0] = span;
IntStream.range(1, traces.length).forEach(i -> traces[i] = spanBuilder(testSuffix).timestamp((TODAY + i) * 1000).duration(10L).build());
accept(traces);
assertGetTracesReturnsCount(requestBuilder().limit(traceCount).build(), traceCount);
QueryRequest.Builder builder = requestBuilder().limit(traceCount).serviceName(span.localServiceName());
assertGetTracesReturnsCount(builder.build(), traceCount);
assertGetTracesReturnsCount(builder.remoteServiceName(span.remoteServiceName()).build(), traceCount);
assertGetTracesReturnsCount(builder.spanName(span.name()).build(), traceCount);
assertGetTracesReturnsCount(builder.parseAnnotationQuery(tag.getKey() + "=" + tag.getValue()).build(), traceCount);
}
use of zipkin2.elasticsearch.ElasticsearchStorage.Builder in project zipkin by openzipkin.
the class Proto3CodecInteropTest method annotation_read_matchesWireEncodingWithTag.
@Test
public void annotation_read_matchesWireEncodingWithTag() {
zipkin2.Annotation zipkinAnnotation = ZIPKIN_SPAN.annotations().get(0);
Span wireSpan = new Span.Builder().annotations(PROTO_SPAN.annotations).build();
ReadBuffer wireBytes = ReadBuffer.wrap(wireSpan.encode());
assertThat(wireBytes.readVarint32()).isEqualTo(ANNOTATION.key);
zipkin2.Span.Builder builder = zipkinSpanBuilder();
ANNOTATION.readLengthPrefixAndValue(wireBytes, builder);
assertThat(builder.build().annotations()).containsExactly(zipkinAnnotation);
}
use of zipkin2.elasticsearch.ElasticsearchStorage.Builder 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;
}
Aggregations