delayed-plugins-raven 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5ff6875693b3f2aefee4d42bc34b49adf647d1b
4
- data.tar.gz: cb0e3262a4127c056f0b2aa1c5e5d3f1a9f03790
3
+ metadata.gz: 7cda5f840d2a0129ad193541ceaa61077d608223
4
+ data.tar.gz: 44df544fa078d48d1782fd0ba2c9cb9030f98cd7
5
5
  SHA512:
6
- metadata.gz: ae0f013b619cfdc666511f1d0d382731cdd323675714dc074e4c0ec7507aec6745d49eecf16a9d3e91b11c6fb0867f3fe1516b0e14147ae554aab331d2cb6e23
7
- data.tar.gz: cd411c8d251474e0848b13ef03ca30347125e0e500a5482035d3ce6dd8c9855473a3a0595dd4935a9c8a077baea0a31567dc111bfbf759f17caf91aa387b6f24
6
+ metadata.gz: 711478e7cc792753ad50c4749de0a7e80fdf4203971c352cdb05570f494b46a45d97086eec1a158343b5aeaf5f9c75d98ea9bcc5b2b063b848a18624289eaf29
7
+ data.tar.gz: df16b8b2ec13322a84d1178850ab4d7e198979c7800fcf3f9f61a7b88c0104fabfe6b3973ded4a8d27cf9ef82a52b06cb70b521fd9da0a13b8163adad178f957
@@ -1,7 +1,7 @@
1
1
  module Delayed
2
2
  module Plugins
3
3
  module Raven
4
- VERSION = '1.0.2'
4
+ VERSION = '1.0.3'
5
5
  end
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ module Delayed::Plugins::Raven
11
11
  begin
12
12
  ::Raven.capture_exception(error, {
13
13
  configuration: ::Delayed::Plugins::Raven.configuration,
14
- extra: { delayed_job: job.as_json }
14
+ extra: { delayed_job: get_job_json(job) }
15
15
  })
16
16
  rescue Exception => e
17
17
  Rails.logger.error "Raven logging failed: #{e.class.name}: #{e.message}"
@@ -19,6 +19,20 @@ module Delayed::Plugins::Raven
19
19
  end
20
20
  super if defined?(super)
21
21
  end
22
+
23
+ private
24
+
25
+ def get_job_json(job)
26
+ json = job.as_json["job"]
27
+ json["handler"] = trim_lines(json["handler"], ::Delayed::Plugins::Raven.max_handler_lines)
28
+ json["last_error"] = trim_lines(json["last_error"], ::Delayed::Plugins::Raven.max_error_lines)
29
+ json
30
+ end
31
+
32
+ def trim_lines(string, limit)
33
+ return string unless limit
34
+ string.lines.to_a.map(&:strip).slice(0, limit).join("\n") if string.present?
35
+ end
22
36
  end
23
37
 
24
38
  callbacks do |lifecycle|
@@ -32,6 +46,7 @@ module Delayed::Plugins::Raven
32
46
 
33
47
  class << self
34
48
  attr_accessor :configuration
49
+ attr_accessor :max_handler_lines, :max_error_lines
35
50
 
36
51
  def configure
37
52
  @configuration = ::Raven::Configuration.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed-plugins-raven
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Qiushi He
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-13 00:00:00.000000000 Z
13
+ date: 2014-02-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sentry-raven