sentry-raven 0.13.3 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3aa58fda20b0f653965e4ca3ab305b8b532fdac
4
- data.tar.gz: cc4b736a336188d7da90f4764f94ba775b1ee59c
3
+ metadata.gz: 69cb623c7ac9a07889b6ae03ec5444319e191f8f
4
+ data.tar.gz: 8369bebd8ccf68813e9b036efe138d8dfbde4bac
5
5
  SHA512:
6
- metadata.gz: 3120d8f00b27233caded20577c3ad043cb35938a5cb685b44e48d4619298f685748e872d614c443f34b24a0b54396c089cae531d6c45e435c1b799b4da4a658c
7
- data.tar.gz: c839f657b2d90ad7bd9fea2e991dab6a1469a99b69fa9546a8e3a7680d3d4cce411a06c5a4a1a3ed20af8c825dfb8e2c35b816d50f2c70a676340c44b63b3c0c
6
+ metadata.gz: e1ba87c6185709d7933339e40688a0aa4eba22e9377dd37e97e480ead398102d3b058d6cc64af1dc3baeb4f1a5bfb1f630926a49a6030844981f2497888c4516
7
+ data.tar.gz: 389740e37e3f9e47f7ba50794278e1f656e68cc85f18cefdfd8f07fd4d4ddc15f1b775767d17655c978cc1a348ed3c646e12dc2047fb86f1cddd6e78fe7592d7
data/LICENSE CHANGED
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2015 Functional Software, Inc
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -9,7 +9,10 @@ module Raven
9
9
  class Line
10
10
 
11
11
  # regexp (optionnally allowing leading X: for windows support)
12
- INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}.freeze
12
+ RUBY_INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}.freeze
13
+
14
+ # org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
15
+ JAVA_INPUT_FORMAT = %r{^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$}.freeze
13
16
 
14
17
  APP_DIRS_PATTERN = /(bin|app|config|lib|test)/
15
18
 
@@ -22,16 +25,27 @@ module Raven
22
25
  # The method of the line (such as index)
23
26
  attr_reader :method
24
27
 
28
+ # The module name (JRuby)
29
+ attr_reader :module_name
30
+
25
31
  # Parses a single line of a given backtrace
26
32
  # @param [String] unparsed_line The raw line from +caller+ or some backtrace
27
33
  # @return [Line] The parsed backtrace line
28
34
  def self.parse(unparsed_line)
29
- _, file, number, method = unparsed_line.match(INPUT_FORMAT).to_a
30
- new(file, number, method)
35
+ ruby_match = unparsed_line.match(RUBY_INPUT_FORMAT)
36
+ if ruby_match
37
+ _, file, number, method = ruby_match.to_a
38
+ module_name = nil
39
+ else
40
+ java_match = unparsed_line.match(JAVA_INPUT_FORMAT)
41
+ _, module_name, method, file, number = java_match.to_a
42
+ end
43
+ new(file, number, method, module_name)
31
44
  end
32
45
 
33
- def initialize(file, number, method)
46
+ def initialize(file, number, method, module_name)
34
47
  self.file = file
48
+ self.module_name = module_name
35
49
  self.number = number.to_i
36
50
  self.method = method
37
51
  end
@@ -66,7 +80,7 @@ module Raven
66
80
 
67
81
  private
68
82
 
69
- attr_writer :file, :number, :method
83
+ attr_writer :file, :number, :method, :module_name
70
84
  end
71
85
 
72
86
  # holder for an Array of Backtrace::Line instances
@@ -121,6 +121,8 @@ module Raven
121
121
  else
122
122
  send_event(evt)
123
123
  end
124
+
125
+ evt
124
126
  end
125
127
  end
126
128
  alias_method :capture_message, :capture_type
@@ -1,3 +1,4 @@
1
+ require 'certifi'
1
2
  require 'logger'
2
3
  require 'uri'
3
4
 
@@ -58,6 +59,9 @@ module Raven
58
59
  # Should the SSL certificate of the server be verified?
