Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary call on Span::End() #449

Merged
merged 5 commits into from
Dec 18, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}