use of io.jaegertracing.internal.JaegerTracer in project jaeger-client-java by jaegertracing.
the class InMemoryMetricsFactoryTest method emptyValueForTag.
@Test
public void emptyValueForTag() {
InMemoryMetricsFactory metricsFactory = new InMemoryMetricsFactory();
JaegerTracer tracer = new JaegerTracer.Builder("metricsFactoryTest").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
tracer.buildSpan("theoperation").start();
assertEquals(-1, metricsFactory.getCounter("jaeger_tracer_started_spans", "sampled"));
assertEquals(-1, metricsFactory.getCounter("jaeger_tracer_started_spans", ""));
}
use of io.jaegertracing.internal.JaegerTracer in project jaeger-client-java by jaegertracing.
the class InMemoryMetricsFactoryTest method canBeUsedWithMetrics.
@Test
public void canBeUsedWithMetrics() {
InMemoryMetricsFactory metricsFactory = new InMemoryMetricsFactory();
JaegerTracer tracer = new JaegerTracer.Builder("metricsFactoryTest").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
tracer.buildSpan("theoperation").start();
assertEquals(1, metricsFactory.getCounter("jaeger_tracer_started_spans", "sampled=y"));
assertEquals(0, metricsFactory.getCounter("jaeger_tracer_started_spans", "sampled=n"));
assertEquals(1, metricsFactory.getCounter("jaeger_tracer_traces", "sampled=y,state=started"));
assertEquals(0, metricsFactory.getCounter("jaeger_tracer_traces", "sampled=n,state=started"));
}
use of io.jaegertracing.internal.JaegerTracer in project jaeger-client-java by jaegertracing.
the class TraceContextCodecTest method testDebugIdWithTraceHeader.
@Test
public void testDebugIdWithTraceHeader() {
Map<String, String> extractCarrier = new HashMap<>();
TextMapAdapter textMap = new TextMapAdapter(extractCarrier);
textMap.put(TRACE_PARENT, EXAMPLE_TRACE_PARENT);
textMap.put(Constants.DEBUG_ID_HEADER_KEY, EXAMPLE_DEBUG_ID);
JaegerSpanContext spanContext = traceContextCodec.extract(textMap);
JaegerTracer tracer = new JaegerTracer.Builder("service").withReporter(new InMemoryReporter()).build();
assertEquals("0000000000000001", spanContext.getTraceId());
JaegerSpan child = tracer.buildSpan("span").asChildOf(spanContext).start();
assertFalse(child.context().isDebug());
child.finish();
tracer.close();
}
Aggregations