Skip to content

Commit 8960d86

Browse files
committed
Merge pull request resque#736 from lyahdav/pass_resque_job_name_to_airbrake
Pass Resque job name to Airbrake
2 parents fb2e5c1 + ab7555a commit 8960d86

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/resque/failure/thoughtbot.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,17 @@ def save
2525
:parameters => {
2626
:payload_class => payload['class'].to_s,
2727
:payload_args => payload['args'].inspect
28-
}
28+
},
29+
:component => 'resque',
30+
:action => action
2931
)
3032
end
33+
34+
def action
35+
action = payload['class'].to_s
36+
action = action.underscore if action.respond_to?(:underscore)
37+
action
38+
end
3139
end
3240
end
3341
end

test/thoughtbot_failure_test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class ThoughtbotFailure < Resque::Failure::Base
1616

1717
mock = Minitest::Mock.new
1818
mock.expect :notify_or_ignore, nil, [ exception,
19-
{ :parameters => { :payload_class => 'Object', :payload_args => '66' }} ]
19+
{ :parameters => { :payload_class => 'Object', :payload_args => '66' },
20+
:component => 'resque',
21+
:action => 'Object' } ]
2022
ThoughtbotFailure.klass = mock
2123

2224
backend = ThoughtbotFailure.new(exception, worker, queue, payload)

0 commit comments

Comments
 (0)