sentry-raven 0.4.8 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sentry-raven might be problematic. Click here for more details.

data/README.md CHANGED
@@ -143,6 +143,29 @@ Raven.configure do |config|
143
143
  end
144
144
  ```
145
145
 
146
+ ### Tags
147
+
148
+ You can configure default tags to be sent with every event. These can be
149
+ overridden in the context or event.
150
+
151
+ ```ruby
152
+ Raven.configure do |config|
153
+ config.tags = { environment: Rails.env }
154
+ end
155
+ ```
156
+
157
+ ### SSL Verification
158
+
159
+ By default SSL certificate verification is **disabled** in the client. This choice
160
+ was made due to root CAs not being commonly available on systems. If you'd like
161
+ to change this, you can enable verification by passing the ``ssl_verification``
162
+ flag:
163
+
164
+ ```ruby
165
+ Raven.configure do |config|
166
+ config.ssl_verification = true
167
+ ```
168
+
146
169
  ## Sanitizing Data (Processors)
147
170
 
148
171
  If you need to sanitize or pre-process (before its sent to the server) data, you can do so using the Processors
@@ -9,9 +9,9 @@ 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
+ INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}.freeze
13
13
 
14
- APP_DIRS_PATTERN = /^(bin|app|config|lib|test)/
14
+ APP_DIRS_PATTERN = /(bin|app|config|lib|test)/
15
15
 
16
16
  # The file portion of the line (such as app/models/user.rb)
17
17
  attr_reader :file
@@ -37,8 +37,9 @@ module Raven
37
37
  end
38
38
 
39
39
  def in_app
40
- if (project_root && self.file.start_with?(project_root)) ||
41
- (self.file =~ APP_DIRS_PATTERN)
40
+ @in_app_pattern ||= Regexp.new("^(#{project_root}/)?#{APP_DIRS_PATTERN}")
41
+
42
+ if self.file =~ @in_app_pattern
42
43
  true
43
44
  else
44
45
  false
@@ -19,7 +19,8 @@ module Raven
19
19
 
20
20
  # wipe out env settings to ensure we send the event
21
21
  if !Raven.configuration.send_in_current_environment? then
22
- env_name = Raven.coniguration.environments[0]
22
+ environments = Raven.configuration.environments
23
+ env_name = (environments && environments[0]) || 'production'
23
24
  puts "Setting environment to #{env_name}"
24
25
  Raven.configuration.current_environment = env_name
25
26
  end
@@ -53,7 +53,13 @@ module Raven
53
53
  processor.process(memo)
54
54
  end
55
55
 
56
- encoded = MultiJson.encode(hash)
56
+ new_adapter = configuration.json_adapter
57
+ begin
58
+ old_adapter, MultiJson.adapter = MultiJson.adapter, new_adapter if new_adapter
59
+ encoded = MultiJson.encode(hash)
60
+ ensure
61
+ MultiJson.adapter = old_adapter if new_adapter
62
+ end
57
63
 
58
64
  case self.configuration.encoding
59
65
  when 'gzip'
@@ -1,3 +1,5 @@
1
+ require 'logger'
2
+
1
3
  module Raven
2
4
  class Configuration
3
5
 
@@ -62,6 +64,13 @@ module Raven
62
64
 
63
65
  attr_accessor :server_name
64
66
 
67
+ # The JSON adapter to be used. When unset, use multi_json's
68
+ # intelligent defaults.
69
+ attr_accessor :json_adapter
70
+
71
+ # Default tags for events
72
+ attr_accessor :tags
73
+
65
74
  IGNORE_DEFAULT = ['ActiveRecord::RecordNotFound',
66
75
  'ActionController::RoutingError',
67
76
  'ActionController::InvalidAuthenticityToken',
@@ -81,6 +90,7 @@ module Raven
81
90
  self.encoding = 'json'
82
91
  self.timeout = 1
83
92
  self.open_timeout = 1
93
+ self.tags = {}
84
94
  end
85
95
 
86
96
  def server=(value)
@@ -52,7 +52,8 @@ module Raven
52
52
  @extra = options[:extra] || {}
53
53
  @extra.merge!(context.extra)
54
54
 
55
- @tags = options[:tags] || {}
55
+ @tags = @configuration.tags
56
+ @tags.merge!(options[:tags] || {})
56
57
  @tags.merge!(context.tags)
57
58
 
58
59
  block.call(self) if block
@@ -123,7 +124,7 @@ module Raven
123
124
  Raven.logger.info "Refusing to capture Raven error: #{exc.inspect}"
124
125
  return nil
125
126
  end
126
- if configuration[:excluded_exceptions].any? { |x| x === exc || x == exc.class.name }
127
+ if configuration[:excluded_exceptions].any? { |x| (x === exc rescue false) || x == exc.class.name }
127
128
  Raven.logger.info "User excluded error: #{exc.inspect}"
128
129
  return nil
129
130
  end
@@ -45,7 +45,7 @@ module Raven
45
45
  def filename
46
46
  return nil if self.abs_path.nil?
47
47
 
48
- prefix = $:.select {|s| self.abs_path.start_with?(s)}.sort_by {|s| s.length}.last
48
+ prefix = $:.select {|s| self.abs_path.start_with?(s.to_s)}.sort_by {|s| s.length}.last
49
49
  prefix ? self.abs_path[prefix.chomp(File::SEPARATOR).length+1..-1] : self.abs_path
50
50
  end
51
51
 
@@ -13,6 +13,9 @@ module Raven
13
13
  msg = args[0] # Block-level default args is a 1.9 feature
14
14
  msg ||= block.call if block
15
15
  logger = Raven.configuration[:logger]
16
+ if logger.nil?
17
+ logger = ::Logger.new(STDOUT)
18
+ end
16
19
  logger.send(level, "#{LOG_PREFIX}#{msg}") if logger
17
20
  end
18
21
  end
@@ -28,7 +28,7 @@ module Raven
28
28
  Raven.logger.debug "Raven HTTP Transport connecting to #{self.configuration.server}"
29
29
 
30
30
  ssl_configuration = self.configuration.ssl || {}
31
- ssl_configuration[:verify] = self.configuration.ssl_verification if self.configuration.ssl_verification
31
+ ssl_configuration[:verify] = self.configuration.ssl_verification
32
32
 
33
33
  conn = Faraday.new(
34
34
  :url => self.configuration[:server],
@@ -1,3 +1,3 @@
1
1
  module Raven
2
- VERSION = "0.4.8"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-raven
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-14 00:00:00.000000000 Z
13
+ date: 2013-07-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
17
- requirement: &70175567375220 !ruby/object:Gem::Requirement
17
+ requirement: &70301602282360 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.7.6
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70175567375220
25
+ version_requirements: *70301602282360
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: uuidtools
28
- requirement: &70175567374820 !ruby/object:Gem::Requirement
28
+ requirement: &70301602281940 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70175567374820
36
+ version_requirements: *70301602281940
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: multi_json
39
- requirement: &70175567374180 !ruby/object:Gem::Requirement
39
+ requirement: &70301602281340 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '1.0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70175567374180
47
+ version_requirements: *70301602281340
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: hashie
50
- requirement: &70175567372820 !ruby/object:Gem::Requirement
50
+ requirement: &70301602280340 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.1.0
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70175567372820
58
+ version_requirements: *70301602280340
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rake
61
- requirement: &70175567371960 !ruby/object:Gem::Requirement
61
+ requirement: &70301602279240 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70175567371960
69
+ version_requirements: *70301602279240
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
- requirement: &70175567371280 !ruby/object:Gem::Requirement
72
+ requirement: &70301602278480 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,21 +77,10 @@ dependencies:
77
77
  version: '2.10'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70175567371280
81
- - !ruby/object:Gem::Dependency
82
- name: simplecov
83
- requirement: &70175567370740 !ruby/object:Gem::Requirement
84
- none: false
85
- requirements:
86
- - - ! '>='
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- type: :development
90
- prerelease: false
91
- version_requirements: *70175567370740
80
+ version_requirements: *70301602278480
92
81
  - !ruby/object:Gem::Dependency
93
82
  name: coveralls
94
- requirement: &70175567370140 !ruby/object:Gem::Requirement
83
+ requirement: &70301602277960 !ruby/object:Gem::Requirement
95
84
  none: false
96
85
  requirements:
97
86
  - - ! '>='
@@ -99,7 +88,7 @@ dependencies:
99
88
  version: '0'
100
89
  type: :development
101
90
  prerelease: false
102
- version_requirements: *70175567370140
91
+ version_requirements: *70301602277960
103
92
  description:
104
93
  email: noah@coderanger.net
105
94
  executables: