use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class ThriftSpanConverterTest method setUp.
@Before
public void setUp() {
final JaegerTracer.Builder tracerBuilder = new JaegerTracer.Builder("test-service-name").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withZipkinSharedRpcSpan();
tracer = tracerBuilder.build();
tracer128 = tracerBuilder.withTraceId128Bit().build();
}
use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class ThriftSpanConverterTest method testTracerTags.
@Test
@UseDataProvider("dataProviderTracerTags")
public void testTracerTags(SpanType spanType, Map<String, String> expectedTags) {
InMemoryReporter spanReporter = new InMemoryReporter();
JaegerTracer tracer = new JaegerTracer.Builder("x").withReporter(spanReporter).withSampler(new ConstSampler(true)).withZipkinSharedRpcSpan().withTag("tag.str", "y").withTag("tag.bool", true).withTag("tag.num", 1).build();
JaegerSpan span = tracer.buildSpan("root").start();
if (spanType == SpanType.CHILD) {
span = tracer.buildSpan("child").asChildOf(span).start();
} else if (spanType == SpanType.RPC_SERVER) {
span = tracer.buildSpan("rpc-server").asChildOf(span).withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER).start();
}
com.twitter.zipkin.thriftjava.Span zipkinSpan = ThriftSpanConverter.convertSpan(span);
List<BinaryAnnotation> annotations = zipkinSpan.getBinary_annotations();
for (Map.Entry<String, String> entry : expectedTags.entrySet()) {
String key = entry.getKey();
Object expectedValue = entry.getValue();
BinaryAnnotation anno = findBinaryAnnotation(annotations, key);
if (expectedValue.equals(UNDEF)) {
assertNull("Not expecting " + key + " for " + spanType, anno);
} else if (expectedValue.equals(ANY)) {
assertEquals(key, anno.getKey());
} else {
String actualValue = new String(anno.getValue(), StandardCharsets.UTF_8);
assertEquals("Expecting " + key + " for " + spanType, expectedValue, actualValue);
}
}
}
use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class V2SpanConverterTest method testDoesntAddUnknownTracerIpAsLocalIpV4.
@Test
public void testDoesntAddUnknownTracerIpAsLocalIpV4() {
tracer = new JaegerTracer.Builder("test-service-name").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withZipkinSharedRpcSpan().withTag(Constants.TRACER_IP_TAG_KEY, "").build();
JaegerSpan span = tracer.buildSpan("operation-name").start();
zipkin2.Span zipkinSpan = V2SpanConverter.convertSpan(span);
assertNull(zipkinSpan.localEndpoint().ipv4());
}
use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class JaegerThriftSpanConverterTest method setUp.
@Before
public void setUp() {
final JaegerTracer.Builder tracerBuilder = new JaegerTracer.Builder("test-service-name").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true));
tracer = tracerBuilder.build();
tracer128 = tracerBuilder.withTraceId128Bit().build();
}
use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class EndToEndBehaviorResourceTest method setUp.
@Before
public void setUp() throws Exception {
reporter = new InMemoryReporter();
Tracer tracer = new JaegerTracer.Builder("crossdock-java").withReporter(reporter).withSampler(new ConstSampler(true)).build();
Map<String, Tracer> tracers = new HashMap<>();
tracers.put("const", tracer);
resource = new EndToEndBehaviorResource(new EndToEndBehavior(tracers));
}
Aggregations