sentry-raven 0.13.1 → 0.13.2

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: cbd5b9f37fa1ca79dea7e89151503de77596ed98
4
- data.tar.gz: aaedca0037e5beb365920db50e7e1b0051f9e7c4
3
+ metadata.gz: 0068907131d47616cf8229a45fb15dc5d736f680
4
+ data.tar.gz: 5060b2230dee53bd64eab9b5f7da98a8737eb8df
5
5
  SHA512:
6
- metadata.gz: c462bfc11f2cde6d33464b16b0ae3986ac62ea34a63d16f2185d4d4f5cbf1c7bf6a18228058f17d1aeefad3aa47827deba61eed49f33a2db786bfff91ff42c8f
7
- data.tar.gz: 38266e8ad1642b99d59fcafef2c42814d09e9ebcbd8800e7a4af2040068be367ff3a4907a60df17b8f00173a9631f1d03b9381f31c6dc189e70b64bb8cb7c9f2
6
+ metadata.gz: 7bcf7fb4332ea22d13f703cf68158b3462678750faa6f3ea6d121bc9f79690c96d104d39a273353dfb68d229370cf9fa7c30135947b2bfac6cba9bbaba7d9bce
7
+ data.tar.gz: d7bd1e408b8d66d9fedacea5782723d23f6f6fa3cf1019ee34cfc07a84046239a44bd05be2e0cb07cf19bfdd785389b31093c4996a5c77e9e9678ce4bee2ac62
@@ -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 send(evt)
83
- client.send(evt)
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 rails sidekiq rack rake]
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
@@ -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
- environments = Raven.configuration.environments
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
- unless Raven.configuration.server
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
- puts "-> event ID: #{evt.value.id}"
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."
@@ -21,7 +21,7 @@ module Raven
21
21
  @state = ClientState.new
22
22
  end
23
23
 
24
- def send(event)
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.send(generate_auth_header, encoded_data,
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
@@ -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 && (!environments || environments.include?(current_environment))
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
@@ -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!(@context.user)
58
- @extra.merge!(@context.extra)
59
- @tags.merge!(@configuration.tags)
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)
@@ -15,7 +15,8 @@ module Delayed
15
15
  ::Raven.capture_exception(exception,
16
16
  :logger => 'delayed_job',
17
17
  :tags => {
18
- :delayed_job_queue => job.queue
18
+ :delayed_job_queue => job.queue,
19
+ :delayed_job_id => job.id
19
20
  },
20
21
  :extra => {
21
22
  :delayed_job => {
@@ -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) || fields_re.match(k.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
-
@@ -10,17 +10,14 @@ module Raven
10
10
  @configuration = configuration
11
11
  end
12
12
 
13
- def send#(auth_header, data, options = {})
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
- raise Error.new('No server specified') unless self.configuration.server
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Raven
2
- VERSION = "0.13.1"
2
+ VERSION = "0.13.2"
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.1
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-04-17 00:00:00.000000000 Z
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