org.springframework.cloud.sleuth.Span

Here are the examples of the java api org.springframework.cloud.sleuth.Span taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

63 Examples 7

19 View Source File : TraceRestTemplateInterceptorTests.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
public void replacedertThatParentSpanIdSet(Span span, Map<String, String> headers) {
}

19 View Source File : MultipleHopsIntegrationTests.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
protected void replacedertBaggage(Span initialSpan) {
    then(this.myBaggageChangedListener.baggageChanged).as("All have request ID").filteredOn(b -> b.getBaggage() != null).filteredOn(b -> b.getBaggage().getEntryValue(REQUEST_ID) != null).isNotEmpty().allMatch(event -> "f4308d05-2228-4468-80f6-92a8377ba193".equals(event.getBaggage().getEntryValue(REQUEST_ID)));
    then(this.demoApplication.getBaggageValue()).isEqualTo("FO");
}

19 View Source File : NoOpTracer.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
public SpanInScope withSpan(Span span) {
    return new NoOpSpanInScope();
}

19 View Source File : NoOpTracer.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
public Span nextSpan(Span parent) {
    return new NoOpSpan();
}

19 View Source File : NoOpHttpServerHandler.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
public void handleSend(HttpServerResponse response, Span span) {
}

19 View Source File : NoOpHttpClientHandler.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
public void handleReceive(HttpClientResponse response, Span span) {
}

19 View Source File : OtelTracer.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

private io.opentelemetry.api.trace.Span delegate(Span span) {
    if (span == null) {
        // remove any existing span/baggage data from the current state of anything
        // that might be holding on to it.
        this.publisher.publishEvent(new EventPublishingContextWrapper.ScopeClosedEvent(this));
        return io.opentelemetry.api.trace.Span.getInvalid();
    }
    return ((OtelSpan) span).delegate;
}

19 View Source File : OtelTracer.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
public SpanInScope withSpan(Span span) {
    io.opentelemetry.api.trace.Span delegate = delegate(span);
    return new OtelSpanInScope((OtelSpan) span, delegate);
}

19 View Source File : OtelSpan.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

static io.opentelemetry.api.trace.Span toOtel(Span span) {
    return ((OtelSpan) span).delegate;
}

19 View Source File : OtelHttpClientHandler.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
protected void onResponse(io.opentelemetry.api.trace.Span span, HttpClientResponse httpClientResponse) {
    super.onResponse(span, httpClientResponse);
    if (this.httpClientResponseParser != null) {
        Span fromOtel = OtelSpan.fromOtel(span);
        this.httpClientResponseParser.parse(httpClientResponse, fromOtel.context(), fromOtel);
    }
}

19 View Source File : SleuthModuleTest.java
License : Apache License 2.0
Project Creator : crnk-project

private void replacedertBinaryAnnotation(Span span, String key, String value) {
    replacedert.replacedertEquals(value, span.tags().get(key));
}

19 View Source File : TestSpanReporter.java
License : Apache License 2.0
Project Creator : crnk-project

@Override
public void report(Span span) {
    spans.add(span);
}

19 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testContinueNull() {
    Span span = tracer.continueSpan(null);
    replacedertThat(span).isNull();
}

19 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

private static Span[] createSpansAndreplacedertCurrent(int len) {
    Span[] spans = new Span[len];
    Span current = null;
    for (int i = 0; i < len; i++) {
        current = tracer.createSpan("span" + i, current);
        spans[i] = current;
        replacedertCurrentSpanIs(current);
    }
    return spans;
}

19 View Source File : OpenCensusSleuthSpanTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testFromSleuthNotSampled() {
    Span sleuthSpan = Span.builder().name("name").traceIdHigh(12L).traceId(22L).spanId(23L).exportable(false).build();
    replacedertSpanEquals(new OpenCensusSleuthSpan(sleuthSpan), sleuthSpan);
}

19 View Source File : OpenCensusSleuthSpanTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testFromSleuthSampled() {
    Span sleuthSpan = Span.builder().name("name").traceIdHigh(12L).traceId(22L).spanId(23L).exportable(true).build();
    replacedertSpanEquals(new OpenCensusSleuthSpan(sleuthSpan), sleuthSpan);
}

19 View Source File : OpenCensusSleuthSpanContextHolder.java
License : Apache License 2.0
Project Creator : census-instrumentation

// Set the current span in the thread context
static void setCurrentSpan(Span span) {
    if (log.isTraceEnabled()) {
        log.trace("Setting current span " + span);
    }
    push(span, /* autoClose= */
    false);
}

19 View Source File : OpenCensusSleuthSpanContextHolder.java
License : Apache License 2.0
Project Creator : census-instrumentation

private static boolean isCurrent(Span span) {
    if (span == null) {
        return false;
    }
    SpanContext currentSpanContext = CURRENT_SPAN.get();
    return currentSpanContext != null && span.equals(currentSpanContext.span);
}

19 View Source File : OpenCensusSleuthSpanContextHolder.java
License : Apache License 2.0
Project Creator : census-instrumentation

/**
 * Push a span into the thread context, with the option to have it auto close if any child spans
 * are themselves closed. Use autoClose=true if you start a new span with a parent that wasn't
 * already in thread context.
 */
static void push(Span span, boolean autoClose) {
    if (isCurrent(span)) {
        return;
    }
    setSpanContextInternal(new SpanContext(span, autoClose));
}

18 View Source File : AcemFinancialUIApplication.java
License : MIT License
Project Creator : spring2go

@RequestMapping("/readtimeout")
public String timeout() throws InterruptedException {
    Span span = this.tracer.createSpan("first_span");
    try {
        Thread.sleep(300);
        log.info("Hello from service1. Calling service2 - should end up with read timeout");
        String response = restTemplate.getForObject("http://" + serviceAddress + "/readtimeout", String.clreplaced);
        log.info("Got response from service2 [{}]", response);
        return response;
    } finally {
        this.tracer.close(span);
    }
}

18 View Source File : TraceRunnableTests.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
protected void replacedertThatThereIsNoParentId(Span secondSpan) {
    BDDreplacedertions.then(secondSpan.context().parentId()).as("saved span as remnant of first span").isEqualTo(io.opentelemetry.api.trace.Span.getInvalid().getSpanContext().getSpanId());
}

18 View Source File : OtelTracer.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
public Span nextSpan(Span parent) {
    if (parent == null) {
        return nextSpan();
    }
    return OtelSpan.fromOtel(this.tracer.spanBuilder("").setParent(OtelTraceContext.toOtelContext(parent.context())).startSpan());
}

18 View Source File : OtelHttpClientHandler.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
public void handleReceive(HttpClientResponse response, Span span) {
    io.opentelemetry.api.trace.Span otelSpan = OtelSpan.toOtel(span);
    if (otelSpan.equals(io.opentelemetry.api.trace.Span.getInvalid())) {
        if (log.isDebugEnabled()) {
            log.debug("Not doing anything because the span is invalid");
        }
        return;
    }
    if (response.error() != null) {
        if (log.isDebugEnabled()) {
            log.debug("There was an error, will finish span [" + otelSpan + "] exceptionally");
        }
        endExceptionally(Context.current().with(otelSpan), response, response.error());
    } else {
        if (log.isDebugEnabled()) {
            log.debug("There was no error, will finish span [" + otelSpan + "] in a standard way");
        }
        end(Context.current().with(otelSpan), response);
    }
}

