From 1b0040c3e815d0b859a694d65a2c3112c21af187 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Tue, 10 Oct 2017 16:32:40 +0200 Subject: [PATCH 1/3] Elasticsearch deploy two replicas Signed-off-by: Pavol Loffay --- ...er-production-template-with-elasticsearch.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/production-elasticsearch/jaeger-production-template-with-elasticsearch.yml b/production-elasticsearch/jaeger-production-template-with-elasticsearch.yml index 81d14c9..dbf4b72 100644 --- a/production-elasticsearch/jaeger-production-template-with-elasticsearch.yml +++ b/production-elasticsearch/jaeger-production-template-with-elasticsearch.yml @@ -19,16 +19,17 @@ items: kind: StatefulSet metadata: name: elasticsearch + labels: + app: jaeger + jaeger-infra: elasticsearch-statefulset spec: serviceName: elasticsearch - replicas: 1 + replicas: 2 template: metadata: labels: - app: jaeger - type: databases - availability: restricted - jaeger-infra: elasticsearch-statefulset + app: jaeger-elasticsearch + jaeger-infra: elasticsearch-replica spec: containers: - name: elasticsearch @@ -39,6 +40,7 @@ items: args: - "-Ehttp.host=0.0.0.0" - "-Etransport.host=127.0.0.1" + - "-Ecluster.name=foobar" volumeMounts: - name: data mountPath: /data @@ -55,10 +57,12 @@ items: spec: clusterIP: None selector: - app: elasticsearch + app: jaeger-elasticsearch ports: - port: 9200 name: elasticsearch + - port: 9300 + name: transport - apiVersion: extensions/v1beta1 kind: Deployment metadata: From a3e65fa2d49a7ca8255b0145a344d9d21b25b32b Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Tue, 10 Oct 2017 17:22:37 +0200 Subject: [PATCH 2/3] Create span before each ES test Signed-off-by: Pavol Loffay --- .../kubernetes/deployment/BaseETest.java | 8 ++--- .../kubernetes/ProductionETest.java | 33 ++++++++++++++++++- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/jaegertracing-kubernetes-deployment-itest/src/main/java/io/jaegertracing/kubernetes/deployment/BaseETest.java b/jaegertracing-kubernetes-deployment-itest/src/main/java/io/jaegertracing/kubernetes/deployment/BaseETest.java index 6d88661..9055d82 100644 --- a/jaegertracing-kubernetes-deployment-itest/src/main/java/io/jaegertracing/kubernetes/deployment/BaseETest.java +++ b/jaegertracing-kubernetes-deployment-itest/src/main/java/io/jaegertracing/kubernetes/deployment/BaseETest.java @@ -55,25 +55,25 @@ public class BaseETest { private static final String COLLECTOR_SERVICE_NAME = "jaeger-collector"; private static final String ZIPKIN_SERVICE_NAME = "zipkin"; - private OkHttpClient okHttpClient = new OkHttpClient.Builder() + protected OkHttpClient okHttpClient = new OkHttpClient.Builder() .build(); @Named(QUERY_SERVICE_NAME) @PortForward @ArquillianResource - private URL queryUrl; + protected URL queryUrl; @Port(14268) @Named(COLLECTOR_SERVICE_NAME) @PortForward @ArquillianResource - private URL collectorUrl; + protected URL collectorUrl; @Port(9411) @Named(ZIPKIN_SERVICE_NAME) @PortForward @ArquillianResource - private URL zipkinUrl; + protected URL zipkinUrl; @Test public void testUiResponds() throws IOException, InterruptedException { diff --git a/production-elasticsearch/src/test/java/io/jaegertracing/kubernetes/ProductionETest.java b/production-elasticsearch/src/test/java/io/jaegertracing/kubernetes/ProductionETest.java index 3a48010..a1e45ea 100644 --- a/production-elasticsearch/src/test/java/io/jaegertracing/kubernetes/ProductionETest.java +++ b/production-elasticsearch/src/test/java/io/jaegertracing/kubernetes/ProductionETest.java @@ -13,15 +13,46 @@ */ package io.jaegertracing.kubernetes; +import com.uber.jaeger.Tracer; import io.jaegertracing.kubernetes.deployment.BaseETest; import java.io.IOException; -import org.junit.Ignore; +import java.util.UUID; +import okhttp3.Request; +import okhttp3.Response; +import org.junit.Before; + +import static org.awaitility.Awaitility.await; /** * @author Pavol Loffay */ public class ProductionETest extends BaseETest { + /** + * We need to initialize ES storage, before we proceed to tests for two reasons: + * 1. sometimes first span is not stored + * 2. jaeger-query returns 500 is ES storage is empty (without indices) + */ + @Before + public void before() { + String serviceName = UUID.randomUUID().toString().replace("-", ""); + Tracer tracer = createJaegerTracer(serviceName); + String operationName = UUID.randomUUID().toString().replace("-", ""); + tracer.buildSpan(operationName).startManual().finish(); + tracer.close(); + + Request request = new Request.Builder() + .url(queryUrl + "api/traces?service=" + serviceName) + .get() + .build(); + + await().until(() -> { + Response response = okHttpClient.newCall(request).execute(); + String body = response.body().string(); + return body.contains(operationName); + }); + } + public void testDependencyLinks() throws IOException, InterruptedException { } } From c2d9e892b093756e3af9d77aba7e88af7c4cebab Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Tue, 10 Oct 2017 17:37:55 +0200 Subject: [PATCH 3/3] Add link Signed-off-by: Pavol Loffay --- .../test/java/io/jaegertracing/kubernetes/ProductionETest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production-elasticsearch/src/test/java/io/jaegertracing/kubernetes/ProductionETest.java b/production-elasticsearch/src/test/java/io/jaegertracing/kubernetes/ProductionETest.java index a1e45ea..9ac547e 100644 --- a/production-elasticsearch/src/test/java/io/jaegertracing/kubernetes/ProductionETest.java +++ b/production-elasticsearch/src/test/java/io/jaegertracing/kubernetes/ProductionETest.java @@ -31,7 +31,7 @@ public class ProductionETest extends BaseETest { /** * We need to initialize ES storage, before we proceed to tests for two reasons: * 1. sometimes first span is not stored - * 2. jaeger-query returns 500 is ES storage is empty (without indices) + * 2. jaeger-query returns 500 is ES storage is empty (without indices) https://github.com/jaegertracing/jaeger/issues/464 */ @Before public void before() {