Search in sources :

Example 1 with SamplerConfiguration

use of com.uber.jaeger.Configuration.SamplerConfiguration in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testSamplerConst.

@Test
public void testSamplerConst() {
    System.setProperty(Configuration.JAEGER_SAMPLER_TYPE, ConstSampler.TYPE);
    System.setProperty(Configuration.JAEGER_SAMPLER_PARAM, "1");
    SamplerConfiguration samplerConfig = SamplerConfiguration.fromEnv();
    assertEquals(ConstSampler.TYPE, samplerConfig.getType());
    assertEquals(1, samplerConfig.getParam().intValue());
}
Also used : SamplerConfiguration(com.uber.jaeger.Configuration.SamplerConfiguration) Test(org.junit.Test)

Example 2 with SamplerConfiguration

use of com.uber.jaeger.Configuration.SamplerConfiguration in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testUnknownSampler.

@Test(expected = IllegalStateException.class)
public void testUnknownSampler() {
    SamplerConfiguration samplerConfiguration = new SamplerConfiguration();
    samplerConfiguration.withType("unknown");
    new Configuration("name").withSampler(samplerConfiguration).getTracer();
}
Also used : SamplerConfiguration(com.uber.jaeger.Configuration.SamplerConfiguration) ReporterConfiguration(com.uber.jaeger.Configuration.ReporterConfiguration) SamplerConfiguration(com.uber.jaeger.Configuration.SamplerConfiguration) Test(org.junit.Test)

Example 3 with SamplerConfiguration

use of com.uber.jaeger.Configuration.SamplerConfiguration in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testSamplerConstInvalidParam.

@Test
public void testSamplerConstInvalidParam() {
    System.setProperty(Configuration.JAEGER_SAMPLER_TYPE, ConstSampler.TYPE);
    System.setProperty(Configuration.JAEGER_SAMPLER_PARAM, "X");
    SamplerConfiguration samplerConfig = SamplerConfiguration.fromEnv();
    assertEquals(ConstSampler.TYPE, samplerConfig.getType());
    assertNull(samplerConfig.getParam());
}
Also used : SamplerConfiguration(com.uber.jaeger.Configuration.SamplerConfiguration) Test(org.junit.Test)

Example 4 with SamplerConfiguration

use of com.uber.jaeger.Configuration.SamplerConfiguration 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 SamplerConfiguration

use of com.uber.jaeger.Configuration.SamplerConfiguration 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

SamplerConfiguration (com.uber.jaeger.Configuration.SamplerConfiguration)6 Test (org.junit.Test)6 Metrics (com.uber.jaeger.metrics.Metrics)3 NullStatsReporter (com.uber.jaeger.metrics.NullStatsReporter)3 StatsFactoryImpl (com.uber.jaeger.metrics.StatsFactoryImpl)3 ConstSampler (com.uber.jaeger.samplers.ConstSampler)3 ProbabilisticSampler (com.uber.jaeger.samplers.ProbabilisticSampler)3 RateLimitingSampler (com.uber.jaeger.samplers.RateLimitingSampler)3 Sampler (com.uber.jaeger.samplers.Sampler)3 ReporterConfiguration (com.uber.jaeger.Configuration.ReporterConfiguration)1