18 View Source File : OtelHttpClientHandler.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
protected void onRequest(io.opentelemetry.api.trace.Span span, HttpClientRequest httpClientRequest) {
    super.onRequest(span, httpClientRequest);
    if (this.httpClientRequestParser != null) {
        Span fromOtel = OtelSpan.fromOtel(span);
        this.httpClientRequestParser.parse(httpClientRequest, fromOtel.context(), fromOtel);
    }
    String path = httpClientRequest.path();
    if (path != null) {
        span.setAttribute(SemanticAttributes.HTTP_ROUTE, path);
    }
}

18 View Source File : SleuthBenchmarkingSpringApp.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

public String continuedSpan() {
    Span span = this.tracer.currentSpan();
    span.tag("foo", "bar");
    span.event("continuedspan.before");
    String response = "continued";
    span.event("continuedspan.after");
    return response;
}

18 View Source File : SleuthBenchmarkingSpringApp.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

public String manualSpan() {
    Span manual = this.tracer.nextSpan().name("span-name");
    try (Tracer.SpanInScope ws = this.tracer.withSpan(manual.start())) {
        return this.anotherClreplaced.continuedSpan();
    } finally {
        manual.end();
    }
}

18 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testSpanStackAndDetach() {
    Span[] spans = createSpansAndreplacedertCurrent(3);
    Span parent = tracer.detach(spans[spans.length - 1]);
    replacedertThat(parent).isEqualTo(spans[spans.length - 2]);
}

18 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testDetachNull() {
    Span parent = tracer.detach(null);
    replacedertThat(parent).isNull();
}

18 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testSpanStackAndDetachOutOfOrder() {
    Span[] spans = createSpansAndreplacedertCurrent(3);
    // try to detach a non-current span
    tracer.detach(spans[spans.length - 2]);
    replacedertCurrentSpanIs(spans[spans.length - 1]);
    Span parent = tracer.detach(spans[spans.length - 1]);
    replacedertThat(parent).isEqualTo(spans[spans.length - 2]);
}

18 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testSpanStackAndClose() {
    Span[] spans = createSpansAndreplacedertCurrent(3);
    // pop the stack
    for (int i = spans.length - 1; i >= 0; i--) {
        replacedertCurrentSpanIs(spans[i]);
        Span parent = tracer.close(spans[i]);
        replacedertThat(parent).isEqualTo(spans[i].getSavedSpan());
    }
}

18 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testSpanStackAndCloseOutOfOrder() {
    Span[] spans = createSpansAndreplacedertCurrent(3);
    // try to close a non-current span
    tracer.close(spans[spans.length - 2]);
    replacedertCurrentSpanIs(spans[spans.length - 1]);
    // pop the stack
    for (int i = spans.length - 1; i >= 0; i--) {
        tracer.close(spans[i]);
    }
}

18 View Source File : OpenCensusSleuthTracer.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Override
public void addTag(String key, String value) {
    Span s = getCurrentSpan();
    if (s != null && s.isExportable()) {
        s.tag(key, value);
    }
}

18 View Source File : OpenCensusSleuthTracer.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Override
@javax.annotation.Nullable
public Span createSpan(String name, /*@Nullable*/
Span parent) {
    if (parent == null) {
        return createSpan(name);
    }
    return continueSpan(createChild(parent, name));
}

18 View Source File : OpenCensusSleuthTracer.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Override
@javax.annotation.Nullable
public Span continueSpan(/*@Nullable*/
Span span) {
    if (span != null) {
        this.spanLogger.logContinuedSpan(span);
    } else {
        return null;
    }
    Span newSpan = createContinuedSpan(span, OpenCensusSleuthSpanContextHolder.getCurrentSpan());
    OpenCensusSleuthSpanContextHolder.setCurrentSpan(newSpan);
    return newSpan;
}

18 View Source File : OpenCensusSleuthTracer.java
License : Apache License 2.0
Project Creator : census-instrumentation

@SuppressWarnings("deprecation")
private static Span createContinuedSpan(Span span, /*@Nullable*/
Span saved) {
    if (saved == null && span.getSavedSpan() != null) {
        saved = span.getSavedSpan();
    }
    return new Span(span, saved);
}

