Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #28 from jkandasa/jaeger-0.30.2
Browse files Browse the repository at this point in the history
Add summary report, client update to 0.30.2 and minor fix in Jenkins pipeline
  • Loading branch information
jkandasa authored Aug 17, 2018
2 parents c80da8d + b858272 commit 15dfd04
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 35 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<fabric8.openshift.client.version>3.1.12</fabric8.openshift.client.version>
<glassfish.jersey.client.version>2.27</glassfish.jersey.client.version>
<jackson.version>2.9.5</jackson.version>
<jaeger.version>0.29.0</jaeger.version>
<jaeger.version>0.30.2</jaeger.version>
<javax.ws.rs.version>2.1</javax.ws.rs.version>
<junit.version>4.12</junit.version>
<log4j.version>1.2.17</log4j.version>
Expand All @@ -58,7 +58,7 @@
<dependencies>
<dependency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-core</artifactId>
<artifactId>jaeger-client</artifactId>
<version>${jaeger.version}</version>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion standalone/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pipeline {
oc logs -f elasticsearch-1 > es1.txt &
oc logs -f elasticsearch-2 > es2.txt &
cd standalone
mvn --activate-profiles openshift clean install fabric8:deploy -Djaeger.agent.image=${JAEGER_AGENT_IMAGE} -Dtracers.per.pod=${TRACERS_PER_POD} -Dpod.count=${WORKER_PODS} -Dduration.in.minutes=${DURATION_IN_MINUTES} -Ddelay=${DELAY} -Djaeger.sampling.rate=${JAEGER_SAMPLING_RATE} -Djaeger.agent.host=${JAEGER_AGENT_HOST} -Duser.agent.or.collector=${USE_AGENT_OR_COLLECTOR} -Djaeger.collector.port=${JAEGER_COLLECTOR_PORT} -Djaeger.collector.host=${JAEGER_COLLECTOR_HOST}
mvn --activate-profiles openshift clean install fabric8:deploy -Djaeger.agent.image=${JAEGER_AGENT_IMAGE} -Dtracers.per.pod=${TRACERS_PER_POD} -Dpod.count=${WORKER_PODS} -Dduration.in.minutes=${DURATION_IN_MINUTES} -Dthread.count=${THREAD_COUNT} -Ddelay=${DELAY} -Djaeger.sampling.rate=${JAEGER_SAMPLING_RATE} -Djaeger.agent.host=${JAEGER_AGENT_HOST} -Duse.agent.or.collector=${USE_AGENT_OR_COLLECTOR} -Djaeger.collector.port=${JAEGER_COLLECTOR_PORT} -Djaeger.collector.host=${JAEGER_COLLECTOR_HOST}
mvn --activate-profiles validate clean verify
'''
}
Expand Down
2 changes: 1 addition & 1 deletion standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</dependency>
<dependency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-core</artifactId>
<artifactId>jaeger-client</artifactId>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
Expand Down
60 changes: 29 additions & 31 deletions standalone/src/main/java/io/jaegertracing/qe/CreateTraces.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
*/
package io.jaegertracing.qe;

import io.jaegertracing.reporters.CompositeReporter;
import io.jaegertracing.reporters.LoggingReporter;
import io.jaegertracing.reporters.RemoteReporter;
import io.jaegertracing.reporters.Reporter;
import io.jaegertracing.samplers.ProbabilisticSampler;
import io.jaegertracing.samplers.Sampler;
import io.jaegertracing.senders.HttpSender;
import io.jaegertracing.senders.Sender;
import io.jaegertracing.senders.UdpSender;
import io.jaegertracing.Configuration.SenderConfiguration;
import io.jaegertracing.internal.JaegerTracer;
import io.jaegertracing.internal.reporters.CompositeReporter;
import io.jaegertracing.internal.reporters.LoggingReporter;
import io.jaegertracing.internal.reporters.RemoteReporter;
import io.jaegertracing.internal.samplers.ProbabilisticSampler;
import io.jaegertracing.spi.Reporter;
import io.jaegertracing.spi.Sampler;
import io.opentracing.Tracer;

import java.io.IOException;
Expand All @@ -47,21 +46,21 @@
public class CreateTraces {
private static final Map<String, String> envs = System.getenv();

private static final Integer DELAY = new Integer(envs.getOrDefault("DELAY", "1"));
private static final Integer DURATION_IN_MINUTES = new Integer(envs.getOrDefault("DURATION_IN_MINUTES", "5"));
private static final String JAEGER_AGENT_HOST = envs.getOrDefault("JAEGER_AGENT_HOST", "localhost");
private static final String JAEGER_COLLECTOR_HOST = envs.getOrDefault("JAEGER_COLLECTOR_HOST", "localhost");
private static final String JAEGER_COLLECTOR_PORT = envs.getOrDefault("MY_JAEGER_COLLECTOR_PORT", "14268");
private static final Integer JAEGER_FLUSH_INTERVAL = new Integer(envs.getOrDefault("JAEGER_FLUSH_INTERVAL", "100"));
private static final Integer JAEGER_MAX_PACKET_SIZE = new Integer(envs.getOrDefault("JAEGER_MAX_PACKET_SIZE", "0"));
private static final Integer JAEGER_MAX_QUEUE_SIZE = new Integer(envs.getOrDefault("JAEGER_MAX_QUEUE_SIZE", "100000"));
private static final Double JAEGER_SAMPLING_RATE = new Double(envs.getOrDefault("JAEGER_SAMPLING_RATE", "1.0"));
private static final Integer JAEGER_UDP_PORT = new Integer(envs.getOrDefault("JAEGER_UDP_PORT", "6831"));
private static final String TEST_SERVICE_NAME = envs.getOrDefault("TEST_SERVICE_NAME", "standalone");
private static final Integer THREAD_COUNT = new Integer(envs.getOrDefault("THREAD_COUNT", "100"));
private static final Integer TRACERS_PER_POD = new Integer(envs.getOrDefault("TRACERS_PER_POD", "1"));
private static final String USE_AGENT_OR_COLLECTOR = envs.getOrDefault("USE_AGENT_OR_COLLECTOR", "COLLECTOR");
private static final String USE_LOGGING_REPORTER = envs.getOrDefault("USE_LOGGING_REPORTER", "false");
public static final Integer DELAY = new Integer(envs.getOrDefault("DELAY", "1"));
public static final Integer DURATION_IN_MINUTES = new Integer(envs.getOrDefault("DURATION_IN_MINUTES", "5"));
public static final String JAEGER_AGENT_HOST = envs.getOrDefault("JAEGER_AGENT_HOST", "localhost");
public static final String JAEGER_COLLECTOR_HOST = envs.getOrDefault("JAEGER_COLLECTOR_HOST", "localhost");
public static final String JAEGER_COLLECTOR_PORT = envs.getOrDefault("MY_JAEGER_COLLECTOR_PORT", "14268");
public static final Integer JAEGER_FLUSH_INTERVAL = new Integer(envs.getOrDefault("JAEGER_FLUSH_INTERVAL", "100"));
public static final Integer JAEGER_MAX_PACKET_SIZE = new Integer(envs.getOrDefault("JAEGER_MAX_PACKET_SIZE", "0"));
public static final Integer JAEGER_MAX_QUEUE_SIZE = new Integer(envs.getOrDefault("JAEGER_MAX_QUEUE_SIZE", "100000"));
public static final Double JAEGER_SAMPLING_RATE = new Double(envs.getOrDefault("JAEGER_SAMPLING_RATE", "1.0"));
public static final Integer JAEGER_UDP_PORT = new Integer(envs.getOrDefault("JAEGER_UDP_PORT", "6831"));
public static final String TEST_SERVICE_NAME = envs.getOrDefault("TEST_SERVICE_NAME", "standalone");
public static final Integer THREAD_COUNT = new Integer(envs.getOrDefault("THREAD_COUNT", "100"));
public static final Integer TRACERS_PER_POD = new Integer(envs.getOrDefault("TRACERS_PER_POD", "1"));
public static final String USE_AGENT_OR_COLLECTOR = envs.getOrDefault("USE_AGENT_OR_COLLECTOR", "COLLECTOR");
public static final String USE_LOGGING_REPORTER = envs.getOrDefault("USE_LOGGING_REPORTER", "false");

public static final String TRACES_CREATED_MESSAGE = "TRACES_CREATED: ";

Expand All @@ -77,26 +76,25 @@ public class CreateTraces {
*/
private static Tracer createJaegerTracer() {
Tracer tracer;
Sender sender;
SenderConfiguration conf = null;
CompositeReporter compositeReporter;

if (USE_AGENT_OR_COLLECTOR.equalsIgnoreCase("agent")) {
sender = new UdpSender(JAEGER_AGENT_HOST, JAEGER_UDP_PORT, JAEGER_MAX_PACKET_SIZE);
conf = new SenderConfiguration().withAgentHost(JAEGER_AGENT_HOST).withAgentPort(JAEGER_UDP_PORT);
logger.info("Using JAEGER tracer using agent on host [" + JAEGER_AGENT_HOST + "] port [" + JAEGER_UDP_PORT +
"] Service Name [" + TEST_SERVICE_NAME + "] Sampling rate [" + JAEGER_SAMPLING_RATE
+ "] Max queue size: [" + JAEGER_MAX_QUEUE_SIZE + "]");
} else {
// use the collector
String httpEndpoint = "http://" + JAEGER_COLLECTOR_HOST + ":" + JAEGER_COLLECTOR_PORT + "/api/traces";
sender = new HttpSender.Builder(httpEndpoint)
.build();
conf = new SenderConfiguration().withEndpoint(httpEndpoint);
logger.info("Using JAEGER tracer using collector on host [" + JAEGER_COLLECTOR_HOST + "] port [" + JAEGER_COLLECTOR_PORT +
"] Service Name [" + TEST_SERVICE_NAME + "] Sampling rate [" + JAEGER_SAMPLING_RATE
+ "] Max queue size: [" + JAEGER_MAX_QUEUE_SIZE + "]");
}

RemoteReporter remoteReporter = new RemoteReporter.Builder()
.withSender(sender)
.withSender(conf.getSender())
.withFlushInterval(JAEGER_FLUSH_INTERVAL)
.withMaxQueueSize(JAEGER_MAX_QUEUE_SIZE)
.build();
Expand All @@ -109,7 +107,7 @@ private static Tracer createJaegerTracer() {
}

Sampler sampler = new ProbabilisticSampler(JAEGER_SAMPLING_RATE);
tracer = new io.jaegertracing.Tracer.Builder(TEST_SERVICE_NAME)
tracer = new JaegerTracer.Builder(TEST_SERVICE_NAME)
.withReporter(compositeReporter)
.withSampler(sampler)
.build();
Expand Down Expand Up @@ -186,7 +184,7 @@ private void closeTracer(Tracer tracer) {
} catch (InterruptedException e) {
logger.warn("Interrupted Exception", e);
}
io.jaegertracing.Tracer jaegerTracer = (io.jaegertracing.Tracer) tracer;
JaegerTracer jaegerTracer = (JaegerTracer) tracer;
jaegerTracer.close();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright 2018 The Jaeger Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/

package io.jaegertracing.qe.result;

public class QueryStatus {
private String name;
private String queryParameters;
private long timetaken;

public QueryStatus(String name, String queryParameters, long timetaken) {
this.name = name;
this.queryParameters = queryParameters;
this.timetaken = timetaken;
}

public String getName() {
return name;
}

public String getQueryParameters() {
return queryParameters;
}

public long getTimetaken() {
return timetaken;
}
}
117 changes: 117 additions & 0 deletions standalone/src/test/java/io/jaegertracing/qe/result/TestReport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/**
* Copyright 2018 The Jaeger Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/

package io.jaegertracing.qe.result;

import io.jaegertracing.qe.CreateTraces;

import java.text.DecimalFormat;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.time.DurationFormatUtils;

public class TestReport {
private static TestReport _instance = new TestReport();

private TestReport() {

}

public static TestReport getInstance() {
return _instance;
}

private static final Map<String, String> envs = System.getenv();

DecimalFormat decimalFormat = new DecimalFormat("#0.000");

private long spanCountSent = -1;
private long spanCountFound = -1;

private List<QueryStatus> statusList = new LinkedList<>();

public void updateSpanCount(long sent, long found) {
this.spanCountSent = sent;
this.spanCountFound = found;
}

public void addQueryStatus(QueryStatus status) {
statusList.add(status);
}

public String getStringReport() {
StringBuilder builder = new StringBuilder();
builder.append("\n\n========================= TEST SUMMARY REPORT =========================\n");

builder.append("Test configuration: \n");
builder.append("-----------------------------------------------------------------------\n");
builder.append(" Test duration : ")
.append(timetaken(CreateTraces.DURATION_IN_MINUTES * 1000 * 60)).append("\n");
builder.append(" Thread count : ").append(CreateTraces.THREAD_COUNT).append("\n");
builder.append(" Delay b/w span creation : ").append(CreateTraces.DELAY).append(" ms\n");
builder.append(" Workers pod count : ").append(envs.get("WORKER_PODS")).append("\n");
builder.append(" Tracers per pod : ").append(CreateTraces.TRACERS_PER_POD).append("\n");
builder.append(" Collector pod count : ").append(envs.get("COLLECTOR_PODS")).append("\n");
builder.append(" Collector queue size : ").append(envs.get("COLLECTOR_QUEUE_SIZE")).append("\n");
builder.append(" Storage type : ").append(envs.get("SPAN_STORAGE_TYPE")).append("\n");
builder.append(" ES memory : ").append(envs.get("ES_MEMORY")).append("\n");
builder.append(" ES bulk size : ").append(envs.get("ES_BULK_SIZE")).append("\n");
builder.append(" ES bulk workers : ").append(envs.get("ES_BULK_WORKERS")).append("\n");
builder.append(" ES bulk flush interval : ").append(envs.get("ES_BULK_FLUSH_INTERVAL")).append("\n");
builder.append(" Jaeger sampling rate : ").append(CreateTraces.JAEGER_SAMPLING_RATE).append("\n");
builder.append(" Jaeger flush interval : ").append(CreateTraces.JAEGER_FLUSH_INTERVAL).append(" ms\n");
builder.append(" Jaeger max queue size : ").append(CreateTraces.JAEGER_MAX_QUEUE_SIZE).append("\n");
builder.append(" Collector host : ").append(CreateTraces.JAEGER_COLLECTOR_HOST).append(":")
.append(CreateTraces.JAEGER_COLLECTOR_PORT).append("\n");
builder.append(" Agent host(UDP) : ").append(CreateTraces.JAEGER_AGENT_HOST).append(":")
.append(CreateTraces.JAEGER_UDP_PORT).append("\n");
builder.append(" Agent image : ").append(envs.get("JAEGER_AGENT_IMAGE")).append("\n");
builder.append(" Collector image : ").append(envs.get("JAEGER_COLLECTOR_IMAGE")).append("\n");
builder.append(" Query image : ").append(envs.get("JAEGER_QUERY_IMAGE")).append("\n");

builder.append("-----------------------------------------------------------------------\n\n");

final double dropPercentage = 100.0 - (((double) spanCountFound / spanCountSent) * 100.0);
final int tracesPersecond = ((int) CreateTraces.THREAD_COUNT * (1000 / CreateTraces.DELAY))
* new Integer(envs.getOrDefault("WORKER_PODS", "1"));

builder.append("Span count status: \n");
builder.append("-----------------------------------------------------------------------\n");
builder.append(" Traces sent to : ").append(CreateTraces.USE_AGENT_OR_COLLECTOR).append("\n");
builder.append(" Traces / second : ").append(tracesPersecond).append(" (aprox)\n");
builder.append(" Traces / minute : ").append(tracesPersecond * 60).append(" (aprox)\n");
builder.append(" Sent : ").append(spanCountSent).append("\n");
builder.append(" Found : ").append(spanCountFound).append("\n");
builder.append(" Dropped % : ").append(decimalFormat.format(dropPercentage)).append("\n");
builder.append("-----------------------------------------------------------------------\n\n");

builder.append("Query execution status: \n");
builder.append("-----------------------------------------------------------------------\n");
for (QueryStatus status : statusList) {
builder.append(" Name : ").append(status.getName()).append("\n");
builder.append(" Timetaken : ").append(timetaken(status.getTimetaken())).append("\n");
builder.append(" Parameters : ").append(status.getQueryParameters()).append("\n\n");
}

builder.append("================================= END =================================\n\n");

return builder.toString();
}

private String timetaken(long durationMillis) {
return DurationFormatUtils.formatDurationHMS(durationMillis);
}
}
Loading

0 comments on commit 15dfd04

Please sign in to comment.