Search in sources :

Example 1 with Sampler

use of com.uber.jaeger.samplers.Sampler in project jaeger-client-java by jaegertracing.

the class JaegerRequestAndResponseInterceptorIntegrationTest method setUp.

@Before
public void setUp() {
    mockServerClient.when(HttpRequest.request().withMethod("GET").withPath("/testing")).respond(HttpResponse.response().withStatusCode(200));
    reporter = new InMemoryReporter();
    Sampler sampler = new ConstSampler(true);
    tracer = new Tracer.Builder("test_service", reporter, sampler).build();
    parentSpan = (Span) tracer.buildSpan("parent_operation").startManual();
    parentSpan.setBaggageItem(BAGGAGE_KEY, BAGGAGE_VALUE);
    parentSpan.finish();
    // Set up a parent span context
    tracer.scopeManager().activate(parentSpan, false);
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) Sampler(com.uber.jaeger.samplers.Sampler) ConstSampler(com.uber.jaeger.samplers.ConstSampler) HttpAsyncClientBuilder(org.apache.http.impl.nio.client.HttpAsyncClientBuilder) HttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Before(org.junit.Before)

Example 2 with Sampler

use of com.uber.jaeger.samplers.Sampler in project jaeger-client-java by jaegertracing.

the class TracerTest method testClose.

@Test
public void testClose() {
    Reporter reporter = mock(Reporter.class);
    Sampler sampler = mock(Sampler.class);
    tracer = new Tracer.Builder("bonda", reporter, sampler).build();
    tracer.close();
    verify(reporter).close();
    verify(sampler).close();
}
Also used : Reporter(com.uber.jaeger.reporters.Reporter) InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) RemoteReporter(com.uber.jaeger.reporters.RemoteReporter) Sampler(com.uber.jaeger.samplers.Sampler) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Builder(com.uber.jaeger.Tracer.Builder) Test(org.junit.Test)

Example 3 with Sampler

use of com.uber.jaeger.samplers.Sampler in project jaeger-client-java by jaegertracing.

the class EndToEndBehavior method getRemoteTracer.

private Tracer getRemoteTracer(Metrics metrics, Reporter reporter, String serviceName, String samplingHostPort) {
    Sampler initialSampler = new ProbabilisticSampler(1.0);
    HttpSamplingManager manager = new HttpSamplingManager(samplingHostPort);
    RemoteControlledSampler remoteSampler = new RemoteControlledSampler(serviceName, manager, initialSampler, metrics, 5000);
    com.uber.jaeger.Tracer.Builder remoteTracerBuilder = new com.uber.jaeger.Tracer.Builder(serviceName, reporter, remoteSampler);
    return remoteTracerBuilder.build();
}
Also used : HttpSamplingManager(com.uber.jaeger.samplers.HttpSamplingManager) Tracer(io.opentracing.Tracer) RemoteControlledSampler(com.uber.jaeger.samplers.RemoteControlledSampler) Sampler(com.uber.jaeger.samplers.Sampler) ConstSampler(com.uber.jaeger.samplers.ConstSampler) ProbabilisticSampler(com.uber.jaeger.samplers.ProbabilisticSampler) ProbabilisticSampler(com.uber.jaeger.samplers.ProbabilisticSampler) RemoteControlledSampler(com.uber.jaeger.samplers.RemoteControlledSampler)

Example 4 with Sampler

use of com.uber.jaeger.samplers.Sampler in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testRateLimitingSampler.

@Test
public void testRateLimitingSampler() {
    SamplerConfiguration samplerConfiguration = new SamplerConfiguration().withType(RateLimitingSampler.TYPE);
    Sampler sampler = samplerConfiguration.createSampler("name", new Metrics(new StatsFactoryImpl(new NullStatsReporter())));
    assertTrue(sampler instanceof RateLimitingSampler);
}
Also used : RateLimitingSampler(com.uber.jaeger.samplers.RateLimitingSampler) Metrics(com.uber.jaeger.metrics.Metrics) NullStatsReporter(com.uber.jaeger.metrics.NullStatsReporter) RateLimitingSampler(com.uber.jaeger.samplers.RateLimitingSampler) Sampler(com.uber.jaeger.samplers.Sampler) ConstSampler(com.uber.jaeger.samplers.ConstSampler) ProbabilisticSampler(com.uber.jaeger.samplers.ProbabilisticSampler) SamplerConfiguration(com.uber.jaeger.Configuration.SamplerConfiguration) StatsFactoryImpl(com.uber.jaeger.metrics.StatsFactoryImpl) Test(org.junit.Test)

Example 5 with Sampler

use of com.uber.jaeger.samplers.Sampler in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testConstSampler.

@Test
public void testConstSampler() {
    SamplerConfiguration samplerConfiguration = new SamplerConfiguration().withType(ConstSampler.TYPE);
    Sampler sampler = samplerConfiguration.createSampler("name", new Metrics(new StatsFactoryImpl(new NullStatsReporter())));
    assertTrue(sampler instanceof ConstSampler);
}
Also used : Metrics(com.uber.jaeger.metrics.Metrics) NullStatsReporter(com.uber.jaeger.metrics.NullStatsReporter) RateLimitingSampler(com.uber.jaeger.samplers.RateLimitingSampler) Sampler(com.uber.jaeger.samplers.Sampler) ConstSampler(com.uber.jaeger.samplers.ConstSampler) ProbabilisticSampler(com.uber.jaeger.samplers.ProbabilisticSampler) SamplerConfiguration(com.uber.jaeger.Configuration.SamplerConfiguration) ConstSampler(com.uber.jaeger.samplers.ConstSampler) StatsFactoryImpl(com.uber.jaeger.metrics.StatsFactoryImpl) Test(org.junit.Test)

Aggregations

ConstSampler (com.uber.jaeger.samplers.ConstSampler)7 Sampler (com.uber.jaeger.samplers.Sampler)7 ProbabilisticSampler (com.uber.jaeger.samplers.ProbabilisticSampler)5 Metrics (com.uber.jaeger.metrics.Metrics)4 RateLimitingSampler (com.uber.jaeger.samplers.RateLimitingSampler)4 Test (org.junit.Test)4 SamplerConfiguration (com.uber.jaeger.Configuration.SamplerConfiguration)3 NullStatsReporter (com.uber.jaeger.metrics.NullStatsReporter)3 StatsFactoryImpl (com.uber.jaeger.metrics.StatsFactoryImpl)3 InMemoryReporter (com.uber.jaeger.reporters.InMemoryReporter)2 RemoteReporter (com.uber.jaeger.reporters.RemoteReporter)2 Reporter (com.uber.jaeger.reporters.Reporter)2 RemoteControlledSampler (com.uber.jaeger.samplers.RemoteControlledSampler)2 Builder (com.uber.jaeger.Tracer.Builder)1 NoopMetricsFactory (com.uber.jaeger.metrics.NoopMetricsFactory)1 CompositeReporter (com.uber.jaeger.reporters.CompositeReporter)1 LoggingReporter (com.uber.jaeger.reporters.LoggingReporter)1 HttpSamplingManager (com.uber.jaeger.samplers.HttpSamplingManager)1 Tracer (io.opentracing.Tracer)1 Format (io.opentracing.propagation.Format)1