17 View Source File : OtelHttpServerHandler.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

@Override
protected void onConnectionAndRequest(io.opentelemetry.api.trace.Span span, HttpServerRequest connection, HttpServerRequest request) {
    super.onConnectionAndRequest(span, connection, request);
    if (this.httpServerRequestParser != null) {
        Span fromOtel = OtelSpan.fromOtel(span);
        this.httpServerRequestParser.parse(request, fromOtel.context(), fromOtel);
    }
}

17 View Source File : OtelHttpServerHandler.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator

private void parseResponse(Span span, HttpServerResponse response) {
    if (this.httpServerResponseParser != null) {
        this.httpServerResponseParser.parse(response, span.context(), span);
    }
}

17 View Source File : CustomerController.java
License : Apache License 2.0
Project Creator : MrBW

private void appendSpan(String value, String key) {
    Span span = tracer.getCurrentSpan();
    String baggageKey = key;
    String baggageValue = value;
    span.setBaggageItem(baggageKey, baggageValue);
    tracer.addTag(baggageKey, baggageValue);
}

17 View Source File : AddressController.java
License : Apache License 2.0
Project Creator : MrBW

private void appendSpan(String city) {
    Span span = tracer.getCurrentSpan();
    String baggageKey = "address-city";
    String baggageValue = city;
    span.setBaggageItem(baggageKey, baggageValue);
    tracer.addTag(baggageKey, baggageValue);
}

17 View Source File : SleuthModuleTest.java
License : Apache License 2.0
Project Creator : crnk-project

@Test
public void testError() {
    Task task = new Task();
    task.setId(13L);
    try {
        taskRepo.create(task);
    } catch (Exception e) {
    // ok
    }
    // check client call and link span
    ArgumentCaptor<Span> clientSpanCaptor = ArgumentCaptor.forClreplaced(Span.clreplaced);
    List<Span> clientSpans = clientSpanCaptor.getAllValues();
    Span callSpan = clientSpans.get(0);
    replacedert.replacedertEquals("post", callSpan.getName());
    replacedert.replacedertTrue(callSpan.toString().contains("\"cs\""));
    replacedert.replacedertTrue(callSpan.toString().contains("\"cr\""));
    replacedertBinaryAnnotation(callSpan, "http.status_code", "500");
    // check server local span
    replacedert.replacedertEquals(1, reportedSpans.spans.size());
    Span repositorySpan = reportedSpans.spans.get(0);
    replacedert.replacedertEquals("crnk:post:/tasks/13", repositorySpan.getName());
    replacedert.replacedertTrue(repositorySpan.toString().contains("\"lc\""));
    replacedertBinaryAnnotation(repositorySpan, "lc", "crnk");
    replacedertBinaryAnnotation(repositorySpan, "crnk.query", "?");
    replacedertBinaryAnnotation(repositorySpan, "crnk.status", "EXCEPTION");
}

17 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testRootSpanAndContinue() {
    Span root = tracer.createSpan("root");
    replacedertCurrentSpanIs(root);
    tracer.detach(root);
    Span span = tracer.continueSpan(root);
    replacedertThat(span).isEqualTo(root);
    tracer.detach(span);
}

17 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

// Verifies span and replacedociated saved span.
private static void replacedertCurrentSpanIs(Span span) {
    replacedertThat(tracer.getCurrentSpan()).isEqualTo(span);
    replacedertThat(tracer.getCurrentSpan().getSavedSpan()).isEqualTo(span.getSavedSpan());
    replacedertThat(OpenCensusSleuthSpanContextHolder.getCurrentSpan()).isEqualTo(span);
    replacedertThat(OpenCensusSleuthSpanContextHolder.getCurrentSpan().getSavedSpan()).isEqualTo(span.getSavedSpan());
}

17 View Source File : OpenCensusSleuthSpanTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

