-
Notifications
You must be signed in to change notification settings - Fork 369
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
Ensure public apis don't fail after shutdown #1408
Conversation
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.
I must admit the current behavior is a bit... weird, but as far as this test goes, it LGTM 👍
spec/ddtrace_integration_spec.rb
Outdated
end | ||
|
||
it 'does not error on logging' do | ||
expect(Datadog.logger.info('test')).to be_truthy |
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.
Minor: This can be be true
, see https://github.com/ruby/ruby/blob/v3_0_0/lib/logger.rb#L477.
Looking at the CI failures, at least the JRuby failure seems to be legit. |
Codecov Report
@@ Coverage Diff @@
## master #1408 +/- ##
==========================================
- Coverage 98.16% 98.16% -0.01%
==========================================
Files 768 769 +1
Lines 36667 36714 +47
==========================================
+ Hits 35993 36039 +46
- Misses 674 675 +1
Continue to review full report at Codecov.
|
Our public API can be use permissively across the host application. During the event of a Ruby process shutdown,
ddtrace
will invokeDatadog.shutdown!
(though anat_exit
hook) to gracefully flush any pending traces and decommission resources.When this shutdown happens, internal parts of the tracer won't work anymore (new traces won't be captured), which is acceptable, but we must still ensure that calls out public API methods do not raise errors and still behave predictably during a shutdown. We don't want the tracer to interfere with any of the host application's own shutdown routines by introducing uncertain behavior in our tracer public methods.
This PR ensures that our publicly exposed API does not change their interface, nor raise errors after the tracer has been shutdown.