Search in sources :

Example 1 with ConstSampler

use of com.uber.jaeger.samplers.ConstSampler in project cxf by apache.

the class Client method main.

public static void main(final String[] args) throws Exception {
    final Metrics metrics = new Metrics(new StatsFactoryImpl(new NullStatsReporter()));
    final Tracer.Builder builder = new Tracer.Builder("cxf-client", new RemoteReporter(new HttpSender("http://localhost:14268/api/traces"), 1000, 100, metrics), new ConstSampler(true));
    final OpenTracingClientProvider provider = new OpenTracingClientProvider(builder.build());
    final javax.ws.rs.client.Client client = ClientBuilder.newClient().register(provider);
    final Response response = client.target("http://localhost:8084/catalog").request().accept(MediaType.APPLICATION_JSON).get();
    LOG.info("Response: {}", response.readEntity(String.class));
    response.close();
    // Allow Tracer to flush
    Thread.sleep(1000);
}
Also used : NullStatsReporter(com.uber.jaeger.metrics.NullStatsReporter) Tracer(com.uber.jaeger.Tracer) ClientBuilder(javax.ws.rs.client.ClientBuilder) OpenTracingClientProvider(org.apache.cxf.tracing.opentracing.jaxrs.OpenTracingClientProvider) HttpSender(com.uber.jaeger.senders.HttpSender) Response(javax.ws.rs.core.Response) RemoteReporter(com.uber.jaeger.reporters.RemoteReporter) Metrics(com.uber.jaeger.metrics.Metrics) ConstSampler(com.uber.jaeger.samplers.ConstSampler) StatsFactoryImpl(com.uber.jaeger.metrics.StatsFactoryImpl)

Example 2 with ConstSampler

use of com.uber.jaeger.samplers.ConstSampler in project cxf by apache.

the class Server method tracer.

@Bean
Tracer tracer() {
    final Metrics metrics = new Metrics(new StatsFactoryImpl(new NullStatsReporter()));
    final Tracer.Builder builder = new Tracer.Builder("camel-server", new RemoteReporter(new HttpSender("http://localhost:14268/api/traces"), 1000, 100, metrics), new ConstSampler(true)).registerExtractor(Builtin.TEXT_MAP, new TextMapCodec(true));
    return builder.build();
}
Also used : RemoteReporter(com.uber.jaeger.reporters.RemoteReporter) Metrics(com.uber.jaeger.metrics.Metrics) NullStatsReporter(com.uber.jaeger.metrics.NullStatsReporter) Tracer(com.uber.jaeger.Tracer) ConstSampler(com.uber.jaeger.samplers.ConstSampler) TextMapCodec(com.uber.jaeger.propagation.TextMapCodec) StatsFactoryImpl(com.uber.jaeger.metrics.StatsFactoryImpl) HttpSender(com.uber.jaeger.senders.HttpSender) Bean(org.springframework.context.annotation.Bean)

Example 3 with ConstSampler

use of com.uber.jaeger.samplers.ConstSampler 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 4 with ConstSampler

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

the class ServerFilterTest method setUp.

@Before
public void setUp() {
    reporter = new InMemoryReporter();
    tracer = new com.uber.jaeger.Tracer.Builder("Angry Machine", reporter, new ConstSampler(true)).build();
    // Using deprecated constructor for test coverage
    undertest = new ServerFilter(tracer, null);
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Before(org.junit.Before)

Example 5 with ConstSampler

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

the class ZipkinSenderTest method setUp.

@Before
public void setUp() throws Exception {
    reporter = new InMemoryReporter();
    tracer = new Tracer.Builder("test-sender", reporter, new ConstSampler(true)).withStatsReporter(new InMemoryStatsReporter()).build();
    sender = newSender(messageMaxBytes);
    converter = new ThriftSpanConverter();
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) InMemoryStatsReporter(com.uber.jaeger.metrics.InMemoryStatsReporter) Tracer(com.uber.jaeger.Tracer) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Before(org.junit.Before)

Aggregations

ConstSampler (com.uber.jaeger.samplers.ConstSampler)33 InMemoryReporter (com.uber.jaeger.reporters.InMemoryReporter)26 Test (org.junit.Test)19 Tracer (com.uber.jaeger.Tracer)12 Before (org.junit.Before)11 Metrics (com.uber.jaeger.metrics.Metrics)9 InMemoryMetricsFactory (com.uber.jaeger.metrics.InMemoryMetricsFactory)5 Scope (io.opentracing.Scope)5 Builder (com.uber.jaeger.Tracer.Builder)4 InMemoryStatsReporter (com.uber.jaeger.metrics.InMemoryStatsReporter)3 NullStatsReporter (com.uber.jaeger.metrics.NullStatsReporter)3 StatsFactoryImpl (com.uber.jaeger.metrics.StatsFactoryImpl)3 TextMap (io.opentracing.propagation.TextMap)3 HashMap (java.util.HashMap)3 DefaultBaggageRestrictionManager (com.uber.jaeger.baggage.DefaultBaggageRestrictionManager)2 RemoteReporter (com.uber.jaeger.reporters.RemoteReporter)2 Sampler (com.uber.jaeger.samplers.Sampler)2 HttpSender (com.uber.jaeger.senders.HttpSender)2 Tracer (io.opentracing.Tracer)2 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)1