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

Change Shutdown() and ForceFlush() to return bool for traces #419

Merged
merged 8 commits into from
Dec 11, 2020

Conversation

ThomsonTan
Copy link
Contributor

This resolves #400. The default timeout is also set to std::chrono::microseconds::max() as the spec requires Shutdown() Shutdown should not block indefinitely.

@ThomsonTan ThomsonTan requested a review from a team December 3, 2020 23:07
@codecov
Copy link

codecov bot commented Dec 3, 2020

Codecov Report

Merging #419 (4fbaccb) into master (6355819) will decrease coverage by 0.02%.
The diff coverage is 88.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #419      +/-   ##
==========================================
- Coverage   94.53%   94.50%   -0.03%     
==========================================
  Files         179      178       -1     
  Lines        7702     7701       -1     
==========================================
- Hits         7281     7278       -3     
- Misses        421      423       +2     
Impacted Files Coverage Δ
...de/opentelemetry/exporters/ostream/span_exporter.h 96.29% <ø> (ø)
sdk/include/opentelemetry/sdk/trace/exporter.h 100.00% <ø> (ø)
sdk/include/opentelemetry/sdk/trace/processor.h 100.00% <ø> (ø)
.../include/opentelemetry/sdk/trace/tracer_provider.h 100.00% <ø> (ø)
...include/opentelemetry/sdk/trace/simple_processor.h 88.23% <60.00%> (+0.73%) ⬆️
sdk/src/trace/batch_span_processor.cc 92.59% <66.66%> (-1.16%) ⬇️
...lemetry/exporters/memory/in_memory_span_exporter.h 100.00% <100.00%> (ø)
exporters/ostream/src/span_exporter.cc 89.13% <100.00%> (ø)
exporters/ostream/test/ostream_span_test.cc 100.00% <100.00%> (ø)
...nclude/opentelemetry/ext/zpages/tracez_processor.h 100.00% <100.00%> (ø)
... and 6 more

@@ -111,9 +111,10 @@ public:
return sdktrace::ExportResult::kSuccess;
}

void Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept
bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds(-1)) noexcept
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should it be std::chrono::microseconds::max() ?

*/
void Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept override{};
bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept override{
Copy link
Member

@lalitb lalitb Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know timeout is not used here, but we are setting it's default as max at some places and 0 at other (including here). Is it intended ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 We shouldn't specify defaults in overridden methods. AFAIK it should pull the default from the base type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems overrider doesn't acquire the defaults from base class.

8.3.6.10:
A virtual function call (10.3) uses the default arguments in the declaration of the virtual function determined by the static type of the pointer or reference denoting the object. An overriding function in a derived class does not acquire default arguments from the function it overrides. Example:

ext/include/opentelemetry/ext/zpages/tracez_processor.h Outdated Show resolved Hide resolved
Copy link
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to returning bool, looks like one syntax error is breaking tests.

*/
void Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept override{};
bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept override{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 We shouldn't specify defaults in overridden methods. AFAIK it should pull the default from the base type.

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alolita
Copy link
Member

alolita commented Dec 7, 2020

Triaged Dec 7 2020: Need another reviewer to complete review. @jsuereth can you please take a look?

@pyohannes
Copy link
Contributor

Approved, but before merging we should have a look why the Bazel asan test fails (maybe it's just a temporary issue).

@lalitb
Copy link
Member

lalitb commented Dec 9, 2020

Approved, but before merging we should have a look why the Bazel asan test fails (maybe it's just a temporary issue).

@ThomsonTan Do you think if error in bazel asan test is related to this PR. Seems its failing consistently:
/usr/include/c++/7/chrono:176:38: runtime error: signed integer overflow: 9223372036854775807 * 1000 cannot be represented in type 'long int'

@ThomsonTan
Copy link
Contributor Author

ThomsonTan commented Dec 9, 2020

Approved, but before merging we should have a look why the Bazel asan test fails (maybe it's just a temporary issue).

@ThomsonTan Do you think if error in bazel asan test is related to this PR. Seems its failing consistently:
/usr/include/c++/7/chrono:176:38: runtime error: signed integer overflow: 9223372036854775807 * 1000 cannot be represented in type 'long int'

Looking at ASAN the failure.

@ThomsonTan
Copy link
Contributor Author

The ASAN failure was caused by assigned std::chrono::milliseconds to std::chrono::microseconds. Fixed in the latest commit.

@lalitb lalitb requested a review from jsuereth December 10, 2020 11:37
@lalitb
Copy link
Member

lalitb commented Dec 10, 2020

The ASAN failure was caused by assigned std::chrono::milliseconds to std::chrono::microseconds. Fixed in the latest commit.

Thanks @ThomsonTan . @jsuereth its blocked for your review now : )

@lalitb lalitb dismissed jsuereth’s stale review December 11, 2020 18:23

Pending for more than 4 days.

@lalitb lalitb merged commit 68e510c into open-telemetry:master Dec 11, 2020
kxyr pushed a commit to open-o11y/opentelemetry-cpp that referenced this pull request Dec 12, 2020
kxyr pushed a commit to open-o11y/opentelemetry-cpp that referenced this pull request Dec 12, 2020
@ThomsonTan ThomsonTan deleted the ShutdownRetBool branch September 22, 2021 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Span processor's ShutDown() and ForceFlush() do not match spec
5 participants