Skip to content

Commit

Permalink
Remove unnecessary call on Span::End() (open-telemetry#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored and Karen Xu committed Dec 22, 2020
1 parent 462e529 commit bc545e7
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 bc545e7

Please sign in to comment.