59
60
  attr_accessor :ssl_verification
60
61
 
62
+ # The path to the SSL certificate file
63
+ attr_accessor :ssl_ca_file
64
+
61
65
  # SSl settings passed direactly to faraday's ssl option
62
66
  attr_accessor :ssl
63
67
 
@@ -113,7 +117,8 @@ module Raven
113
117
  self.send_modules = true
114
118
  self.excluded_exceptions = IGNORE_DEFAULT
115
119
  self.processors = [Raven::Processor::RemoveCircularReferences, Raven::Processor::UTF8Conversion, Raven::Processor::SanitizeData]
116
- self.ssl_verification = false
120
+ self.ssl_verification = true
121
+ self.ssl_ca_file = Certifi.where
117
122
  self.encoding = 'gzip'
118
123
  self.timeout = 1
119
124
  self.open_timeout = 1
@@ -1,6 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'socket'
3
3
  require 'securerandom'
4
+ require 'digest/md5'
4
5
 
5
6
  require 'raven/error'
6
7
  require 'raven/linecache'
@@ -24,7 +25,8 @@ module Raven
24
25
 
25
26
  attr_reader :id
26
27
  attr_accessor :project, :message, :timestamp, :time_spent, :level, :logger,
27
- :culprit, :server_name, :release, :modules, :extra, :tags, :context, :configuration
28
+ :culprit, :server_name, :release, :modules, :extra, :tags, :context, :configuration,
29
+ :checksum
28
30
 
29
31
  def initialize(init = {})
30
32
  @configuration = Raven.configuration
@@ -43,6 +45,7 @@ module Raven
43
45
  @user = {}
44
46
  @extra = {}
45
47
  @tags = {}
48
+ @checksum = nil
46
49
 
47
50
  yield self if block_given?
48
51
 
@@ -108,6 +111,7 @@ module Raven
108
111
  data[:extra] = @extra if @extra
109
112
  data[:tags] = @tags if @tags
110
113
  data[:user] = @user if @user
114
+ data[:checksum] = @checksum if @checksum
111
115
  @interfaces.each_pair do |name, int_data|
112
116
  data[name.to_sym] = int_data.to_hash
113
117
  end
@@ -186,10 +190,11 @@ module Raven
186
190
  backtrace = Backtrace.parse(backtrace)
187
191
  int.frames = backtrace.lines.reverse.map do |line|
188
192
  StacktraceInterface::Frame.new.tap do |frame|
189
- frame.abs_path = line.file
190
- frame.function = line.method
193
+ frame.abs_path = line.file if line.file
194
+ frame.function = line.method if line.method
191
195
  frame.lineno = line.number
192
196
  frame.in_app = line.in_app
197
+ frame.module = line.module_name if line.module_name
193
198
 
194
199
  if evt.configuration[:context_lines] && frame.abs_path
195
200
  frame.pre_context, frame.context_line, frame.post_context = \
@@ -206,6 +211,7 @@ module Raven
206
211
  end
207
212
 
208
213
  def get_file_context(filename, lineno, context)
214
+ return nil, nil, nil unless Raven::LineCache.is_valid_file(filename)
209
215
  lines = (2 * context + 1).times.map do |i|
210
216
  Raven::LineCache.getline(filename, lineno - context + i)
211
217
  end
@@ -234,7 +240,7 @@ module Raven
234
240
  ary[2] = (ary[2] & 0x0fff) | 0x4000
235
241
  ary[3] = (ary[3] & 0x3fff) | 0x8000
236
242
  uuid = "%08x-%04x-%04x-%04x-%04x%08x" % ary
237
- Digest::MD5.hexdigest(uuid)
243
+ ::Digest::MD5.hexdigest(uuid)
238
244
  end
239
245
  end
240
246
  end
@@ -14,6 +14,13 @@ module Raven
14
14
  end
15
15
  end
16
16
 
