-
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
Sidekiq integration with custom error handler #958
Comments
@ryanhouston This might make some sense, I think there are a couple of similarities in other parts of the code:
I'm not opposed to adding this as a one-off feature for Sidekiq, but I'd like to consider if there's a more general solution/implementation in order to maintain consistency and expand the benefits to other instrumentation as well. This could take a few different forms:
I've been thinking a lot about adding these kinds of hooks into the trace lifecycle to allow for such customization for some time now... maybe this is a good time to do this? I guess some questions I have before a decision is made:
Let me know your thoughts! |
@delner The "configurable on_error handler for all job frameworks" solution makes sense to me based on my usage of this gem and the code I've seen so far. Especially considering the hook and option is already integrated into The Regarding your questions:
Thanks for your help! |
@ryanhouston That all makes sense to me. In this case, I think we can start with this I'd welcome a PR for And thanks for the suggestion and thoughtful response! |
We tried to use like this: IGNORE_ERRORS_LIST = %w[Sidekiq::Limiter::OverLimit RetryNotAnError]
Datadog::Pipeline.before_flush do |trace|
trace.each do |span|
if span.service == 'sidekiq' && span.status == 1 && IGNORE_ERRORS_LIST.include?(span.instance_variable_get('@meta')&.dig('error.type'))
span.status = 0
end
end
end but is more like a hack instead of a solution. Would be nice to see any feature to ignore some kind of errors by the DD |
This feature has been added by #1212 in version https://github.com/DataDog/dd-trace-rb/releases/tag/v0.43.0. Could you give it a try @Stashchenko, @ryanhouston and let us know if this works for your use case? |
we'll let you know asap. |
@marcotc, @ryanhouston It works very well! thanks a lot for help! |
🎉 awesome! I'll close this issue as resolved. |
I'm wondering if there's currently a way to provide a custom error handler for the Sidekiq server integration. It doesn't appear to be possible though I think I see how it could be done unobtrusively.
I'm happy to provide a PR if this seems reasonable and there isn't already a way to accomplish this.
Goal
Allow sidekiq to retry jobs gracefully for known transient errors without reporting errors to Datadog.
Description
By providing an error handler proc to the sidekiq configuration options, the application code could include an ignore list for certain error types.
An application configuration provide like the following
And updating this line:
dd-trace-rb/lib/ddtrace/contrib/sidekiq/server_tracer.rb
Line 22 in 39083f3
to provide the
on_error
option to the@tracer.trace
call:This could also use the
worker_config
to provide this custom error handler on a per worker basis.The text was updated successfully, but these errors were encountered: