sentry-raven 0.15.3 → 0.15.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/raven/backtrace.rb +4 -12
- data/lib/raven/base.rb +1 -1
- data/lib/raven/client.rb +4 -3
- data/lib/raven/configuration.rb +28 -14
- data/lib/raven/event.rb +4 -3
- data/lib/raven/integrations/delayed_job.rb +2 -3
- data/lib/raven/integrations/rack.rb +2 -2
- data/lib/raven/integrations/rails.rb +1 -0
- data/lib/raven/integrations/rails/active_job.rb +1 -1
- data/lib/raven/interfaces.rb +2 -1
- data/lib/raven/linecache.rb +4 -1
- data/lib/raven/logger.rb +2 -1
- data/lib/raven/processor/sanitizedata.rb +4 -3
- data/lib/raven/version.rb +2 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c32e6b50c0d7de4f7e17c570e5e8a9bf79903d1
|
4
|
+
data.tar.gz: 9be97f5863a940ff07b862be7398f33a488bf8cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38530147d817ec7c5f49859c3e498892a2fe1e85e3c034f38cf931996739b80a38af16598151507890a17072fdc0beea706146c3caaf6fca80bc6469fff76f74
|
7
|
+
data.tar.gz: 6be4d40e98ff009d447ce7667afe959a269b08a002a30945f955f7efc51213af58272195b61b3903d8c12f9792e0e0da2ff68429fa59bd842110bdd3b8d618ae
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ A client and integration layer for the [Sentry](https://github.com/getsentry/sen
|
|
7
7
|
|
8
8
|
## Requirements
|
9
9
|
|
10
|
-
We test on Ruby MRI 1.8.7/REE
|
10
|
+
We test on Ruby MRI 1.8.7/REE through Ruby 2.3 at the latest patchlevel/teeny version. JRuby support is experimental - check TravisCI to see if the build is passing or failing.
|
11
11
|
|
12
12
|
## Getting Started
|
13
13
|
### Install
|
data/lib/raven/backtrace.rb
CHANGED
@@ -7,10 +7,10 @@ module Raven
|
|
7
7
|
# Handles backtrace parsing line by line
|
8
8
|
class Line
|
9
9
|
# regexp (optionnally allowing leading X: for windows support)
|
10
|
-
RUBY_INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}
|
10
|
+
RUBY_INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}
|
11
11
|
|
12
12
|
# org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
|
13
|
-
JAVA_INPUT_FORMAT = %r{^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$}
|
13
|
+
JAVA_INPUT_FORMAT = %r{^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$}
|
14
14
|
|
15
15
|
APP_DIRS_PATTERN = /(bin|exe|app|config|lib|test)/
|
16
16
|
|
@@ -84,8 +84,8 @@ module Raven
|
|
84
84
|
# holder for an Array of Backtrace::Line instances
|
85
85
|
attr_reader :lines
|
86
86
|
|
87
|
-
def self.parse(
|
88
|
-
ruby_lines =
|
87
|
+
def self.parse(backtrace, opts = {})
|
88
|
+
ruby_lines = backtrace.is_a?(Array) ? backtrace : backtrace.split(/\n\s*/)
|
89
89
|
|
90
90
|
filters = opts[:filters] || []
|
91
91
|
filtered_lines = ruby_lines.to_a.map do |line|
|
@@ -128,13 +128,5 @@ module Raven
|
|
128
128
|
private
|
129
129
|
|
130
130
|
attr_writer :lines
|
131
|
-
|
132
|
-
def self.split_multiline_backtrace(backtrace)
|
133
|
-
if backtrace.to_a.size == 1
|
134
|
-
backtrace.to_a.first.split(/\n\s*/)
|
135
|
-
else
|
136
|
-
backtrace
|
137
|
-
end
|
138
|
-
end
|
139
131
|
end
|
140
132
|
end
|
data/lib/raven/base.rb
CHANGED
@@ -21,7 +21,7 @@ if (major == 1 && minor < 9) || (major == 1 && minor == 9 && patch < 2)
|
|
21
21
|
end
|
22
22
|
|
23
23
|
module Raven
|
24
|
-
AVAILABLE_INTEGRATIONS = %w[delayed_job railties sidekiq rack rake]
|
24
|
+
AVAILABLE_INTEGRATIONS = %w[delayed_job railties sidekiq rack rake].freeze
|
25
25
|
|
26
26
|
class << self
|
27
27
|
# The client object is responsible for delivering formatted data to the Sentry server.
|
data/lib/raven/client.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'zlib'
|
2
3
|
require 'base64'
|
3
4
|
|
@@ -9,9 +10,9 @@ require 'raven/transports/udp'
|
|
9
10
|
module Raven
|
10
11
|
# Encodes events and sends them to the Sentry server.
|
11
12
|
class Client
|
12
|
-
PROTOCOL_VERSION = '5'
|
13
|
-
USER_AGENT = "raven-ruby/#{Raven::VERSION}"
|
14
|
-
CONTENT_TYPE = 'application/json'
|
13
|
+
PROTOCOL_VERSION = '5'.freeze
|
14
|
+
USER_AGENT = "raven-ruby/#{Raven::VERSION}".freeze
|
15
|
+
CONTENT_TYPE = 'application/json'.freeze
|
15
16
|
|
16
17
|
attr_accessor :configuration
|
17
18
|
|
data/lib/raven/configuration.rb
CHANGED
@@ -84,7 +84,9 @@ module Raven
|
|
84
84
|
# Optional Proc to be used to send events asynchronously.
|
85
85
|
attr_reader :async
|
86
86
|
|
87
|
-
#
|
87
|
+
# Directories to be recognized as part of your app. e.g. if you
|
88
|
+
# have an `engines` dir at the root of your project, you may want
|
89
|
+
# to set this to something like /(app|config|engines|lib)/
|
88
90
|
attr_accessor :app_dirs_pattern
|
89
91
|
|
90
92
|
# Catch exceptions before they're been processed by
|
@@ -109,14 +111,14 @@ module Raven
|
|
109
111
|
'CGI::Session::CookieStore::TamperedWithCookie',
|
110
112
|
'Mongoid::Errors::DocumentNotFound',
|
111
113
|
'Sinatra::NotFound',
|
112
|
-
]
|
114
|
+
].freeze
|
113
115
|
|
114
116
|
def initialize
|
115
117
|
self.server = ENV['SENTRY_DSN'] if ENV['SENTRY_DSN']
|
116
118
|
@context_lines = 3
|
117
119
|
self.current_environment = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'default'
|
118
120
|
self.send_modules = true
|
119
|
-
self.excluded_exceptions = IGNORE_DEFAULT
|
121
|
+
self.excluded_exceptions = IGNORE_DEFAULT.dup
|
120
122
|
self.processors = [Raven::Processor::RemoveCircularReferences, Raven::Processor::UTF8Conversion, Raven::Processor::SanitizeData]
|
121
123
|
self.ssl_verification = true
|
122
124
|
self.encoding = 'gzip'
|
@@ -130,15 +132,7 @@ module Raven
|
|
130
132
|
self.sanitize_credit_cards = true
|
131
133
|
self.environments = []
|
132
134
|
|
133
|
-
self.release =
|
134
|
-
|
135
|
-
if self.release.nil? || self.release.empty?
|
136
|
-
self.release = File.read(File.join(Rails.root, 'REVISION')).strip rescue nil
|
137
|
-
end
|
138
|
-
|
139
|
-
if self.release.nil? || self.release.empty?
|
140
|
-
self.release = `git rev-parse --short HEAD`.strip rescue nil
|
141
|
-
end
|
135
|
+
self.release = detect_release
|
142
136
|
end
|
143
137
|
|
144
138
|
def server=(value)
|
@@ -168,14 +162,14 @@ module Raven
|
|
168
162
|
@encoding = encoding
|
169
163
|
end
|
170
164
|
|
171
|
-
|
165
|
+
alias dsn= server=
|
172
166
|
|
173
167
|
def async=(value)
|
174
168
|
raise ArgumentError.new("async must be callable (or false to disable)") unless value == false || value.respond_to?(:call)
|
175
169
|
@async = value
|
176
170
|
end
|
177
171
|
|
178
|
-
|
172
|
+
alias async? async
|
179
173
|
|
180
174
|
# Allows config options to be read like a hash
|
181
175
|
#
|
@@ -202,5 +196,25 @@ module Raven
|
|
202
196
|
raise Error.new('No secret key specified') unless secret_key
|
203
197
|
raise Error.new('No project ID specified') unless project_id
|
204
198
|
end
|
199
|
+
|
200
|
+
def detect_release
|
201
|
+
detect_release_from_heroku ||
|
202
|
+
detect_release_from_capistrano ||
|
203
|
+
detect_release_from_git
|
204
|
+
end
|
205
|
+
|
206
|
+
private
|
207
|
+
|
208
|
+
def detect_release_from_heroku
|
209
|
+
ENV['HEROKU_SLUG_COMMIT']
|
210
|
+
end
|
211
|
+
|
212
|
+
def detect_release_from_capistrano
|
213
|
+
File.read(File.join(project_root, 'REVISION')).strip rescue nil
|
214
|
+
end
|
215
|
+
|
216
|
+
def detect_release_from_git
|
217
|
+
`git rev-parse --short HEAD`.strip if File.directory?(".git") rescue nil
|
218
|
+
end
|
205
219
|
end
|
206
220
|
end
|
data/lib/raven/event.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'rubygems'
|
2
3
|
require 'socket'
|
3
4
|
require 'securerandom'
|
@@ -16,11 +17,11 @@ module Raven
|
|
16
17
|
"warning" => 30,
|
17
18
|
"error" => 40,
|
18
19
|
"fatal" => 50,
|
19
|
-
}
|
20
|
+
}.freeze
|
20
21
|
|
21
22
|
BACKTRACE_RE = /^(.+?):(\d+)(?::in `(.+?)')?$/
|
22
23
|
|
23
|
-
PLATFORM = "ruby"
|
24
|
+
PLATFORM = "ruby".freeze
|
24
25
|
|
25
26
|
attr_reader :id
|
26
27
|
attr_accessor :project, :message, :timestamp, :time_spent, :level, :logger,
|
@@ -221,7 +222,7 @@ module Raven
|
|
221
222
|
|
222
223
|
def get_file_context(filename, lineno, context)
|
223
224
|
return nil, nil, nil unless Raven::LineCache.is_valid_file(filename)
|
224
|
-
lines = (2 * context + 1)
|
225
|
+
lines = Array.new(2 * context + 1) do |i|
|
225
226
|
Raven::LineCache.getline(filename, lineno - context + i)
|
226
227
|
end
|
227
228
|
[lines[0..(context - 1)], lines[context], lines[(context + 1)..-1]]
|
@@ -2,7 +2,6 @@ require 'delayed_job'
|
|
2
2
|
|
3
3
|
module Delayed
|
4
4
|
module Plugins
|
5
|
-
|
6
5
|
class Raven < ::Delayed::Plugin
|
7
6
|
callbacks do |lifecycle|
|
8
7
|
lifecycle.around(:invoke_job) do |job, *args, &block|
|
@@ -20,7 +19,7 @@ module Delayed
|
|
20
19
|
# handlers are YAML objects in strings, we definitely can't
|
21
20
|
# report all of that or the event will get truncated randomly
|
22
21
|
:handler => job.handler[0...100],
|
23
|
-
:last_error => job.last_error,
|
22
|
+
:last_error => job.last_error[0...100],
|
24
23
|
:run_at => job.run_at,
|
25
24
|
:locked_at => job.locked_at,
|
26
25
|
:locked_by => job.locked_by,
|
@@ -29,7 +28,7 @@ module Delayed
|
|
29
28
|
}
|
30
29
|
}
|
31
30
|
if job.respond_to?('payload_object') && job.payload_object.respond_to?('job_data')
|
32
|
-
extra
|
31
|
+
extra[:active_job] = job.payload_object.job_data
|
33
32
|
end
|
34
33
|
::Raven.capture_exception(exception,
|
35
34
|
:logger => 'delayed_job',
|
@@ -17,6 +17,7 @@ module Raven
|
|
17
17
|
Raven.configure do |config|
|
18
18
|
config.logger ||= ::Rails.logger
|
19
19
|
config.project_root ||= ::Rails.root
|
20
|
+
config.release = config.detect_release # if project_root has changed, need to re-check
|
20
21
|
end
|
21
22
|
|
22
23
|
if Raven.configuration.catch_debugged_exceptions
|
@@ -17,7 +17,7 @@ module Raven
|
|
17
17
|
|
18
18
|
# Add provider_job_id details if Rails 5
|
19
19
|
if defined?(provider_job_id)
|
20
|
-
active_job_details
|
20
|
+
active_job_details[:provider_job_id] = provider_job_id
|
21
21
|
end
|
22
22
|
|
23
23
|
Raven.capture_exception(exception, :extra => active_job_details)
|
data/lib/raven/interfaces.rb
CHANGED
data/lib/raven/linecache.rb
CHANGED
@@ -3,7 +3,10 @@
|
|
3
3
|
module Raven
|
4
4
|
class LineCache
|
5
5
|
class << self
|
6
|
-
|
6
|
+
# TODO: a constant isn't appropriate here, refactor
|
7
|
+
# also would there be threading bugs essentially using this as a class
|
8
|
+
# variable?
|
9
|
+
CACHE = {} # rubocop:disable Style/MutableConstant
|
7
10
|
|
8
11
|
def is_valid_file(path)
|
9
12
|
lines = getlines(path)
|
data/lib/raven/logger.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'json'
|
2
3
|
module Raven
|
3
4
|
class Processor::SanitizeData < Processor
|
4
|
-
STRING_MASK = '********'
|
5
|
+
STRING_MASK = '********'.freeze
|
5
6
|
INT_MASK = 0
|
6
|
-
DEFAULT_FIELDS = %w(authorization password passwd secret ssn social(.*)?sec)
|
7
|
+
DEFAULT_FIELDS = %w(authorization password passwd secret ssn social(.*)?sec).freeze
|
7
8
|
CREDIT_CARD_RE = /^(?:\d[ -]*?){13,16}$/
|
8
|
-
REGEX_SPECIAL_CHARACTERS = %w(. $ ^ { [ ( | ) * + ?)
|
9
|
+
REGEX_SPECIAL_CHARACTERS = %w(. $ ^ { [ ( | ) * + ?).freeze
|
9
10
|
|
10
11
|
attr_accessor :sanitize_fields, :sanitize_credit_cards
|
11
12
|
|
data/lib/raven/version.rb
CHANGED
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.15.
|
4
|
+
version: 0.15.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.36.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.36.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|