Search in sources :

Example 1 with SamplerConfiguration

use of io.jaegertracing.Configuration.SamplerConfiguration in project cxf by apache.

the class Client method main.

public static void main(final String[] args) throws Exception {
    final Tracer tracer = new Configuration("tracer-client").withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1)).withReporter(new ReporterConfiguration().withSender(new SenderConfiguration() {

        @Override
        public Sender getSender() {
            return new Slf4jLogSender();
        }
    })).getTracer();
    final OpenTracingClientProvider provider = new OpenTracingClientProvider(tracer);
    final Response response = WebClient.create("http://localhost:9000/catalog", Arrays.asList(provider)).accept(MediaType.APPLICATION_JSON).get();
    System.out.println(response.readEntity(String.class));
    response.close();
}
Also used : Slf4jLogSender(demo.jaxrs.tracing.Slf4jLogSender) Sender(io.jaegertracing.spi.Sender) Response(javax.ws.rs.core.Response) SenderConfiguration(io.jaegertracing.Configuration.SenderConfiguration) ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Configuration(io.jaegertracing.Configuration) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) Tracer(io.opentracing.Tracer) OpenTracingClientProvider(org.apache.cxf.tracing.opentracing.jaxrs.OpenTracingClientProvider) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) Slf4jLogSender(demo.jaxrs.tracing.Slf4jLogSender) SenderConfiguration(io.jaegertracing.Configuration.SenderConfiguration) ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration)

Example 2 with SamplerConfiguration

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

the class TraceBehaviorResourceTest method setUp.

@Before
public void setUp() throws Exception {
    Configuration configuration = new Configuration(SERVICE_NAME).withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(0)).withReporter(new ReporterConfiguration().withLogSpans(true));
    server = new JerseyServer("127.0.0.1", port, configuration, Collections.singletonList(new TraceBehaviorResource(configuration.getTracer())));
    hostPort = String.format("127.0.0.1:%d", port);
    behavior = new TraceBehavior(server.getTracer());
}
Also used : ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Configuration(io.jaegertracing.Configuration) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) JerseyServer(io.jaegertracing.crossdock.JerseyServer) TraceBehavior(io.jaegertracing.crossdock.resources.behavior.TraceBehavior) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Before(org.junit.Before)

Example 3 with SamplerConfiguration

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

Example 4 with SamplerConfiguration

use of io.jaegertracing.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 InMemoryMetricsFactory()));
    assertTrue(sampler instanceof ConstSampler);
}
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) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) Test(org.junit.Test)

Example 5 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)

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