sentry-raven 1.2.0 → 1.2.1
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 +4 -4
- data/lib/raven/base.rb +1 -1
- data/lib/raven/cli.rb +1 -1
- data/lib/raven/client.rb +1 -10
- data/lib/raven/configuration.rb +12 -3
- data/lib/raven/instance.rb +8 -12
- data/lib/raven/integrations/delayed_job.rb +3 -0
- data/lib/raven/integrations/rack.rb +3 -4
- data/lib/raven/integrations/sidekiq.rb +3 -0
- data/lib/raven/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e97702132902b09734d484062d95956e34c55e04
|
4
|
+
data.tar.gz: ca8d939ea7ff848249c6bcef9603bf31324a314b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b89c8cd9d4e2f28d8a83703d617a904b7cfca119f3a0bb3dbfff16d392307dbad7b6a37ffb844f136ce370e4c5b1f9a48069b2f86b172fa4d6afd3bbeea7d69
|
7
|
+
data.tar.gz: fd1da535f9f07a252ab08ca095beb0e863ae45d070074780e677dd56c51f74c1dfaae475ba62364ae90b3d905e3728f1ead572462266e6e988eefaa25a110eb6
|
data/lib/raven/base.rb
CHANGED
@@ -34,7 +34,7 @@ module Raven
|
|
34
34
|
|
35
35
|
def_delegators :instance, :client=, :configuration=, :context, :logger, :configuration,
|
36
36
|
:client, :report_status, :configure, :send_event, :capture, :capture_type,
|
37
|
-
:last_event_id, :
|
37
|
+
:last_event_id, :annotate_exception, :user_context,
|
38
38
|
:tags_context, :extra_context, :rack_context, :breadcrumbs
|
39
39
|
|
40
40
|
def_delegator :instance, :report_status, :report_ready
|
data/lib/raven/cli.rb
CHANGED
@@ -14,7 +14,7 @@ module Raven
|
|
14
14
|
Raven.configuration.dsn = dsn if dsn
|
15
15
|
|
16
16
|
# wipe out env settings to ensure we send the event
|
17
|
-
unless Raven.configuration.
|
17
|
+
unless Raven.configuration.capture_in_current_environment?
|
18
18
|
env_name = Raven.configuration.environments.pop || 'production'
|
19
19
|
puts "Setting environment to #{env_name}"
|
20
20
|
Raven.configuration.current_environment = env_name
|
data/lib/raven/client.rb
CHANGED
@@ -22,7 +22,7 @@ module Raven
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def send_event(event)
|
25
|
-
return false unless
|
25
|
+
return false unless configuration.sending_allowed?(event)
|
26
26
|
|
27
27
|
# Convert to hash
|
28
28
|
event = event.to_hash
|
@@ -62,15 +62,6 @@ module Raven
|
|
62
62
|
|
63
63
|
private
|
64
64
|
|
65
|
-
def configuration_allows_sending
|
66
|
-
if configuration.send_in_current_environment?
|
67
|
-
true
|
68
|
-
else
|
69
|
-
configuration.log_excluded_environment_message
|
70
|
-
false
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
65
|
def encode(event)
|
75
66
|
hash = @processors.reduce(event.to_hash) { |memo, p| p.process(memo) }
|
76
67
|
encoded = JSON.generate(hash)
|
data/lib/raven/configuration.rb
CHANGED
@@ -215,12 +215,21 @@ module Raven
|
|
215
215
|
@current_environment = environment.to_s
|
216
216
|
end
|
217
217
|
|
218
|
-
def
|
218
|
+
def capture_allowed?(message_or_exc)
|
219
|
+
capture_in_current_environment? &&
|
220
|
+
capture_allowed_by_callback?(message_or_exc)
|
221
|
+
end
|
222
|
+
|
223
|
+
# If we cannot capture, we cannot send.
|
224
|
+
alias sending_allowed? capture_allowed?
|
225
|
+
|
226
|
+
def capture_in_current_environment?
|
219
227
|
!!server && (environments.empty? || environments.include?(current_environment))
|
220
228
|
end
|
221
229
|
|
222
|
-
def
|
223
|
-
|
230
|
+
def capture_allowed_by_callback?(message_or_exc)
|
231
|
+
return true unless should_capture
|
232
|
+
should_capture.call(*[message_or_exc])
|
224
233
|
end
|
225
234
|
|
226
235
|
def verify!
|
data/lib/raven/instance.rb
CHANGED
@@ -60,11 +60,11 @@ module Raven
|
|
60
60
|
|
61
61
|
# Tell the log that the client is good to go
|
62
62
|
def report_status
|
63
|
-
return if
|
64
|
-
if
|
63
|
+
return if configuration.silence_ready
|
64
|
+
if configuration.capture_in_current_environment?
|
65
65
|
logger.info "Raven #{VERSION} ready to catch errors"
|
66
66
|
else
|
67
|
-
logger.info "Raven #{VERSION} configured not to
|
67
|
+
logger.info "Raven #{VERSION} configured not to capture errors."
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -113,7 +113,11 @@ module Raven
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def capture_type(obj, options = {})
|
116
|
-
|
116
|
+
unless configuration.capture_allowed?(obj)
|
117
|
+
Raven.logger.debug("#{obj} excluded from capture due to environment or should_capture callback")
|
118
|
+
return false
|
119
|
+
end
|
120
|
+
|
117
121
|
message_or_exc = obj.is_a?(String) ? "message" : "exception"
|
118
122
|
if (evt = Event.send("from_" + message_or_exc, obj, options))
|
119
123
|
yield evt if block_given?
|
@@ -131,14 +135,6 @@ module Raven
|
|
131
135
|
Thread.current["sentry_#{object_id}_last_event_id".to_sym]
|
132
136
|
end
|
133
137
|
|
134
|
-
def should_capture?(message_or_exc)
|
135
|
-
if configuration.should_capture
|
136
|
-
configuration.should_capture.call(*[message_or_exc])
|
137
|
-
else
|
138
|
-
true
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
138
|
# Provides extra context to the exception prior to it being handled by
|
143
139
|
# Raven. An exception can have multiple annotations, which are merged
|
144
140
|
# together.
|
@@ -41,10 +41,6 @@ module Raven
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def call(env)
|
44
|
-
# clear context at the beginning of the request to ensure a clean slate
|
45
|
-
Context.clear!
|
46
|
-
BreadcrumbBuffer.clear!
|
47
|
-
|
48
44
|
# store the current environment in our local context for arbitrary
|
49
45
|
# callers
|
50
46
|
env['raven.requested_at'] = Time.now
|
@@ -64,6 +60,9 @@ module Raven
|
|
64
60
|
Raven::Rack.capture_exception(error, env) if error
|
65
61
|
|
66
62
|
response
|
63
|
+
ensure
|
64
|
+
Context.clear!
|
65
|
+
BreadcrumbBuffer.clear!
|
67
66
|
end
|
68
67
|
end
|
69
68
|
|
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: 1.2.
|
4
|
+
version: 1.2.1
|
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-07-
|
11
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|