Search in sources :

Example 16 with ScopedSpan

use of brave.ScopedSpan in project brave by openzipkin.

the class DefaultTagsTest method defaultTagsOnlyAddedOnce.

@Test
public void defaultTagsOnlyAddedOnce() {
    ScopedSpan parent = tracing.tracer().startScopedSpan("parent");
    try {
        tracing.tracer().startScopedSpan("child").finish();
    } finally {
        parent.finish();
    }
    assertThat(spans.get(0).name()).isEqualTo("child");
    assertThat(spans.get(0).tags()).isEmpty();
    assertThat(spans.get(1).name()).isEqualTo("parent");
    assertThat(spans.get(1).tags()).containsExactly(entry("env", "prod"), entry("region", "east"));
}
Also used : ScopedSpan(brave.ScopedSpan) Test(org.junit.Test)

Aggregations

ScopedSpan (brave.ScopedSpan)16 Test (org.junit.Test)14 MutableSpan (brave.handler.MutableSpan)3 Tracing (brave.Tracing)2 TraceContext (brave.propagation.TraceContext)2 BookRestClient (org.apache.cxf.systest.microprofile.rest.client.tracing.BookRestClient)2 CurrentSpanCustomizer (brave.CurrentSpanCustomizer)1 Span (brave.Span)1 CLIENT (brave.Span.Kind.CLIENT)1 SpanCustomizer (brave.SpanCustomizer)1 SpanHandler (brave.handler.SpanHandler)1 FromRequestAdapter (brave.http.HttpClientAdapters.FromRequestAdapter)1 IntegrationTestSpanHandler (brave.test.IntegrationTestSpanHandler)1 HelloReply (io.grpc.examples.helloworld.HelloReply)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)1 After (org.junit.After)1 Before (org.junit.Before)1 Rule (org.junit.Rule)1 RunWith (org.junit.runner.RunWith)1