sentry-raven 0.13.1 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raven/base.rb +9 -3
- data/lib/raven/cli.rb +8 -17
- data/lib/raven/client.rb +8 -2
- data/lib/raven/configuration.rb +13 -1
- data/lib/raven/event.rb +3 -4
- data/lib/raven/integrations/delayed_job.rb +2 -1
- data/lib/raven/integrations/railties.rb +1 -0
- data/lib/raven/processor/sanitizedata.rb +4 -3
- data/lib/raven/transports.rb +2 -5
- data/lib/raven/transports/http.rb +7 -2
- data/lib/raven/transports/udp.rb +7 -2
- data/lib/raven/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0068907131d47616cf8229a45fb15dc5d736f680
|
4
|
+
data.tar.gz: 5060b2230dee53bd64eab9b5f7da98a8737eb8df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bcf7fb4332ea22d13f703cf68158b3462678750faa6f3ea6d121bc9f79690c96d104d39a273353dfb68d229370cf9fa7c30135947b2bfac6cba9bbaba7d9bce
|
7
|
+
data.tar.gz: d7bd1e408b8d66d9fedacea5782723d23f6f6fa3cf1019ee34cfc07a84046239a44bd05be2e0cb07cf19bfdd785389b31093c4996a5c77e9e9678ce4bee2ac62
|
data/lib/raven/base.rb
CHANGED
@@ -79,8 +79,14 @@ module Raven
|
|
79
79
|
# @example
|
80
80
|
# evt = Raven::Event.new(:message => "An error")
|
81
81
|
# Raven.send(evt)
|
82
|
-
def
|
83
|
-
client.
|
82
|
+
def send_event(event)
|
83
|
+
client.send_event(event)
|
84
|
+
end
|
85
|
+
|
86
|
+
def send(event)
|
87
|
+
Raven.logger.warn "DEPRECATION WARNING: Calling #send on Raven::Base will be \
|
88
|
+
removed in Raven-Ruby 0.14! Use #send_event instead!"
|
89
|
+
client.send_event(event)
|
84
90
|
end
|
85
91
|
|
86
92
|
# Capture and process any exceptions from the given block, or globally if
|
@@ -195,7 +201,7 @@ module Raven
|
|
195
201
|
|
196
202
|
# Injects various integrations
|
197
203
|
def inject
|
198
|
-
available_integrations = %w[delayed_job
|
204
|
+
available_integrations = %w[delayed_job railties sidekiq rack rake]
|
199
205
|
integrations_to_load = available_integrations & Gem.loaded_specs.keys
|
200
206
|
# TODO(dcramer): integrations should have some additional checks baked-in
|
201
207
|
# or we should break them out into their own repos. Specifically both the
|
data/lib/raven/cli.rb
CHANGED
@@ -17,28 +17,15 @@ module Raven
|
|
17
17
|
|
18
18
|
# wipe out env settings to ensure we send the event
|
19
19
|
unless Raven.configuration.send_in_current_environment?
|
20
|
-
|
21
|
-
env_name = (environments && environments[0]) || 'production'
|
20
|
+
env_name = Raven.configuration.environments.pop || 'production'
|
22
21
|
puts "Setting environment to #{env_name}"
|
23
22
|
Raven.configuration.current_environment = env_name
|
24
23
|
end
|
25
24
|
|
26
|
-
|
27
|
-
puts "Your client is not configured!"
|
28
|
-
exit 1
|
29
|
-
end
|
30
|
-
|
31
|
-
puts "Client configuration:"
|
32
|
-
['server', 'project_id', 'public_key', 'secret_key'].each do |key|
|
33
|
-
unless Raven.configuration[key]
|
34
|
-
puts "Missing configuration for #{key}"
|
35
|
-
exit 1
|
36
|
-
end
|
37
|
-
puts "-> #{key}: #{Raven.configuration[key]}"
|
38
|
-
end
|
39
|
-
puts ""
|
25
|
+
Raven.configuration.verify!
|
40
26
|
|
41
27
|
puts "Sending a test event:"
|
28
|
+
puts ""
|
42
29
|
|
43
30
|
begin
|
44
31
|
1 / 0
|
@@ -53,7 +40,11 @@ module Raven
|
|
53
40
|
puts "-> event ID: #{evt.id}"
|
54
41
|
end
|
55
42
|
elsif evt #async configuration
|
56
|
-
|
43
|
+
if evt.value.is_a? Hash
|
44
|
+
puts "-> event ID: #{evt.value[:event_id]}"
|
45
|
+
else
|
46
|
+
puts "-> event ID: #{evt.value.id}"
|
47
|
+
end
|
57
48
|
else
|
58
49
|
puts ""
|
59
50
|
puts "An error occurred while attempting to send the event."
|
data/lib/raven/client.rb
CHANGED
@@ -21,7 +21,7 @@ module Raven
|
|
21
21
|
@state = ClientState.new
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def send_event(event)
|
25
25
|
return false unless configuration_allows_sending
|
26
26
|
|
27
27
|
# Convert to hash
|
@@ -37,7 +37,7 @@ module Raven
|
|
37
37
|
content_type, encoded_data = encode(event)
|
38
38
|
|
39
39
|
begin
|
40
|
-
transport.
|
40
|
+
transport.send_event(generate_auth_header, encoded_data,
|
41
41
|
:content_type => content_type)
|
42
42
|
rescue => e
|
43
43
|
failed_send(e, event)
|
@@ -49,6 +49,12 @@ module Raven
|
|
49
49
|
event
|
50
50
|
end
|
51
51
|
|
52
|
+
def send(event)
|
53
|
+
Raven.logger.warn "DEPRECATION WARNING: Calling #send on a Client will be \
|
54
|
+
removed in Raven-Ruby 0.14! Use #send_event instead!"
|
55
|
+
send_event(event)
|
56
|
+
end
|
57
|
+
|
52
58
|
private
|
53
59
|
|
54
60
|
def configuration_allows_sending
|
data/lib/raven/configuration.rb
CHANGED
@@ -95,6 +95,9 @@ module Raven
|
|
95
95
|
# additional fields to sanitize
|
96
96
|
attr_accessor :sanitize_fields
|
97
97
|
|
98
|
+
# Sanitize values that look like credit card numbers
|
99
|
+
attr_accessor :sanitize_credit_cards
|
100
|
+
|
98
101
|
IGNORE_DEFAULT = ['ActiveRecord::RecordNotFound',
|
99
102
|
'ActionController::RoutingError',
|
100
103
|
'ActionController::InvalidAuthenticityToken',
|
@@ -119,6 +122,8 @@ module Raven
|
|
119
122
|
self.async = false
|
120
123
|
self.catch_debugged_exceptions = true
|
121
124
|
self.sanitize_fields = []
|
125
|
+
self.sanitize_credit_cards = true
|
126
|
+
self.environments = []
|
122
127
|
end
|
123
128
|
|
124
129
|
def server=(value)
|
@@ -169,11 +174,18 @@ module Raven
|
|
169
174
|
end
|
170
175
|
|
171
176
|
def send_in_current_environment?
|
172
|
-
!!server && (
|
177
|
+
!!server && (environments.empty? || environments.include?(current_environment))
|
173
178
|
end
|
174
179
|
|
175
180
|
def log_excluded_environment_message
|
176
181
|
Raven.logger.debug "Event not sent due to excluded environment: #{current_environment}"
|
177
182
|
end
|
183
|
+
|
184
|
+
def verify!
|
185
|
+
raise Error.new('No server specified') unless server
|
186
|
+
raise Error.new('No public key specified') unless public_key
|
187
|
+
raise Error.new('No secret key specified') unless secret_key
|
188
|
+
raise Error.new('No project ID specified') unless project_id
|
189
|
+
end
|
178
190
|
end
|
179
191
|
end
|
data/lib/raven/event.rb
CHANGED
@@ -54,10 +54,9 @@ module Raven
|
|
54
54
|
|
55
55
|
init.each_pair { |key, val| instance_variable_set('@' + key.to_s, val) }
|
56
56
|
|
57
|
-
@user.merge
|
58
|
-
@extra.merge
|
59
|
-
@tags.merge
|
60
|
-
@tags.merge!(@context.tags)
|
57
|
+
@user = @context.user.merge(@user)
|
58
|
+
@extra = @context.extra.merge(@extra)
|
59
|
+
@tags = @configuration.tags.merge(@context.tags).merge(@tags)
|
61
60
|
|
62
61
|
# Some type coercion
|
63
62
|
@timestamp = @timestamp.strftime('%Y-%m-%dT%H:%M:%S') if @timestamp.is_a?(Time)
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'raven/integrations/rails'
|
@@ -6,11 +6,12 @@ module Raven
|
|
6
6
|
DEFAULT_FIELDS = %w(authorization password passwd secret ssn social(.*)?sec)
|
7
7
|
CREDIT_CARD_RE = /^(?:\d[ -]*?){13,16}$/
|
8
8
|
|
9
|
-
attr_accessor :sanitize_fields
|
9
|
+
attr_accessor :sanitize_fields, :sanitize_credit_cards
|
10
10
|
|
11
11
|
def initialize(client)
|
12
12
|
super
|
13
13
|
self.sanitize_fields = client.configuration.sanitize_fields
|
14
|
+
self.sanitize_credit_cards = client.configuration.sanitize_credit_cards
|
14
15
|
end
|
15
16
|
|
16
17
|
def process(value)
|
@@ -49,7 +50,8 @@ module Raven
|
|
49
50
|
end
|
50
51
|
|
51
52
|
def matches_regexes?(k, v)
|
52
|
-
CREDIT_CARD_RE.match(v.to_s) ||
|
53
|
+
(sanitize_credit_cards && CREDIT_CARD_RE.match(v.to_s)) ||
|
54
|
+
fields_re.match(k.to_s)
|
53
55
|
end
|
54
56
|
|
55
57
|
def fields_re
|
@@ -65,4 +67,3 @@ module Raven
|
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
68
|
-
|
data/lib/raven/transports.rb
CHANGED
@@ -10,17 +10,14 @@ module Raven
|
|
10
10
|
@configuration = configuration
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def send_event#(auth_header, data, options = {})
|
14
14
|
raise NotImplementedError.new('Abstract method not implemented')
|
15
15
|
end
|
16
16
|
|
17
17
|
protected
|
18
18
|
|
19
19
|
def verify_configuration
|
20
|
-
|
21
|
-
raise Error.new('No public key specified') unless self.configuration.public_key
|
22
|
-
raise Error.new('No secret key specified') unless self.configuration.secret_key
|
23
|
-
raise Error.new('No project ID specified') unless self.configuration.project_id
|
20
|
+
configuration.verify!
|
24
21
|
end
|
25
22
|
end
|
26
23
|
end
|
@@ -6,8 +6,7 @@ require 'raven/error'
|
|
6
6
|
module Raven
|
7
7
|
module Transports
|
8
8
|
class HTTP < Transport
|
9
|
-
|
10
|
-
def send(auth_header, data, options = {})
|
9
|
+
def send_event(auth_header, data, options = {})
|
11
10
|
project_id = self.configuration[:project_id]
|
12
11
|
path = self.configuration[:path] + "/"
|
13
12
|
|
@@ -20,6 +19,12 @@ module Raven
|
|
20
19
|
response
|
21
20
|
end
|
22
21
|
|
22
|
+
def send(auth_header, data, options = {})
|
23
|
+
Raven.logger.warn "DEPRECATION WARNING: Calling #send on a Transport will be \
|
24
|
+
removed in Raven-Ruby 0.14! Use #send_event instead!"
|
25
|
+
send_event(auth_header, data, options)
|
26
|
+
end
|
27
|
+
|
23
28
|
private
|
24
29
|
|
25
30
|
def conn
|
data/lib/raven/transports/udp.rb
CHANGED
@@ -6,11 +6,16 @@ require 'raven/error'
|
|
6
6
|
module Raven
|
7
7
|
module Transports
|
8
8
|
class UDP < Transport
|
9
|
-
|
10
|
-
def send(auth_header, data, _options = {})
|
9
|
+
def send_event(auth_header, data, _options = {})
|
11
10
|
conn.send "#{auth_header}\n\n#{data}", 0
|
12
11
|
end
|
13
12
|
|
13
|
+
def send(auth_header, data, options = {})
|
14
|
+
Raven.logger.warn "DEPRECATION WARNING: Calling #send on a Transport will be \
|
15
|
+
removed in Raven-Ruby 0.14! Use #send_event instead!"
|
16
|
+
send_event(auth_header, data, options)
|
17
|
+
end
|
18
|
+
|
14
19
|
private
|
15
20
|
|
16
21
|
def conn
|
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.13.
|
4
|
+
version: 0.13.2
|
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-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/raven/integrations/rails.rb
|
122
122
|
- lib/raven/integrations/rails/controller_methods.rb
|
123
123
|
- lib/raven/integrations/rails/middleware/debug_exceptions_catcher.rb
|
124
|
+
- lib/raven/integrations/railties.rb
|
124
125
|
- lib/raven/integrations/rake.rb
|
125
126
|
- lib/raven/integrations/sidekiq.rb
|
126
127
|
- lib/raven/integrations/tasks.rb
|