rollbar 1.4.0 → 1.4.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/CHANGELOG.md +6 -0
- data/README.md +53 -2
- data/THANKS.md +1 -0
- data/lib/rollbar/middleware/rails/rollbar.rb +1 -1
- data/lib/rollbar/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: f74dc5fc9ff24bdca6794e33d2b5b97b7d431c32
|
4
|
+
data.tar.gz: 40d644a903089a249e2f745cd419c563d666886e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8cf1b1c07b04b0a14487d38209206cea6c360a4c901c776061cfbf67808443fce33fa4726f2dbac0d29ac52b180e07fbc8b564c5f9a852a6062e5b31e6ae811
|
7
|
+
data.tar.gz: 49f9c3af52d8933fd5241bd6a344d85ecc52716243d485f2558bcdf89dda9506e3dc5b51b789b87a7d9776ee12ee0c4c3a2761dd3e59054f646285f133884875
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Rollbar notifier for Ruby [](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.4.
|
12
|
+
gem 'rollbar', '~> 1.4.1'
|
13
13
|
|
14
14
|
And then execute:
|
15
15
|
|
@@ -232,6 +232,57 @@ Rollbar.configure do |config|
|
|
232
232
|
end
|
233
233
|
```
|
234
234
|
|
235
|
+
### Person tracking with Rack applications
|
236
|
+
|
237
|
+
To track information about the current user in non-Rails applications, you can populate the `rollbar.person_data` key in the Rack environment with the desired data. Its value should be a hash like:
|
238
|
+
|
239
|
+
```ruby
|
240
|
+
{
|
241
|
+
:id => "123", # required; string up to 40 characters
|
242
|
+
:username => "adalovelace", # optional; string up to 255 characters
|
243
|
+
:email => "ada@lovelace.net" # optional; string up to 255 characters
|
244
|
+
}
|
245
|
+
```
|
246
|
+
|
247
|
+
Because Rack applications can vary so widely, we don't provide a default implementation in the gem, but here is an example middleware:
|
248
|
+
|
249
|
+
```ruby
|
250
|
+
class RollbarPersonData
|
251
|
+
def initialize(app)
|
252
|
+
@app = app
|
253
|
+
end
|
254
|
+
|
255
|
+
def call(env)
|
256
|
+
token = Rack::Request.new(env).params['token']
|
257
|
+
user = User.find_by_token(token)
|
258
|
+
|
259
|
+
if user
|
260
|
+
env['rollbar.person_data'] = extract_person_data(user)
|
261
|
+
end
|
262
|
+
|
263
|
+
@app.call(env)
|
264
|
+
end
|
265
|
+
|
266
|
+
def extract_person_data(user)
|
267
|
+
{
|
268
|
+
id: user.id,
|
269
|
+
username: user.username,
|
270
|
+
email: user.email
|
271
|
+
}
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
# You can add the middleware to your application, for ex:
|
276
|
+
|
277
|
+
class App < Sinatra::Base
|
278
|
+
use Rollbar::Middleware::Sinatra
|
279
|
+
use RollbarPersonData
|
280
|
+
|
281
|
+
# ...
|
282
|
+
# ...
|
283
|
+
end
|
284
|
+
```
|
285
|
+
|
235
286
|
## Special note about reporting within a request
|
236
287
|
|
237
288
|
The gem instantiates one `Notifier` instance on initialization, which will be the base notifier that is used for all reporting (via a `method_missing` proxy in the `Rollbar` module). Calling `Rollbar.configure()` will configure this base notifier that will be used globally in a ruby app.
|
data/THANKS.md
CHANGED
@@ -19,6 +19,7 @@ Huge thanks to the following contributors (by github username). For the most up-
|
|
19
19
|
- [gdeglin](https://github.com/gdeglin)
|
20
20
|
- [gersmann](https://github.com/gersmann)
|
21
21
|
- [grosser](https://github.com/grosser)
|
22
|
+
- [GUI](https://github.com/GUI)
|
22
23
|
- [ixti](https://github.com/ixti)
|
23
24
|
- [jeremyvdw](https://github.com/jeremyvdw)
|
24
25
|
- [johnknott](https://github.com/johnknott)
|
@@ -60,7 +60,7 @@ module Rollbar
|
|
60
60
|
|
61
61
|
def person_data_proc(env)
|
62
62
|
block = proc { extract_person_data_from_controller(env) }
|
63
|
-
return block unless
|
63
|
+
return block unless(defined?(ActiveRecord::Base) && ActiveRecord::Base.connected?)
|
64
64
|
|
65
65
|
proc { ActiveRecord::Base.connection_pool.with_connection(&block) }
|
66
66
|
end
|
data/lib/rollbar/version.rb
CHANGED
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.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rollbar, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|