Search in sources :

Example 1 with TestBinaryCarrier

use of io.jaegertracing.internal.propagation.TestBinaryCarrier in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method assertBinaryInjectExtract.

private void assertBinaryInjectExtract(JaegerTracer tracer, JaegerSpanContext contextToInject) {
    TestBinaryCarrier carrier = new TestBinaryCarrier();
    tracer.inject(contextToInject, Format.Builtin.BINARY, carrier);
    JaegerSpanContext extractedContext = tracer.extract(Format.Builtin.BINARY, carrier);
    assertEquals(contextToInject.getTraceId(), extractedContext.getTraceId());
    assertEquals(contextToInject.getSpanId(), extractedContext.getSpanId());
}
Also used : TestBinaryCarrier(io.jaegertracing.internal.propagation.TestBinaryCarrier) JaegerSpanContext(io.jaegertracing.internal.JaegerSpanContext)

Example 2 with TestBinaryCarrier

use of io.jaegertracing.internal.propagation.TestBinaryCarrier in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testPropagationBinary.

@Test
public void testPropagationBinary() {
    System.setProperty(Configuration.JAEGER_PROPAGATION, "jaeger");
    System.setProperty(Configuration.JAEGER_SERVICE_NAME, "Test");
    long traceIdLow = 1234L;
    long spanId = 5678L;
    TestBinaryCarrier buffer = new TestBinaryCarrier();
    JaegerSpanContext spanContext = new JaegerSpanContext(0, traceIdLow, spanId, 0, (byte) 0);
    JaegerTracer tracer = Configuration.fromEnv().getTracer();
    tracer.inject(spanContext, Format.Builtin.BINARY, buffer);
    JaegerSpanContext extractedContext = tracer.extract(Format.Builtin.BINARY, buffer);
    assertEquals(traceIdLow, extractedContext.getTraceIdLow());
    assertEquals(0, extractedContext.getTraceIdHigh());
    assertEquals(spanId, extractedContext.getSpanId());
}
Also used : TestBinaryCarrier(io.jaegertracing.internal.propagation.TestBinaryCarrier) JaegerSpanContext(io.jaegertracing.internal.JaegerSpanContext) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Test(org.junit.Test)

Aggregations

JaegerSpanContext (io.jaegertracing.internal.JaegerSpanContext)2 TestBinaryCarrier (io.jaegertracing.internal.propagation.TestBinaryCarrier)2 JaegerTracer (io.jaegertracing.internal.JaegerTracer)1 Test (org.junit.Test)1