delayed-plugins-raven 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/AUTHORS +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +5 -0
- data/README.md +22 -0
- data/Rakefile +12 -0
- data/delayed-plugins-raven.gemspec +24 -0
- data/lib/delayed-plugins-raven.rb +31 -0
- data/lib/delayed-plugins-raven/version.rb +7 -0
- data/resources/looking-for-maintainer.png +0 -0
- data/spec/lib/delayed-plugins-raven/plugin_spec.rb +3 -0
- metadata +125 -0
data/.gitignore
ADDED
data/AUTHORS
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
Based on Ben Oakes's AirBrake plugin (https://github.com/benjaminoakes/delayed-plugins-airbrake) with samples provided by Bruno Miranda (https://gist.github.com/brupm/3c7056b03d62ba415015).
|
2
|
+
|
3
|
+
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
4
|
+
|
5
|
+
For more information, please see http://creativecommons.org/licenses/by-sa/3.0/
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Delayed::Plugins::Raven
|
2
|
+
|
3
|
+
![Looking for maintainer](https://raw.github.com/qiushihe/delayed-plugins-raven/master/resources/looking-for-maintainer.png)
|
4
|
+
|
5
|
+
DelayedJob exception notification with Sentry Raven
|
6
|
+
|
7
|
+
Based on Ben Oakes's AirBrake plugin (https://github.com/benjaminoakes/delayed-plugins-airbrake) with samples provided by Bruno Miranda (https://gist.github.com/brupm/3c7056b03d62ba415015).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'delayed-plugins-raven'
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Register the plugin like so:
|
18
|
+
|
19
|
+
require 'delayed-plugins-raven'
|
20
|
+
Delayed::Worker.plugins << Delayed::Plugins::Raven::Plugin
|
21
|
+
|
22
|
+
In a Rails project, this can be done in `config/initializers`.
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'delayed-plugins-raven/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "delayed-plugins-raven"
|
7
|
+
gem.version = Delayed::Plugins::Raven::VERSION
|
8
|
+
gem.authors = ['Qiushi He', 'Benjamin Oakes', 'Bruno Miranda']
|
9
|
+
gem.email = ['qiushihe@me.com']
|
10
|
+
gem.description = %q(delayed_job exception notification with raven)
|
11
|
+
gem.summary = %q(Notify Sentry Raven on Delayed Job errors, including those on PerformableMethod. Based on Ben Oakes's AirBrake plugin (https://github.com/benjaminoakes/delayed-plugins-airbrake) with samples provided by Bruno Miranda (https://gist.github.com/brupm/3c7056b03d62ba415015).)
|
12
|
+
gem.homepage = "https://github.com/qiushihe/delayed-plugins-raven"
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($/)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
gem.add_dependency('sentry-raven')
|
20
|
+
gem.add_dependency('delayed_job')
|
21
|
+
|
22
|
+
gem.add_development_dependency('rake')
|
23
|
+
gem.add_development_dependency('rspec')
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'raven'
|
2
|
+
require 'delayed/performable_method'
|
3
|
+
require 'delayed/plugin'
|
4
|
+
|
5
|
+
require 'delayed-plugins-raven/version'
|
6
|
+
|
7
|
+
module Delayed::Plugins::Raven
|
8
|
+
class Plugin < ::Delayed::Plugin
|
9
|
+
module Notify
|
10
|
+
def error(job, error)
|
11
|
+
begin
|
12
|
+
::Raven.capture_exception(error, { extra: {
|
13
|
+
delayed_job: job.as_json
|
14
|
+
} })
|
15
|
+
rescue Exception => e
|
16
|
+
Rails.logger.error "Raven logging failed: #{e.class.name}: #{e.message}"
|
17
|
+
Rails.logger.flush
|
18
|
+
end
|
19
|
+
super if defined?(super)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
callbacks do |lifecycle|
|
24
|
+
lifecycle.before(:invoke_job) do |job|
|
25
|
+
payload = job.payload_object
|
26
|
+
payload = payload.object if payload.is_a? Delayed::PerformableMethod
|
27
|
+
payload.extend Notify
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: delayed-plugins-raven
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Qiushi He
|
9
|
+
- Benjamin Oakes
|
10
|
+
- Bruno Miranda
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: sentry-raven
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: delayed_job
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rake
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: rspec
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
type: :development
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
description: delayed_job exception notification with raven
|
81
|
+
email:
|
82
|
+
- qiushihe@me.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- AUTHORS
|
89
|
+
- Gemfile
|
90
|
+
- LICENSE.txt
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- delayed-plugins-raven.gemspec
|
94
|
+
- lib/delayed-plugins-raven.rb
|
95
|
+
- lib/delayed-plugins-raven/version.rb
|
96
|
+
- resources/looking-for-maintainer.png
|
97
|
+
- spec/lib/delayed-plugins-raven/plugin_spec.rb
|
98
|
+
homepage: https://github.com/qiushihe/delayed-plugins-raven
|
99
|
+
licenses: []
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 1.8.23
|
119
|
+
signing_key:
|
120
|
+
specification_version: 3
|
121
|
+
summary: Notify Sentry Raven on Delayed Job errors, including those on PerformableMethod.
|
122
|
+
Based on Ben Oakes's AirBrake plugin (https://github.com/benjaminoakes/delayed-plugins-airbrake)
|
123
|
+
with samples provided by Bruno Miranda (https://gist.github.com/brupm/3c7056b03d62ba415015).
|
124
|
+
test_files:
|
125
|
+
- spec/lib/delayed-plugins-raven/plugin_spec.rb
|