opbeat 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c862b00532d010cbd49108561ea840c8cbe98cf
4
- data.tar.gz: cc79eaec3be6dba36f26ea5131a6bc4ad13cecb6
3
+ metadata.gz: dfe15681e252c3094e3511bf20dbafe757f9e342
4
+ data.tar.gz: b8c85cf5621ca9e675f56480416d661773569adc
5
5
  SHA512:
6
- metadata.gz: 97ab27bd81b41b12a0ad8e32793f6e4c873b5e2ffd003a51e5e979fc08999c22e87d1104ca5121416ef4a2adb688ddc74ba94a9994d991ebb723cfdebb42fc84
7
- data.tar.gz: d4dfc1cdfbe7db7e0168df70e8157a11375f72e3d1a253908d0ab59068d13987a71e042ff7b08f05917d53ac07451ff38c99db5144d1bdbd00605a08ddc77663
6
+ metadata.gz: 219eddda6bdccc4a1e4eb52c292c527c650c7fdab9f53db68388a24a8f64aee5dbae331fa9ab15f67a97b6cdba4c89f669ab42eea1c56788afd5c9b4f1bb88df
7
+ data.tar.gz: b788d34646fb4cbb258a9fbd4cff8bb23723e9803553e6af51112adf3a3888f7975c2d072268a587c5daa6e621f7bb130113d09c185de148872a7fd5f2c034ce
data/README.md CHANGED
@@ -153,7 +153,7 @@ Opbeat.configure do |config|
153
153
  config.app_id = '094e250818'
154
154
  config.secret_token = 'f0f5237a221637f561a15614f5fef218f8d6317d'
155
155
 
156
- config.processors = [Opbeat::Processors::SanitizeData]
156
+ config.processors = [Opbeat::Processor::SanitizeData]
157
157
  end
158
158
  ```
159
159
 
data/lib/opbeat/client.rb CHANGED
@@ -19,7 +19,6 @@ module Opbeat
19
19
  return true if @status == :online
20
20
 
21
21
  interval = ([@retry_number, 6].min() ** 2) * @configuration[:backoff_multiplier]
22
- puts interval
23
22
  return true if Time.now - @last_check > interval
24
23
 
25
24
  false
@@ -50,6 +49,7 @@ module Opbeat
50
49
  def initialize(configuration)
51
50
  @configuration = configuration
52
51
  @state = ClientState.new configuration
52
+ @processors = configuration.processors.map { |p| p.new(self) }
53
53
  end
54
54
 
55
55
  def conn
@@ -74,6 +74,16 @@ module Opbeat
74
74
  'Bearer ' + self.configuration[:secret_token]
75
75
  end
76
76
 
77
+ def encode(event)
78
+ event_hash = event.to_hash
79
+
80
+ @processors.each do |p|
81
+ event_hash = p.process(event_hash)
82
+ end
83
+
84
+ return MultiJson.encode(event_hash)
85
+ end
86
+
77
87
  def send(event)
78
88
  return unless configuration.send_in_current_environment?
79
89
  return unless state.should_try?
@@ -86,7 +96,7 @@ module Opbeat
86
96
  begin
87
97
  response = self.conn.post @url do |req|
88
98
  req.headers['Content-Type'] = 'application/json'
89
- req.body = MultiJson.encode(event.to_hash)
99
+ req.body = self.encode(event)
90
100
  req.headers[AUTH_HEADER_KEY] = self.generate_auth_header(req.body)
91
101
  req.headers["User-Agent"] = USER_AGENT
92
102
  end
@@ -24,7 +24,7 @@ module Opbeat
24
24
  end
25
25
 
26
26
  def sanitize(key, value)
27
- if !value || value.empty?
27
+ if !value.is_a?(String) || value.empty?
28
28
  value
29
29
  elsif VALUES_RE.match(value) or FIELDS_RE.match(key)
30
30
  MASK
@@ -1,3 +1,3 @@
1
1
  module Opbeat
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opbeat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-16 00:00:00.000000000 Z
12
+ date: 2014-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday