Search in sources :

Example 6 with Sampler

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

the class Configuration method getTracerBuilder.

public Tracer.Builder getTracerBuilder() {
    if (reporterConfig == null) {
        reporterConfig = new ReporterConfiguration();
    }
    if (samplerConfig == null) {
        samplerConfig = new SamplerConfiguration();
    }
    if (codecConfig == null) {
        codecConfig = new CodecConfiguration(Collections.<Format<?>, List<Codec<TextMap>>>emptyMap());
    }
    if (metricsFactory == null) {
        metricsFactory = new NoopMetricsFactory();
    }
    Metrics metrics = new Metrics(metricsFactory);
    Reporter reporter = reporterConfig.getReporter(metrics);
    Sampler sampler = samplerConfig.createSampler(serviceName, metrics);
    Tracer.Builder builder = new Tracer.Builder(serviceName).withSampler(sampler).withReporter(reporter).withMetrics(metrics).withTags(tracerTags);
    codecConfig.apply(builder);
    return builder;
}
Also used : Reporter(com.uber.jaeger.reporters.Reporter) LoggingReporter(com.uber.jaeger.reporters.LoggingReporter) CompositeReporter(com.uber.jaeger.reporters.CompositeReporter) RemoteReporter(com.uber.jaeger.reporters.RemoteReporter) Metrics(com.uber.jaeger.metrics.Metrics) NumberFormat(java.text.NumberFormat) Format(io.opentracing.propagation.Format) RemoteControlledSampler(com.uber.jaeger.samplers.RemoteControlledSampler) RateLimitingSampler(com.uber.jaeger.samplers.RateLimitingSampler) Sampler(com.uber.jaeger.samplers.Sampler) ConstSampler(com.uber.jaeger.samplers.ConstSampler) ProbabilisticSampler(com.uber.jaeger.samplers.ProbabilisticSampler) LinkedList(java.util.LinkedList) List(java.util.List) TextMap(io.opentracing.propagation.TextMap) NoopMetricsFactory(com.uber.jaeger.metrics.NoopMetricsFactory)

Example 7 with Sampler

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

the class ConfigurationTest method testProbabilisticSampler.

@Test
public void testProbabilisticSampler() {
    SamplerConfiguration samplerConfiguration = new SamplerConfiguration().withType(ProbabilisticSampler.TYPE);
    Sampler sampler = samplerConfiguration.createSampler("name", new Metrics(new StatsFactoryImpl(new NullStatsReporter())));
    assertTrue(sampler instanceof ProbabilisticSampler);
}
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) StatsFactoryImpl(com.uber.jaeger.metrics.StatsFactoryImpl) ProbabilisticSampler(com.uber.jaeger.samplers.ProbabilisticSampler) 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