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

Add opt-in sidekiq extension for annotating delayed classes #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bf4
Copy link

@bf4 bf4 commented Sep 24, 2020

Even if no one wants to use the extension as is, it makes a good example of how one may do it.

Usage: in config/initializers/sidekiq.rb

Marginalia::SidekiqInstrumentation.enable!(annotate_delayed_class_extension: true)

optionally customize the marginalia_annotate_perform method, for example

Sidekiq::Extensions::DelayedClass.class_eval do
  def marginalia_annotate_perform(target, method_name, args)
    Rollbar.scope!(target, method_name, *args)
    "#{target}.#{method_name}"
  end
end

I would have put this in the wiki entry but I couldn't edit that, and I thought this pr may be more productive than an issue or blog post.

Even if no one wants to use the extension as is, it makes a good example of how one may do it.

Usage: in config/initializers/sidekiq.rb

```ruby
Marginalia::SidekiqInstrumentation.enable!(annotate_delayed_class_extension: true)
```
optionally customize the `marginalia_annotate_perform` method, for example

```ruby
Sidekiq::Extensions::DelayedClass.class_eval do
  def marginalia_annotate_perform(target, method_name, args)
    Rollbar.scope!(target, method_name, *args)
    "#{target}.#{method_name}"
  end
end
```
@bf4
Copy link
Author

bf4 commented Aug 16, 2021

@sj26 any thoughts on this?

@sj26
Copy link
Collaborator

sj26 commented Aug 20, 2021

Sorry @bf4, I'm not sure what this is doing? Is it reaching more deeply into Sidekiq integration to craft better annotations?

I really only jumped in to get automated testing working, and update marginalia to modern rails versions, not to introduce new features. 😅

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

2 participants