use of com.uber.jaeger.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class InMemoryMetricsFactoryTest method canBeUsedWithMetrics.
@Test
public void canBeUsedWithMetrics() {
InMemoryMetricsFactory metricsFactory = new InMemoryMetricsFactory();
Tracer tracer = new Tracer.Builder("metricsFactoryTest", new InMemoryReporter(), new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
tracer.buildSpan("theoperation").start();
assertEquals(1, metricsFactory.getCounter("jaeger:started_spans", "sampled=y"));
assertEquals(0, metricsFactory.getCounter("jaeger:started_spans", "sampled=n"));
assertEquals(1, metricsFactory.getCounter("jaeger:traces", "sampled=y,state=started"));
assertEquals(0, metricsFactory.getCounter("jaeger:traces", "sampled=n,state=started"));
}
use of com.uber.jaeger.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class NoopMetricsFactoryTest method canBeUsedWithMetrics.
@Test
public void canBeUsedWithMetrics() {
NoopMetricsFactory metricsFactory = new NoopMetricsFactory();
Tracer tracer = new Tracer.Builder("metricsFactoryTest", new InMemoryReporter(), new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
tracer.buildSpan("theoperation").start();
}
use of com.uber.jaeger.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);
Sender sender = new InMemorySender() {
@Override
public int flush() throws SenderException {
latch.countDown();
return super.flush();
}
};
reporter = new RemoteReporter(sender, flushInterval, maxQueueSize, metrics);
tracer = new Tracer.Builder("test-remote-reporter", reporter, new ConstSampler(true)).withMetrics(metrics).build();
tracer.buildSpan("mySpan").start().finish();
latch.await(1, TimeUnit.SECONDS);
assertEquals("Should have called the custom sender flush", 0, latch.getCount());
}
use of com.uber.jaeger.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class UdpSenderTest method setUp.
@Before
public void setUp() throws Exception {
server = startServer();
reporter = new InMemoryReporter();
tracer = new Tracer.Builder(SERVICE_NAME, reporter, new ConstSampler(true)).withStatsReporter(new InMemoryStatsReporter()).withTag("foo", "bar").build();
sender = new UdpSender(destHost, destPort, maxPacketSize);
}
use of com.uber.jaeger.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class ClientFilterTest method setUp.
@Before
public void setUp() throws Exception {
reporter = new InMemoryReporter();
tracer = new com.uber.jaeger.Tracer.Builder("Angry Machine", reporter, new ConstSampler(true)).build();
// Using deprecated constructor for test coverage
undertest = new ClientFilter(tracer, null);
}
Aggregations