use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class RemovedFrom032Test method setUp.
@Before
public void setUp() {
reporter = new InMemoryReporter();
tracer = new JaegerTracer.Builder("TracerTestService").withReporter(reporter).withSampler(new ConstSampler(true)).build();
}
use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class MicrometerTest method validateMetricCounts.
@Test
public void validateMetricCounts() throws InterruptedException {
Sampler constantSampler = new ConstSampler(true);
Configuration configuration = new Configuration("validateMetricCounts");
JaegerTracer tracer = configuration.getTracerBuilder().withSampler(constantSampler).withMetrics(metrics).build();
createSomeSpans(tracer);
tracer.close();
double finishedSpans = registry.get("jaeger_tracer_finished_spans").counter().count();
double startedSpans = registry.get("jaeger_tracer_started_spans").tag("sampled", "y").counter().count();
double traces = registry.get("jaeger_tracer_traces").tag("sampled", "y").tag("state", "started").counter().count();
assertEquals("Wrong number of finishedSpans", 4.0, finishedSpans, assertDelta);
assertEquals("Wrong number of startedSpans", 10.0, startedSpans, assertDelta);
assertEquals("Wrong number of traces", 10.0, traces, assertDelta);
}
use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class RemoteReporterTest method testFlushIsCalledOnSender.
@Test
public void testFlushIsCalledOnSender() throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1);
InMemorySender sender = new InMemorySender() {
@Override
public int flush() throws SenderException {
latch.countDown();
return super.flush();
}
};
RemoteReporter remoteReporter = new Builder().withSender(sender).withFlushInterval(flushInterval).withMaxQueueSize(maxQueueSize).withMetrics(metrics).build();
tracer = new JaegerTracer.Builder("test-remote-reporter").withReporter(remoteReporter).withSampler(new ConstSampler(true)).withMetrics(metrics).build();
tracer.buildSpan("mySpan").start().finish();
remoteReporter.flush();
latch.await();
assertEquals("Should have called the custom sender flush", 0, latch.getCount());
assertEquals("mySpan", (sender.getReceived().get(0)).getOperationName());
}
use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class ActiveSpanTest method setUp.
@Before
public void setUp() {
reporter = new InMemoryReporter();
tracer = new JaegerTracer.Builder("TracerTestService").withReporter(reporter).withSampler(new ConstSampler(true)).build();
}
use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class JaegerSpanTest method setUp.
@Before
public void setUp() {
metricsFactory = new InMemoryMetricsFactory();
reporter = new InMemoryReporter();
clock = mock(Clock.class);
metrics = new Metrics(metricsFactory);
final JaegerTracer.Builder tracerBuilder = new JaegerTracer.Builder("SamplerTest").withReporter(reporter).withSampler(new ConstSampler(true)).withMetrics(metrics).withClock(clock).withBaggageRestrictionManager(new DefaultBaggageRestrictionManager()).withExpandExceptionLogs();
tracer = tracerBuilder.build();
tracer128 = tracerBuilder.withTraceId128Bit().build();
jaegerSpan = tracer.buildSpan("some-operation").start();
}
Aggregations