Search in sources :

Example 16 with SpanContext

use of com.uber.jaeger.SpanContext in project cxf by apache.

the class OpenTracingTracingTest method testThatCurrentSpanIsAnnotatedWithKeyValue.

@Test
public void testThatCurrentSpanIsAnnotatedWithKeyValue() {
    final SpanContext spanId = fromRandom();
    final Response r = withTrace(createWebClient("/bookstore/book/1"), spanId).get();
    assertEquals(Status.OK.getStatusCode(), r.getStatus());
    assertThat(TestSender.getAllSpans().size(), equalTo(1));
    assertThat(TestSender.getAllSpans().get(0).getOperationName(), equalTo("GET /bookstore/book/1"));
    assertThat(TestSender.getAllSpans().get(0).getTags(), hasItem("book-id", "1"));
}
Also used : Response(javax.ws.rs.core.Response) SpanContext(com.uber.jaeger.SpanContext) Test(org.junit.Test)

Example 17 with SpanContext

use of com.uber.jaeger.SpanContext in project cxf by apache.

the class OpenTracingTracingTest method testThatInnerSpanIsCreatedUsingPseudoAsyncInvocation.

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

Example 18 with SpanContext

use of com.uber.jaeger.SpanContext in project cxf by apache.

the class OpenTracingTracingTest method testThatParallelSpanIsAnnotatedWithTimeline.

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

Example 19 with SpanContext

use of com.uber.jaeger.SpanContext in project cxf by apache.

the class OpenTracingTracingTest method testThatNewInnerSpanIsCreatedUsingAsyncInvocation.

@Test
public void testThatNewInnerSpanIsCreatedUsingAsyncInvocation() {
    final SpanContext spanId = fromRandom();
    final Response r = withTrace(createWebClient("/bookstore/books/async"), spanId).get();
    assertEquals(Status.OK.getStatusCode(), r.getStatus());
    assertThat(TestSender.getAllSpans().size(), equalTo(2));
    assertThat(TestSender.getAllSpans().get(0).getOperationName(), equalTo("GET /bookstore/books/async"));
    assertThat(TestSender.getAllSpans().get(1).getOperationName(), equalTo("Processing books"));
    assertThat(TestSender.getAllSpans().get(0).getReferences(), not(empty()));
    assertThat(TestSender.getAllSpans().get(0).getReferences().get(0).getSpanContext().getSpanId(), equalTo(spanId.getSpanId()));
}
Also used : Response(javax.ws.rs.core.Response) SpanContext(com.uber.jaeger.SpanContext) Test(org.junit.Test)

Example 20 with SpanContext

use of com.uber.jaeger.SpanContext in project cxf by apache.

the class OpenTracingTracingTest method testThatNewInnerSpanIsCreated.

@Test
public void testThatNewInnerSpanIsCreated() throws MalformedURLException {
    final SpanContext spanId = fromRandom();
    final Map<String, List<String>> headers = new HashMap<>();
    tracer.inject(spanId, Builtin.HTTP_HEADERS, new TextMapInjectAdapter(headers));
    final BookStoreService service = createJaxWsService(headers);
    assertThat(service.getBooks().size(), equalTo(2));
    assertThat(TestSender.getAllSpans().size(), equalTo(2));
    assertThat(TestSender.getAllSpans().get(0).getOperationName(), equalTo("Get Books"));
    assertThat(TestSender.getAllSpans().get(1).getOperationName(), equalTo("POST /BookStore"));
}
Also used : SpanContext(com.uber.jaeger.SpanContext) HashMap(java.util.HashMap) TextMapInjectAdapter(org.apache.cxf.tracing.opentracing.internal.TextMapInjectAdapter) BookStoreService(org.apache.cxf.systest.jaxws.tracing.BookStoreService) List(java.util.List) Test(org.junit.Test)

Aggregations

SpanContext (com.uber.jaeger.SpanContext)29 Test (org.junit.Test)25 TextMap (io.opentracing.propagation.TextMap)6 Response (javax.ws.rs.core.Response)6 Span (com.uber.jaeger.Span)5 TraceData (com.github.kristofa.brave.TraceData)3 HashMap (java.util.HashMap)3 SpanId (com.github.kristofa.brave.SpanId)2 Tracer (com.uber.jaeger.Tracer)2 Span (io.opentracing.Span)2 List (java.util.List)2 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)1 Endpoint (com.twitter.zipkin.thriftjava.Endpoint)1 ObservedSpan (com.uber.jaeger.crossdock.api.ObservedSpan)1 ConstSampler (com.uber.jaeger.samplers.ConstSampler)1 SpanRef (com.uber.jaeger.thriftjava.SpanRef)1 TextMapExtractAdapter (io.opentracing.propagation.TextMapExtractAdapter)1 TextMapInjectAdapter (io.opentracing.propagation.TextMapInjectAdapter)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1