private static final void replacedertSpanEquals(io.opencensus.trace.Span span, Span sleuthSpan) {
    replacedertThat(span.getContext().isValid()).isTrue();
    replacedertThat(Long.parseLong(span.getContext().getTraceId().toLowerBase16().substring(0, 16), 16)).isEqualTo(sleuthSpan.getTraceIdHigh());
    replacedertThat(Long.parseLong(span.getContext().getTraceId().toLowerBase16().substring(16, 32), 16)).isEqualTo(sleuthSpan.getTraceId());
    replacedertThat(Long.parseLong(span.getContext().getSpanId().toLowerBase16(), 16)).isEqualTo(sleuthSpan.getSpanId());
    replacedertThat(span.getContext().getTraceOptions().isSampled()).isEqualTo(sleuthSpan.isExportable());
}

17 View Source File : OpenCensusSleuthTracer.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Override
@javax.annotation.Nullable
public Span createSpan(String name, /*@Nullable*/
Sampler sampler) {
    String shortenedName = SpanNameUtil.shorten(name);
    Span span;
    if (isTracing()) {
        span = createChild(getCurrentSpan(), shortenedName);
    } else {
        long id = createId();
        span = Span.builder().name(shortenedName).traceIdHigh(this.traceId128 ? createTraceIdHigh() : 0L).traceId(id).spanId(id).build();
        if (sampler == null) {
            sampler = this.defaultSampler;
        }
        span = sampledSpan(span, sampler);
        this.spanLogger.logStartedSpan(null, span);
    }
    return continueSpan(span);
}

16 View Source File : AcmeFinancialBackOfficeApplication.java
License : MIT License
Project Creator : spring2go

@RequestMapping("/readtimeout")
public String connectionTimeout() throws InterruptedException {
    Span span = this.tracer.createSpan("second_span");
    Thread.sleep(500);
    try {
        log.info("Calling a missing service");
        restTemplate.getForObject("http://localhost:" + MOCK_PORT + "/readtimeout", String.clreplaced);
        return "Should blow up";
    } finally {
        this.tracer.close(span);
    }
}

16 View Source File : SleuthModuleTest.java
License : Apache License 2.0
Project Creator : crnk-project

@Test
public void testFindTargets() {
    RelationshipRepository<Project, Serializable, Task, Serializable> relRepo = client.getRepositoryForType(Project.clreplaced, Task.clreplaced);
    relRepo.findManyTargets(123L, "tasks", new QuerySpec(Task.clreplaced));
    // check client call and link span
    ArgumentCaptor<Span> clientSpanCaptor = ArgumentCaptor.forClreplaced(Span.clreplaced);
    List<Span> clientSpans = clientSpanCaptor.getAllValues();
    Span callSpan = clientSpans.get(0);
    replacedert.replacedertEquals("get", callSpan.getName());
    replacedert.replacedertTrue(callSpan.toString().contains("\"cs\""));
    replacedert.replacedertTrue(callSpan.toString().contains("\"cr\""));
    // check server local span
    replacedert.replacedertEquals(2, reportedSpans.spans.size());
    Span repositorySpan0 = reportedSpans.spans.get(0);
    replacedert.replacedertEquals("crnk:get:/tasks", repositorySpan0.getName());
    replacedert.replacedertTrue(repositorySpan0.toString().contains("\"lc\""));
    replacedertBinaryAnnotation(repositorySpan0, "lc", "crnk");
    replacedertBinaryAnnotation(repositorySpan0, "crnk.results", "0");
    replacedertBinaryAnnotation(repositorySpan0, "crnk.status", "OK");
    Span repositorySpan1 = reportedSpans.spans.get(1);
    replacedert.replacedertEquals("crnk:get:/projects/123/tasks", repositorySpan1.getName());
    replacedert.replacedertTrue(repositorySpan1.toString().contains("\"lc\""));
    replacedertBinaryAnnotation(repositorySpan1, "lc", "crnk");
    replacedertBinaryAnnotation(repositorySpan1, "crnk.query", "?");
    replacedertBinaryAnnotation(repositorySpan1, "crnk.results", "0");
    replacedertBinaryAnnotation(repositorySpan1, "crnk.status", "OK");
}

