Search in sources :

Example 1 with Metrics

use of com.uber.jaeger.metrics.Metrics 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 Metrics

use of com.uber.jaeger.metrics.Metrics 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 Metrics

use of com.uber.jaeger.metrics.Metrics in project jaeger-client-java by jaegertracing.

the class MicrometerTest method setUp.

@Before
public void setUp() {
    registry = io.micrometer.core.instrument.Metrics.globalRegistry;
    prometheusRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
    io.micrometer.core.instrument.Metrics.addRegistry(prometheusRegistry);
    metrics = new Metrics(new MicrometerMetricsFactory());
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) Metrics(com.uber.jaeger.metrics.Metrics) Before(org.junit.Before)

Example 4 with Metrics

use of com.uber.jaeger.metrics.Metrics in project jaeger-client-java by jaegertracing.

the class TracerTest method testRegisterInjector.

@Test
public void testRegisterInjector() {
    @SuppressWarnings("unchecked") Injector<TextMap> injector = mock(Injector.class);
    Tracer tracer = new Tracer.Builder("TracerTestService", new InMemoryReporter(), new ConstSampler(true)).withMetrics(new Metrics(new InMemoryMetricsFactory())).registerInjector(Format.Builtin.TEXT_MAP, injector).build();
    Span span = (Span) tracer.buildSpan("leela").start();
    TextMap carrier = mock(TextMap.class);
    tracer.inject(span.context(), Format.Builtin.TEXT_MAP, carrier);
    verify(injector).inject(any(SpanContext.class), any(TextMap.class));
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) Metrics(com.uber.jaeger.metrics.Metrics) InMemoryMetricsFactory(com.uber.jaeger.metrics.InMemoryMetricsFactory) ConstSampler(com.uber.jaeger.samplers.ConstSampler) TextMap(io.opentracing.propagation.TextMap) Builder(com.uber.jaeger.Tracer.Builder) Test(org.junit.Test)

Example 5 with Metrics

use of com.uber.jaeger.metrics.Metrics in project jaeger-client-java by jaegertracing.

the class TracerTest method setUp.

@Before
public void setUp() throws Exception {
    metricsFactory = new InMemoryMetricsFactory();
    tracer = new Tracer.Builder("TracerTestService").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) InMemoryMetricsFactory(com.uber.jaeger.metrics.InMemoryMetricsFactory) Metrics(com.uber.jaeger.metrics.Metrics) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Builder(com.uber.jaeger.Tracer.Builder) Before(org.junit.Before)

Aggregations

Metrics (com.uber.jaeger.metrics.Metrics)13 ConstSampler (com.uber.jaeger.samplers.ConstSampler)12 InMemoryMetricsFactory (com.uber.jaeger.metrics.InMemoryMetricsFactory)5 NullStatsReporter (com.uber.jaeger.metrics.NullStatsReporter)5 StatsFactoryImpl (com.uber.jaeger.metrics.StatsFactoryImpl)5 InMemoryReporter (com.uber.jaeger.reporters.InMemoryReporter)5 Before (org.junit.Before)5 Test (org.junit.Test)5 Tracer (com.uber.jaeger.Tracer)4 ProbabilisticSampler (com.uber.jaeger.samplers.ProbabilisticSampler)4 RateLimitingSampler (com.uber.jaeger.samplers.RateLimitingSampler)4 Sampler (com.uber.jaeger.samplers.Sampler)4 SamplerConfiguration (com.uber.jaeger.Configuration.SamplerConfiguration)3 Builder (com.uber.jaeger.Tracer.Builder)3 RemoteReporter (com.uber.jaeger.reporters.RemoteReporter)3 HttpSender (com.uber.jaeger.senders.HttpSender)2 TextMap (io.opentracing.propagation.TextMap)2 DefaultBaggageRestrictionManager (com.uber.jaeger.baggage.DefaultBaggageRestrictionManager)1 NoopMetricsFactory (com.uber.jaeger.metrics.NoopMetricsFactory)1 TextMapCodec (com.uber.jaeger.propagation.TextMapCodec)1