rollbar 1.2.13 → 1.3.0

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: 7c9a546f13548ef6139126d589b9491103e54a13
4
- data.tar.gz: 3e36ffd724fb07d6bbfb3758adfa5becf98d5dee
3
+ metadata.gz: f16df0211259f30c790efadaf922efe258d549d5
4
+ data.tar.gz: 4d2a670ebac6ddfdf7bdf27de563efdc20adfc74
5
5
  SHA512:
6
- metadata.gz: d4b1d68005a5af7ba02208d198dcc91753fffa25d02178103942efe0474154478cf41e8e70b140f6ef99f5eb246f598066d257664ed5147daa30c3c820a23f1d
7
- data.tar.gz: 37b8bf25763ad0d623dba71f1184785d328a0998c174413ecd9c594d5cf1027ff7a17b32c1a5ad87e0c10cae2831b301917971b365a681870d22ac90428fd4d1
6
+ metadata.gz: 3c4379908512383a8328601c5dd13da3999c7492f9ca40b9b9e90809c9a210821616fb0da5eb80a443c7be19ae1c66127a4572816d38daf47b609fe66e78b0a1
7
+ data.tar.gz: d584525530951ec2d9fd65f071726a84442307e8ea466bbc7d275a0918cb30018e76688c176dd16a2846d5701d5294a36fd8d7991dab70e0fb2c7e1dc94b29f6
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.3.0
4
+
5
+ Performance improvements:
6
+
7
+ - In the Rails, Rack, and Sinatra middlewares, request data is now gathered only when needed instead of in advance on every request. See [#194](https://github.com/rollbar/rollbar-gem/pull/194); fixes [#180](https://github.com/rollbar/rollbar-gem/issues/180)
8
+
9
+ Possible breaking changes:
10
+
11
+ - If the scope's `:request` or `:context` value is an object that responds to `:call`, those values will now be called when a a report is made (and their result will be used in the payload). This is very unlikely to affect anyone, but we're releasing this as a version bump just to be safe.
12
+
13
+
3
14
  ## 1.2.13
4
15
 
5
16
  New features:
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v1.2.13)](https://travis-ci.org/rollbar/rollbar-gem/branches)
1
+ # Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v1.3.0)](https://travis-ci.org/rollbar/rollbar-gem/branches)
2
2
 
3
3
  <!-- RemoveNext -->
4
4
  Ruby gem for reporting exceptions, errors, and log messages to [Rollbar](https://rollbar.com).
@@ -9,7 +9,7 @@ Ruby gem for reporting exceptions, errors, and log messages to [Rollbar](https:/
9
9
 
10
10
  Add this line to your application's Gemfile:
11
11
 
12
- gem 'rollbar', '~> 1.2.13'
12
+ gem 'rollbar', '~> 1.3.0'
13
13
 
14
14
  And then execute:
15
15
 
data/THANKS.md CHANGED
@@ -16,6 +16,7 @@ Huge thanks to the following contributors (by github username). For the most up-
16
16
  - [firstbanco](https://github.com/firstbanco)
17
17
  - [flomotlik](https://github.com/flomotlik)
18
18
  - [Florent2](https://github.com/Florent2)
19
+ - [gdeglin](https://github.com/gdeglin)
19
20
  - [gersmann](https://github.com/gersmann)
20
21
  - [grosser](https://github.com/grosser)
21
22
  - [ixti](https://github.com/ixti)
@@ -220,6 +220,10 @@ module Rollbar
220
220
  data[:person] = data[:person].call if is_proc
221
221
  end
222
222
 
223
+ data[:request] = data[:request].call if data[:request].respond_to?(:call)
224
+ data[:context] = data[:context].call if data[:context].respond_to?(:call)
225
+ data.delete(:context) unless data[:context]
226
+
223
227
  schedule_payload(payload)
224
228
 
225
229
  log_instance_link(data)
@@ -22,9 +22,8 @@ module Rollbar
22
22
  end
23
23
 
24
24
  def fetch_scope(env)
25
- request_data = extract_request_data_from_rack(env)
26
25
  {
27
- :request => request_data,
26
+ :request => proc { extract_request_data_from_rack(env) },
28
27
  :person => person_data_proc(env)
29
28
  }
30
29
  rescue Exception => e
@@ -13,6 +13,8 @@ module Rollbar
13
13
  end
14
14
 
15
15
  def call(env)
16
+ self.request_data = nil
17
+
16
18
  Rollbar.reset_notifier!
17
19
 
18
20
  env['rollbar.scope'] = scope = fetch_scope(env)
@@ -34,17 +36,28 @@ module Rollbar
34
36
  end
35
37
 
36
38
  def fetch_scope(env)
37
- request_data = extract_request_data_from_rack(env)
38
-
39
39
  # Scope a new notifier with request data and a Proc for person data
40
40
  # for any reports that happen while a controller is handling a request
41
+
41
42
  {
42
- :request => request_data,
43
+ :request => proc { request_data(env) },
43
44
  :person => person_data_proc(env),
44
- :context => context(request_data)
45
+ :context => proc { context(request_data(env)) }
45
46
  }
46
47
  end
47
48
 
49
+ def request_data(env)
50
+ Thread.current[:'_rollbar.rails.request_data'] ||= extract_request_data(env)
51
+ end
52
+
53
+ def request_data=(value)
54
+ Thread.current[:'_rollbar.rails.request_data'] = value
55
+ end
56
+
57
+ def extract_request_data(env)
58
+ extract_request_data_from_rack(env)
59
+ end
60
+
48
61
  def person_data_proc(env)
49
62
  block = proc { extract_person_data_from_controller(env) }
50
63
  return block unless defined?(ActiveRecord::Base)
@@ -28,9 +28,8 @@ module Rollbar
28
28
  end
29
29
 
30
30
  def fetch_scope(env)
31
- request_data = extract_request_data_from_rack(env)
32
31
  {
33
- :request => request_data,
32
+ :request => proc { extract_request_data_from_rack(env) },
34
33
  :person => person_data_proc(env)
35
34
  }
36
35
  rescue Exception => e
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = "1.2.13"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -31,7 +31,7 @@ describe Rollbar::Middleware::Sinatra, :reconfigure_notifier => true do
31
31
  let(:logger_mock) { double('logger').as_null_object }
32
32
 
33
33
  before do
34
- Rollbar.reconfigure do |config|
34
+ Rollbar.configure do |config|
35
35
  config.logger = logger_mock
36
36
  config.framework = 'Sinatra'
37
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.13
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rollbar, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-05 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json