16 View Source File : SleuthModuleTest.java
License : Apache License 2.0
Project Creator : crnk-project

@Test
public void testFindAll() {
    Task task = new Task();
    task.setId(13L);
    task.setName("myTask");
    QuerySpec querySpec = new QuerySpec(Task.clreplaced);
    querySpec.addFilter(new FilterSpec(Arrays.asList("name"), FilterOperator.EQ, "doe"));
    taskRepo.findAll(querySpec);
    // check client call and link span
    ArgumentCaptor<Span> clientSpanCaptor = ArgumentCaptor.forClreplaced(Span.clreplaced);
    List<Span> clientSpans = clientSpanCaptor.getAllValues();
    Span callSpan = clientSpans.get(0);
    replacedert.replacedertEquals("get", callSpan.getName());
    replacedert.replacedertTrue(callSpan.toString().contains("\"cs\""));
    replacedert.replacedertTrue(callSpan.toString().contains("\"cr\""));
    // check server local span
    replacedert.replacedertEquals(1, reportedSpans.spans.size());
    Span repositorySpan = reportedSpans.spans.get(0);
    replacedert.replacedertEquals("crnk:get:/tasks", repositorySpan.getName());
    replacedert.replacedertTrue(repositorySpan.toString().contains("\"lc\""));
    replacedertBinaryAnnotation(repositorySpan, "lc", "crnk");
    replacedertBinaryAnnotation(repositorySpan, "crnk.query", "?filter[tasks][name][EQ]=doe");
    replacedertBinaryAnnotation(repositorySpan, "crnk.results", "0");
    replacedertBinaryAnnotation(repositorySpan, "crnk.status", "OK");
}

16 View Source File : SleuthModuleTest.java
License : Apache License 2.0
Project Creator : crnk-project

@Test
public void testCreate() {
    Task task = new Task();
    task.setId(13L);
    task.setName("myTask");
    taskRepo.create(task);
    // check client call and link span
    ArgumentCaptor<Span> clientSpanCaptor = ArgumentCaptor.forClreplaced(Span.clreplaced);
    List<Span> clientSpans = clientSpanCaptor.getAllValues();
    Span callSpan = clientSpans.get(0);
    replacedert.replacedertEquals("post", callSpan.getName());
    replacedert.replacedertTrue(callSpan.toString().contains("\"cs\""));
    replacedert.replacedertTrue(callSpan.toString().contains("\"cr\""));
    // check server local span
    replacedert.replacedertEquals(1, reportedSpans.spans.size());
    Span repositorySpan = reportedSpans.spans.get(0);
    replacedert.replacedertEquals("crnk:post:/tasks/13", repositorySpan.getName());
    replacedert.replacedertTrue(repositorySpan.toString().contains("\"lc\""));
    replacedertBinaryAnnotation(repositorySpan, "lc", "crnk");
    replacedertBinaryAnnotation(repositorySpan, "crnk.query", "?");
}

16 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testRootSpanAndDetach() {
    Span root = tracer.createSpan("root");
    replacedertCurrentSpanIs(root);
    replacedertThat(root.getSavedSpan()).isNull();
    Span parent = tracer.detach(root);
    replacedertThat(parent).isNull();
}

16 View Source File : OpenCensusSleuthTracerTest.java
License : Apache License 2.0
Project Creator : census-instrumentation

@Test
public void testRootSpanAndClose() {
    Span root = tracer.createSpan("root");
    replacedertCurrentSpanIs(root);
    replacedertThat(root.getSavedSpan()).isNull();
    Span parent = tracer.close(root);
    replacedertThat(parent).isNull();
}

See More Examples