17
+ initializer 'raven.active_job' do
18
+ ActiveSupport.on_load :active_job do
19
+ require 'raven/integrations/rails/active_job'
20
+ include Raven::Rails::ActiveJob
21
+ end
22
+ end
23
+
17
24
  config.after_initialize do
18
25
  Raven.configure do |config|
19
26
  config.logger ||= ::Rails.logger
@@ -34,5 +41,9 @@ module Raven
34
41
  rake_tasks do
35
42
  require 'raven/integrations/tasks'
36
43
  end
44
+
45
+ runner do
46
+ Raven.capture
47
+ end
37
48
  end
38
49
  end
@@ -0,0 +1,18 @@
1
+ module Raven
2
+ class Rails
3
+ module ActiveJob
4
+ def self.included(base)
5
+ base.class_eval do
6
+ rescue_from(Exception) do |exception|
7
+ # Do not capture exceptions when using Sidekiq so we don't capture
8
+ # The same exception twice.
9
+ unless self.class.queue_adapter.to_s == 'ActiveJob::QueueAdapters::SidekiqAdapter'
10
+ Raven.capture_exception(exception, :extra => { :active_job => self.class.name })
11
+ raise exception
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -25,6 +25,7 @@ module Raven
25
25
  attr_accessor :pre_context
26
26
  attr_accessor :post_context
27
27
  attr_accessor :context_line
28
+ attr_accessor :module
28
29
  attr_accessor :lineno
29
30
  attr_accessor :in_app
30
31
 
@@ -5,17 +5,24 @@ module Raven
5
5
  class << self
6
6
  CACHE = {}
7
7
 
8
+ def is_valid_file(path)
9
+ lines = getlines(path)
10
+ return lines != nil
11
+ end
12
+
8
13
  def getlines(path)
9
14
  CACHE[path] ||= begin
10
15
  IO.readlines(path)
11
16
  rescue
12
- []
17
+ nil
13
18
  end
14
19
  end
15
20
 
16
21
  def getline(path, n)
17
22
  return nil if n < 1
18
- getlines(path)[n - 1]
23
+ lines = getlines(path)
24
+ return nil if lines == nil
25
+ lines[n - 1]
19
26
  end
20
27
  end
21
28
  end
@@ -499,7 +499,7 @@ private
499
499
 
500
500
  def numenc(x)
501
501
  if ((x.nan? || x.infinite?) rescue false)
502
- raise Error, "Numeric cannot be represented: #{x}"
502
+ return strenc(x.to_s)
503
503
  end
504
504
  "#{x}"
505
505
  end
@@ -35,6 +35,7 @@ module Raven
35
35
 
36
36
  ssl_configuration = self.configuration.ssl || {}
37
37
  ssl_configuration[:verify] = self.configuration.ssl_verification
38
+ ssl_configuration[:ca_file] = self.configuration.ssl_ca_file
38
39
 
39
40
  conn = Faraday.new(
40
41
  :url => self.configuration[:server],
@@ -1,3 +1,3 @@
1
1
  module Raven
2
- VERSION = "0.13.3"
2
+ VERSION = "0.14.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-raven
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-12 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.7.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: certifi
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -119,6 +133,7 @@ files:
119
133
  - lib/raven/integrations/delayed_job.rb
120
134
  - lib/raven/integrations/rack.rb
121
135
  - lib/raven/integrations/rails.rb
136
+ - lib/raven/integrations/rails/active_job.rb
122
137
  - lib/raven/integrations/rails/controller_methods.rb
123
138
  - lib/raven/integrations/rails/middleware/debug_exceptions_catcher.rb
124
139
  - lib/raven/integrations/railties.rb
@@ -164,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
179
  version: '0'
165
180
  requirements: []
166
181
  rubyforge_project:
167
- rubygems_version: 2.4.5
182
+ rubygems_version: 2.4.8
168
183
  signing_key:
169
184
  specification_version: 4
170
185
  summary: A gem that provides a client interface for the Sentry error logger