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

Modify loggerprovider shutdown, flush to return single Result and handle repeat shutdown calls #1750

Merged

Conversation

cijothomas
Copy link
Member

This is consistent with Metrics shutdown.
The overall result contains formatted version of combined errors, if any.
Added test to validate that repeated shutdown calls are handled.

@cijothomas cijothomas requested a review from a team as a code owner May 13, 2024 17:01
Err(LogError::Other(format!("{errs:?}").into()))
}
} else {
Err(LogError::Other("logger provider already shut down".into()))
Copy link
Contributor

@TommyCpp TommyCpp May 13, 2024

Choose a reason for hiding this comment

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

We should make a dedicate LogError variant for repeat shutdown. I image in most use cases users don't care as long as the shutdown has invoked at least once

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree to fix it. Not in this PR, as the current structure of placing these errors in the API is not correct, and needs a refactoring. Will cover it as part of #1042

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd mark this as releasing blocking and add a todo in code too. It will be very anti-intutive if the users has to parse the error string to understand if the errors is caused by repeated shutdown

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd mark this as releasing blocking

yes for stable or even beta release. But not for #1738 which is still alpha for logs.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry if this is already answered. What is wrong with returning vec of LogResult for shutdown? Is it only for consistency with metrics?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes. And also, if any individual sub-component faced issue while shutdown, they should be emitting their own logging. Shutdown() just need to capture the overall state. But I am not very sure we are doing it correctly. The proper solution should be coming once we address #1146 (that also is very much related to #761 as it is hard to solve internal logging without fixing the infinite telemetry/circular dep problem)

Copy link
Member

Choose a reason for hiding this comment

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

Ok thanks, that makes sense.

Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 93.10345% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 71.6%. Comparing base (348ec9e) to head (f96e66a).
Report is 23 commits behind head on main.

Files Patch % Lines
opentelemetry-sdk/src/logs/log_emitter.rs 92.8% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1750     +/-   ##
=======================================
+ Coverage   71.0%   71.6%   +0.5%     
=======================================
  Files        135     136      +1     
  Lines      20751   20845     +94     
=======================================
+ Hits       14746   14934    +188     
+ Misses      6005    5911     -94     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TommyCpp TommyCpp merged commit e726892 into open-telemetry:main May 13, 2024
20 checks passed
@cijothomas cijothomas deleted the cijothomas/log-shutdown-result branch May 13, 2024 23:45
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.

None yet

3 participants