resque-sentry 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -15,6 +15,9 @@ Add the following to an initializer:
15
15
  ```ruby
16
16
  require 'resque-sentry'
17
17
 
18
+ # [optional] custom logger value to use when sending to Sentry (default is 'root')
19
+ Resque::Failure::Sentry.logger = "resque"
20
+
18
21
  Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Sentry]
19
22
  Resque::Failure.backend = Resque::Failure::Multiple
20
23
  ```
@@ -16,8 +16,19 @@ module Resque
16
16
  # Resque::Failure.backend = Resque::Failure::Multiple
17
17
  #
18
18
  class Sentry < Base
19
+
20
+ def self.logger
21
+ @logger
22
+ end
23
+
24
+ def self.logger=(value)
25
+ @logger = value
26
+ end
27
+
19
28
  def save
20
- Raven.capture_exception(exception)
29
+ options = {}
30
+ options[:logger] = self.class.logger if self.class.logger
31
+ Raven.capture_exception(exception, options)
21
32
  end
22
33
 
23
34
  def self.count
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'resque-sentry'
3
- gem.version = '1.0.0'
3
+ gem.version = '1.1.0'
4
4
  gem.authors = ['Harry Marr']
5
5
  gem.email = ['harry@gocardless.com']
6
6
  gem.summary = 'A failure backend for Resque that sends events to Sentry'
7
7
  gem.homepage = 'https://github.com/gocardless/resque-sentry'
8
8
 
9
9
  gem.add_dependency 'resque', '>= 1.18.0'
10
- gem.add_dependency 'sentry-raven', '~> 0.4.6'
10
+ gem.add_dependency 'sentry-raven', '>= 0.4.6'
11
11
  gem.add_development_dependency 'rspec', '~> 2.6'
12
12
  gem.add_development_dependency 'mocha', '~> 0.11.0'
13
13
 
@@ -2,16 +2,30 @@ require 'spec_helper'
2
2
 
3
3
  describe Resque::Failure::Sentry do
4
4
  it "sends errors to Sentry" do
5
+ sentry_options = {}
5
6
  exception = StandardError.new("Test Error")
6
7
  worker = Resque::Worker.new(:test)
7
8
  queue = "test"
8
9
  payload = {'class' => Object, 'args' => 1}
9
10
 
10
11
  event = mock
11
- Raven.expects(:capture_exception).with(exception)
12
+ Raven.expects(:capture_exception).with(exception, sentry_options)
12
13
 
13
14
  backend = Resque::Failure::Sentry.new(exception, worker, queue, payload)
14
15
  backend.save
15
16
  end
17
+
18
+ it "will use the configured Sentry logger" do
19
+ Resque::Failure::Sentry.logger = "resque"
20
+ sentry_options = { :logger => "resque" }
21
+ exception = StandardError.new("Test Error")
22
+ worker = Resque::Worker.new(:test)
23
+ queue = "test"
24
+ payload = {'class' => Object, 'args' => 1}
25
+
26
+ Raven.expects(:capture_exception).with(exception, sentry_options)
27
+ backend = Resque::Failure::Sentry.new(exception, worker, queue, payload)
28
+ backend.save
29
+ end
16
30
  end
17
31
 
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: resque-sentry
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.0
5
+ version: 1.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Harry Marr
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-03 00:00:00.000000000 Z
12
+ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  - !ruby/object:Gem::Dependency
31
31
  version_requirements: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - ! '>='
34
34
  - !ruby/object:Gem::Version
35
35
  version: 0.4.6
36
36
  none: false
@@ -39,7 +39,7 @@ dependencies:
39
39
  prerelease: false
40
40
  requirement: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - ~>
42
+ - - ! '>='
43
43
  - !ruby/object:Gem::Version
44
44
  version: 0.4.6
45
45
  none: false