Search in sources :

Example 61 with JaegerSpanContext

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

the class TextMapCodecTest method testContextFromString.

@Test
public void testContextFromString() {
    JaegerSpanContext context = TextMapCodec.contextFromString("ff:dd:cc:4");
    assertEquals(context.getTraceIdLow(), 255L);
    assertEquals(context.getTraceIdHigh(), 0L);
    assertEquals(context.getSpanId(), 221L);
    assertEquals(context.getParentId(), 204L);
    assertEquals(context.getFlags(), 4);
}
Also used : JaegerSpanContext(io.jaegertracing.internal.JaegerSpanContext) Test(org.junit.Test)

Example 62 with JaegerSpanContext

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

the class TextMapCodecTest method testAdhocBaggageWithoutTraceId.

/**
 * Tests that the codec will return non-null SpanContext even if the only header
 * present is "jaeger-baggage".
 */
@Test
public void testAdhocBaggageWithoutTraceId() {
    Map<String, String> headers = new HashMap<>();
    headers.put("jaeger-baggage", "k1=v1, k2 = v2, k3=v3=d3");
    TextMapCodec codec = new TextMapCodec(false);
    JaegerSpanContext context = codec.extract(new TextMapAdapter(headers));
    assertEquals("v1", context.getBaggageItem("k1"));
    assertEquals("v2", context.getBaggageItem("k2"));
    assertNull(context.getBaggageItem("k3"));
}
Also used : HashMap(java.util.HashMap) TextMapAdapter(io.opentracing.propagation.TextMapAdapter) JaegerSpanContext(io.jaegertracing.internal.JaegerSpanContext) Test(org.junit.Test)

Example 63 with JaegerSpanContext

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

the class TextMapCodecTest method testContextFromStringWith128BitTraceId.

@Test
public void testContextFromStringWith128BitTraceId() {
    JaegerSpanContext context = TextMapCodec.contextFromString("100000000000000ff:dd:cc:4");
    assertEquals(context.getTraceIdLow(), 255L);
    assertEquals(context.getTraceIdHigh(), 1L);
    assertEquals(context.getSpanId(), 221L);
    assertEquals(context.getParentId(), 204L);
    assertEquals(context.getFlags(), 4);
}
Also used : JaegerSpanContext(io.jaegertracing.internal.JaegerSpanContext) Test(org.junit.Test)

Example 64 with JaegerSpanContext

use of io.jaegertracing.internal.JaegerSpanContext in project cxf by apache.

the class OpenTracingTracingTest method testThatParallelSpanIsAnnotatedWithTimeline.

@Test
public void testThatParallelSpanIsAnnotatedWithTimeline() {
    final JaegerSpanContext spanId = fromRandom();
    final Response r = withTrace(createWebClient("/bookstore/process"), spanId).put("");
    assertEquals(Status.OK.getStatusCode(), r.getStatus());
    assertThat(REPORTER.getSpans().size(), equalTo(2));
    assertThat(REPORTER.getSpans(), hasSpan("Processing books", hasItem("Processing started")));
    assertThat(REPORTER.getSpans(), hasSpan("PUT /bookstore/process"));
}
Also used : Response(javax.ws.rs.core.Response) JaegerSpanContext(io.jaegertracing.internal.JaegerSpanContext) Test(org.junit.Test)

Example 65 with JaegerSpanContext

use of io.jaegertracing.internal.JaegerSpanContext in project cxf by apache.

the class OpenTracingTracingTest method testThatInnerSpanIsCreatedUsingPseudoAsyncInvocation.

@Test
public void testThatInnerSpanIsCreatedUsingPseudoAsyncInvocation() {
    final JaegerSpanContext spanId = fromRandom();
    final Response r = withTrace(createWebClient("/bookstore/books/pseudo-async"), spanId).get();
    assertEquals(Status.OK.getStatusCode(), r.getStatus());
    assertThat(REPORTER.getSpans().size(), equalTo(2));
    assertThat(REPORTER.getSpans().get(1).getOperationName(), equalTo("GET /bookstore/books/pseudo-async"));
    assertThat(REPORTER.getSpans().get(0).getOperationName(), equalTo("Processing books"));
}
Also used : Response(javax.ws.rs.core.Response) JaegerSpanContext(io.jaegertracing.internal.JaegerSpanContext) Test(org.junit.Test)

Aggregations

JaegerSpanContext (io.jaegertracing.internal.JaegerSpanContext)68 Test (org.junit.Test)59 HashMap (java.util.HashMap)20 TextMapAdapter (io.opentracing.propagation.TextMapAdapter)19 JaegerSpan (io.jaegertracing.internal.JaegerSpan)10 JaegerTracer (io.jaegertracing.internal.JaegerTracer)8 Response (javax.ws.rs.core.Response)7 TextMap (io.opentracing.propagation.TextMap)6 CodecConfiguration (io.jaegertracing.Configuration.CodecConfiguration)4 ReporterConfiguration (io.jaegertracing.Configuration.ReporterConfiguration)4 SamplerConfiguration (io.jaegertracing.Configuration.SamplerConfiguration)4 SenderConfiguration (io.jaegertracing.Configuration.SenderConfiguration)4 List (java.util.List)3 ObservedSpan (io.jaegertracing.crossdock.api.ObservedSpan)2 TestBinaryCarrier (io.jaegertracing.internal.propagation.TestBinaryCarrier)2 InMemoryReporter (io.jaegertracing.internal.reporters.InMemoryReporter)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)1 Endpoint (com.twitter.zipkin.thriftjava.Endpoint)1