Search in sources :

Example 6 with Metrics

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

the class TracerTest method testWithBaggageRestrictionManager.

@Test
public void testWithBaggageRestrictionManager() {
    tracer = new Tracer.Builder("TracerTestService", new InMemoryReporter(), new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
    Span span = (Span) tracer.buildSpan("some-operation").start();
    final String key = "key";
    tracer.setBaggage(span, key, "value");
    assertEquals(1, metricsFactory.getCounter("jaeger:baggage_updates", "result=ok"));
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) Metrics(com.uber.jaeger.metrics.Metrics) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Builder(com.uber.jaeger.Tracer.Builder) Test(org.junit.Test)

Example 7 with Metrics

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

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

Example 9 with Metrics

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

the class SpanTest method setUp.

@Before
public void setUp() {
    metricsFactory = new InMemoryMetricsFactory();
    reporter = new InMemoryReporter();
    clock = mock(Clock.class);
    metrics = new Metrics(metricsFactory);
    tracer = new Tracer.Builder("SamplerTest", reporter, new ConstSampler(true)).withMetrics(metrics).withClock(clock).withBaggageRestrictionManager(new DefaultBaggageRestrictionManager()).withExpandExceptionLogs().build();
    span = (Span) tracer.buildSpan("some-operation").start();
}
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) Clock(com.uber.jaeger.utils.Clock) DefaultBaggageRestrictionManager(com.uber.jaeger.baggage.DefaultBaggageRestrictionManager) Before(org.junit.Before)

Example 10 with Metrics

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

the class BaggageSetterTest method setUp.

@Before
public void setUp() throws Exception {
    metricsFactory = new InMemoryMetricsFactory();
    reporter = new InMemoryReporter();
    metrics = new Metrics(metricsFactory);
    mgr = mock(DefaultBaggageRestrictionManager.class);
    setter = new BaggageSetter(mgr, metrics);
    tracer = new Tracer.Builder(SERVICE, reporter, new ConstSampler(true)).withMetrics(metrics).build();
    span = (Span) tracer.buildSpan("some-operation").startManual();
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) InMemoryMetricsFactory(com.uber.jaeger.metrics.InMemoryMetricsFactory) Metrics(com.uber.jaeger.metrics.Metrics) Tracer(com.uber.jaeger.Tracer) ConstSampler(com.uber.jaeger.samplers.ConstSampler) 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