Skip to content

Commit

Permalink
Remove unnecessary call on Span::End() (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored Dec 18, 2020
1 parent 4aa124f commit c8054c5
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions examples/otlp/foo_library/foo_library.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,23 @@ nostd::shared_ptr<trace::Tracer> get_tracer()
return provider->GetTracer("foo_library");
}

// TODO: Remove all calls to span->End() once context memory issue is fixed
// (https://github.com/open-telemetry/opentelemetry-cpp/issues/287)

void f1()
{
auto span = get_tracer()->StartSpan("f1");
span->End();
auto scoped_span = trace::Scope(get_tracer()->StartSpan("f1"));
}

void f2()
{
auto span = get_tracer()->StartSpan("f2");
auto scoped_span = trace::Scope(get_tracer()->StartSpan("f2"));

f1();
f1();
span->End();
}
} // namespace

void foo_library()
{
auto span = get_tracer()->StartSpan("library");
auto scoped_span = trace::Scope(get_tracer()->StartSpan("library"));

f2();
span->End();
}

0 comments on commit c8054c5

Please sign in to comment.