-
Notifications
You must be signed in to change notification settings - Fork 375
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
Add ActiveSupport::Notifications subscription error handling #395
Add ActiveSupport::Notifications subscription error handling #395
Conversation
…nd refactors for subscription.
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.
The approach is good, I think only a small change in the log output and we're good.
def run(span, name, id, payload) | ||
run!(span, name, id, payload) | ||
rescue StandardError => e | ||
Datadog::Tracer.log.error("ActiveSupport::Notifications handler for '#{name}' failed: #{e.message}") |
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.
In a high throughput environment we may spam logs too much. Can you write using the debug
mode so without any config change we're sure to not write our failures?
begin | ||
callback.call(event, key, *args) | ||
rescue StandardError => e | ||
Datadog::Tracer.log.error( |
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 think the same applies here
@@ -98,7 +98,7 @@ def initialize(options = {}) | |||
@provider = options.fetch(:context_provider, Datadog::DefaultContextProvider.new) | |||
@provider ||= Datadog::DefaultContextProvider.new # @provider should never be nil | |||
|
|||
@context_flush = Datadog::ContextFlush.new(options) if options[:partial_flush] | |||
@context_flush = options[:partial_flush] ? Datadog::ContextFlush.new(options) : nil |
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.
👍
This pull request fixes two bugs:
ensure_clean_context!
wasn't working; fixes use oftracer
.Also adds support for
call
for 3.x ActiveSupport implementations and refactors the internals of Subscription a little (should improve extensibility.)