use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class RemoteReporterTest method testUpdateSuccessMetricWhenAppendFlushed.
@Test
public void testUpdateSuccessMetricWhenAppendFlushed() throws InterruptedException {
int totalSpans = 3;
int flushSize = 2;
CountDownLatch latch = new CountDownLatch(1);
sender = new InMemorySender() {
@Override
public int append(JaegerSpan span) {
try {
super.append(span);
if (getAppended().size() >= flushSize) {
return flush();
}
if (getReceived().size() == totalSpans) {
latch.countDown();
}
return 0;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
reporter = new Builder().withSender(sender).withFlushInterval(Integer.MAX_VALUE).withMaxQueueSize(maxQueueSize).withMetrics(metrics).build();
tracer = new JaegerTracer.Builder("test-remote-reporter").withReporter(reporter).withSampler(new ConstSampler(true)).withMetrics(metrics).build();
for (int i = 0; i < totalSpans; i++) {
reporter.report(newSpan());
}
latch.await(1, TimeUnit.SECONDS);
assertEquals(flushSize, metricsFactory.getCounter("jaeger_tracer_reporter_spans", "result=ok"));
assertEquals(0, metricsFactory.getCounter("jaeger_tracer_reporter_spans", "result=err"));
assertEquals(0, metricsFactory.getCounter("jaeger_tracer_reporter_spans", "result=dropped"));
}
use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class RemoteReporterTest method testCloseWhenQueueFull.
@Test
@Ignore("See https://github.com/jaegertracing/jaeger-client-java/issues/340")
public void testCloseWhenQueueFull() {
int closeTimeoutMillis = 5;
reporter = new RemoteReporter.Builder().withSender(sender).withFlushInterval(Integer.MAX_VALUE).withMaxQueueSize(maxQueueSize).withCloseEnqueueTimeout(closeTimeoutMillis).withMetrics(metrics).build();
tracer = new JaegerTracer.Builder("test-remote-reporter").withReporter(reporter).withSampler(new ConstSampler(true)).withMetrics(metrics).build();
// change sender to blocking mode
sender.permitAppend(0);
// fill the queue
for (int i = 0; i < maxQueueSize + 10; i++) {
reporter.report(newSpan());
}
reporter.close();
// expect no exception thrown
}
use of io.jaegertracing.internal.samplers.ConstSampler in project wso2-synapse by wso2.
the class OpenTracingManagerHolder method loadZipkinConfigurations.
/**
* Loads Zipkin configurations required for the OpenTracingManager.
*
* @param zipkinBackendURL
*/
public static void loadZipkinConfigurations(String zipkinBackendURL) {
ZipkinV2ReporterFactory factory = new ZipkinV2ReporterFactory(zipkinBackendURL);
ConstSampler sampler = new ConstSampler(true);
openTracingManager = new JaegerTracingManager(sampler, factory.getReporter());
}
Aggregations