-
Notifications
You must be signed in to change notification settings - Fork 469
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
Avoid redundant shutdown in TracerProvider::drop when already shut down #2197
Merged
cijothomas
merged 23 commits into
open-telemetry:main
from
lalitb:tracer-provider-drop-shutdown-check
Oct 23, 2024
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
32938be
initial commit
lalitb 01c970b
Merge branch 'main' into tracer-provider-drop-shutdown-check
cijothomas c08c055
user reusable shutdown
lalitb 82d2598
Merge branch 'main' into tracer-provider-drop-shutdown-check
lalitb f270dcd
restructure TracerProviderInner::Drop, TracerProvider::Shutdown, and …
lalitb c8f2166
Merge branch 'tracer-provider-drop-shutdown-check' of github.com:lali…
lalitb 1a3dd67
Update opentelemetry-sdk/src/trace/provider.rs
lalitb 36012dc
Update opentelemetry-sdk/src/trace/provider.rs
lalitb 0d7d1ab
fix unit test
lalitb 01234c5
Merge branch 'main' into tracer-provider-drop-shutdown-check
lalitb 2279f3a
update doc
lalitb 293120b
Merge branch 'tracer-provider-drop-shutdown-check' of github.com:lali…
lalitb 21fa84e
update to atomics
lalitb 6ea4a63
Update opentelemetry-sdk/src/trace/provider.rs
lalitb 3dbb66e
Merge branch 'main' into tracer-provider-drop-shutdown-check
lalitb 05b8f59
review comment
lalitb 74bf489
review comments
lalitb 556c529
rename AlreadyShutdown to TracerProviderAlreadyShutdown
lalitb 80c97f7
fix
lalitb d3a557f
review comments
lalitb 14a42cc
add test for noop shutdown
lalitb 2e5899b
Merge branch 'main' into tracer-provider-drop-shutdown-check
lalitb 1272312
Merge branch 'main' into tracer-provider-drop-shutdown-check
cijothomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not added in this PR but why have we initialized the no-op tracer provider as an already shut down provider?
I know this wouldn't make much difference in functionality but semantically it would be weird if I call shutdown on the global provider and get an error saying it has already been shut down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
global shutdown_tracer_provider naming is bit confusing. It doesn't invoke shutdown, only decrements the TracerProviderInner reference. Once all the tracers are dropped, the shutdown will get invoked through
Drop
. Probablyrelease_tracer_provider
is better name :)And the user will never get hold of NOOP_TRACER_PROVIDER instance, or can invoke shutdown on it directly or indirectly. It's just internally used to create the tracer instance after shutdown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so then we could initialize no-op tracer provider with
is_shutdown
asfalse
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making it
false
fails this test -opentelemetry-rust/opentelemetry-sdk/src/trace/provider.rs
Line 531 in ea4b5e4
And this test make me realise user can access it through tracer.provider(), and can try to invoke shutdown on it. But feel free to raise an issue if there are any improvements here.