Search in sources :

Example 26 with Scope

use of io.opentracing.Scope in project jaeger-client-java by jaegertracing.

the class RemovedFrom032Test method testScopeManager_active.

@Test
public void testScopeManager_active() {
    Span span = tracer.buildSpan(SPAN_NAME).start();
    Scope scope = tracer.activateSpan(span);
    try {
        assertEquals(scope, tracer.scopeManager().active());
    } finally {
        scope.close();
    }
}
Also used : Scope(io.opentracing.Scope) Span(io.opentracing.Span) Test(org.junit.Test)

Example 27 with Scope

use of io.opentracing.Scope in project jaeger-client-java by jaegertracing.

the class RemovedFrom032Test method testScopeManager_activate_and_finish.

@Test
public void testScopeManager_activate_and_finish() {
    Span span = tracer.buildSpan(SPAN_NAME).start();
    Scope scope = tracer.scopeManager().activate(span, true);
    try {
        assertEquals(scope, tracer.scopeManager().active());
    } finally {
        scope.close();
    }
    assertEquals(Collections.singletonList(span), reporter.getSpans());
}
Also used : Scope(io.opentracing.Scope) Span(io.opentracing.Span) Test(org.junit.Test)

Example 28 with Scope

use of io.opentracing.Scope in project jaeger-client-java by jaegertracing.

the class RemovedFrom032Test method testSpanBuilder_startActive.

@Test
public void testSpanBuilder_startActive() {
    Scope scope = tracer.buildSpan(SPAN_NAME).startActive(true);
    try {
        assertEquals(scope.span(), tracer.activeSpan());
    } finally {
        scope.close();
    }
    assertEquals(Collections.singletonList(scope.span()), reporter.getSpans());
}
Also used : Scope(io.opentracing.Scope) Test(org.junit.Test)

Example 29 with Scope

use of io.opentracing.Scope in project jaeger-client-java by jaegertracing.

the class RemovedFrom032Test method testScopeManager_activate_and_not_finish.

@Test
public void testScopeManager_activate_and_not_finish() {
    Span span = tracer.buildSpan(SPAN_NAME).start();
    Scope scope = tracer.scopeManager().activate(span, false);
    try {
        assertEquals(scope, tracer.scopeManager().active());
    } finally {
        scope.close();
    }
    assertEquals(0, reporter.getSpans().size());
}
Also used : Scope(io.opentracing.Scope) Span(io.opentracing.Span) Test(org.junit.Test)

Example 30 with Scope

use of io.opentracing.Scope in project jaeger-client-java by jaegertracing.

the class RemovedFrom032Test method testScope_span.

@Test
public void testScope_span() {
    Span span = tracer.buildSpan(SPAN_NAME).start();
    Scope scope = tracer.scopeManager().activate(span);
    try {
        assertEquals(span, scope.span());
    } finally {
        scope.close();
    }
}
Also used : Scope(io.opentracing.Scope) Span(io.opentracing.Span) Test(org.junit.Test)

Aggregations

Scope (io.opentracing.Scope)80 Test (org.junit.Test)52 Span (io.opentracing.Span)46 MockSpan (io.opentracing.mock.MockSpan)10 Tracer (io.opentracing.Tracer)7 Response (javax.ws.rs.core.Response)6 InMemoryReporter (com.uber.jaeger.reporters.InMemoryReporter)5 ConstSampler (com.uber.jaeger.samplers.ConstSampler)5 ScopeManager (io.opentracing.ScopeManager)5 SpanInScope (brave.Tracer.SpanInScope)4 SpanContext (io.opentracing.SpanContext)4 HashMap (java.util.HashMap)4 SpanBuilder (io.opentracing.Tracer.SpanBuilder)3 IOException (java.io.IOException)3 Traced (org.eclipse.microprofile.opentracing.Traced)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 BraveSpan (brave.opentracing.BraveSpan)2 RequestTraceSpan (fish.payara.notification.requesttracing.RequestTraceSpan)2 RequestTracingService (fish.payara.nucleus.requesttracing.RequestTracingService)2 Downstream (io.jaegertracing.crossdock.api.Downstream)2