Search in sources :

Example 6 with SamplerConfiguration

use of io.jaegertracing.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 : SenderConfiguration(io.jaegertracing.Configuration.SenderConfiguration) CodecConfiguration(io.jaegertracing.Configuration.CodecConfiguration) ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) Test(org.junit.Test)

Example 7 with SamplerConfiguration

use of io.jaegertracing.Configuration.SamplerConfiguration 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 InMemoryMetricsFactory()));
    assertTrue(sampler instanceof ProbabilisticSampler);
}
Also used : Metrics(io.jaegertracing.internal.metrics.Metrics) InMemoryMetricsFactory(io.jaegertracing.internal.metrics.InMemoryMetricsFactory) Sampler(io.jaegertracing.spi.Sampler) RateLimitingSampler(io.jaegertracing.internal.samplers.RateLimitingSampler) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) ProbabilisticSampler(io.jaegertracing.internal.samplers.ProbabilisticSampler) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) ProbabilisticSampler(io.jaegertracing.internal.samplers.ProbabilisticSampler) Test(org.junit.Test)

Example 8 with SamplerConfiguration

use of io.jaegertracing.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 InMemoryMetricsFactory()));
    assertTrue(sampler instanceof RateLimitingSampler);
}
Also used : RateLimitingSampler(io.jaegertracing.internal.samplers.RateLimitingSampler) Metrics(io.jaegertracing.internal.metrics.Metrics) InMemoryMetricsFactory(io.jaegertracing.internal.metrics.InMemoryMetricsFactory) Sampler(io.jaegertracing.spi.Sampler) RateLimitingSampler(io.jaegertracing.internal.samplers.RateLimitingSampler) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) ProbabilisticSampler(io.jaegertracing.internal.samplers.ProbabilisticSampler) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) Test(org.junit.Test)

Example 9 with SamplerConfiguration

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

the class JerseyServer method main.

public static void main(String[] args) throws Exception {
    BasicConfigurator.configure();
    String serviceName = serviceNameFromEnv();
    Configuration configuration = new Configuration(serviceName).withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(0)).withReporter(new ReporterConfiguration().withLogSpans(true));
    JerseyServer server = new JerseyServer("0.0.0.0", 8081, configuration, Arrays.asList(new TraceBehaviorResource(configuration.getTracer()), new EndToEndBehaviorResource(new EndToEndBehavior(getEvn(SAMPLING_HOST_PORT, "jaeger-agent:5778"), "crossdock-" + serviceName, senderFromEnv(getEvn(COLLECTOR_HOST_PORT, "jaeger-collector:14268"), getEvn(AGENT_HOST, "jaeger-agent")))), new HealthResource()));
    server.addNetworkListener(new NetworkListener("health", "0.0.0.0", 8080));
    Thread.currentThread().join();
}
Also used : EndToEndBehavior(io.jaegertracing.crossdock.resources.behavior.EndToEndBehavior) ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Configuration(io.jaegertracing.Configuration) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) TraceBehaviorResource(io.jaegertracing.crossdock.resources.behavior.http.TraceBehaviorResource) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) EndToEndBehaviorResource(io.jaegertracing.crossdock.resources.behavior.http.EndToEndBehaviorResource) ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) HealthResource(io.jaegertracing.crossdock.resources.health.HealthResource) NetworkListener(org.glassfish.grizzly.http.server.NetworkListener)

Aggregations

SamplerConfiguration (io.jaegertracing.Configuration.SamplerConfiguration)9 Test (org.junit.Test)6 ReporterConfiguration (io.jaegertracing.Configuration.ReporterConfiguration)4 Configuration (io.jaegertracing.Configuration)3 InMemoryMetricsFactory (io.jaegertracing.internal.metrics.InMemoryMetricsFactory)3 Metrics (io.jaegertracing.internal.metrics.Metrics)3 ConstSampler (io.jaegertracing.internal.samplers.ConstSampler)3 ProbabilisticSampler (io.jaegertracing.internal.samplers.ProbabilisticSampler)3 RateLimitingSampler (io.jaegertracing.internal.samplers.RateLimitingSampler)3 Sampler (io.jaegertracing.spi.Sampler)3 SenderConfiguration (io.jaegertracing.Configuration.SenderConfiguration)2 Slf4jLogSender (demo.jaxrs.tracing.Slf4jLogSender)1 CodecConfiguration (io.jaegertracing.Configuration.CodecConfiguration)1 JerseyServer (io.jaegertracing.crossdock.JerseyServer)1 EndToEndBehavior (io.jaegertracing.crossdock.resources.behavior.EndToEndBehavior)1 TraceBehavior (io.jaegertracing.crossdock.resources.behavior.TraceBehavior)1 EndToEndBehaviorResource (io.jaegertracing.crossdock.resources.behavior.http.EndToEndBehaviorResource)1 TraceBehaviorResource (io.jaegertracing.crossdock.resources.behavior.http.TraceBehaviorResource)1 HealthResource (io.jaegertracing.crossdock.resources.health.HealthResource)1 Sender (io.jaegertracing.spi.Sender)1