rollbar 0.12.11 → 0.12.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/generators/rollbar/rollbar_generator.rb +18 -9
- data/lib/generators/rollbar/templates/initializer.rb +11 -2
- data/lib/rollbar.rb +7 -3
- data/lib/rollbar/util.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: d15606de22469d888a7845fe9de075e8436cb3b1
|
4
|
+
data.tar.gz: a19b11e9376b8ca3a32f9c5e0a0892fe78b35752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92e66df6defcf5e9cc8a529969072b66820c43ba1eeab67a083075caa17163f65710b5646d3506af45c7e87627fcbf5ec1813bc8063d0da10b03621b8e1a5e82
|
7
|
+
data.tar.gz: a7de71a752d7239bb02fa0a7cf5fb0acc1a2535b29d939a4a36123d96557bfd3d232f328fbbedf13154071b97fe466e1b580ce92a514bc3f017bcd4d9073471d
|
data/CHANGELOG.md
CHANGED
@@ -16,16 +16,25 @@ module Rollbar
|
|
16
16
|
exit
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
say "\n"
|
19
|
+
begin
|
20
|
+
require 'ey_config'
|
21
|
+
rescue LoadError
|
22
|
+
end
|
23
|
+
|
24
|
+
if defined? EY::Config
|
25
|
+
say "Access token will be read from Engine Yard configuration"
|
27
26
|
else
|
28
|
-
|
27
|
+
if access_token === :use_env_sentinel
|
28
|
+
say "Generator run without an access token; assuming you want to configure using an environment variable."
|
29
|
+
say "You'll need to add an environment variable ROLLBAR_ACCESS_TOKEN with your access token:"
|
30
|
+
say "\n$ export ROLLBAR_ACCESS_TOKEN=yourtokenhere"
|
31
|
+
say "\nIf that's not what you wanted to do:"
|
32
|
+
say "\n$ rm config/initializers/rollbar.rb"
|
33
|
+
say "$ rails generate rollbar yourtokenhere"
|
34
|
+
say "\n"
|
35
|
+
else
|
36
|
+
say "access token: " << access_token
|
37
|
+
end
|
29
38
|
end
|
30
39
|
|
31
40
|
template 'initializer.rb', 'config/initializers/rollbar.rb',
|
@@ -1,13 +1,22 @@
|
|
1
1
|
require 'rollbar/rails'
|
2
2
|
Rollbar.configure do |config|
|
3
|
-
config.access_token = <%= access_token_expr %>
|
4
|
-
|
5
3
|
# Without configuration, Rollbar is enabled in all environments.
|
6
4
|
# To disable in specific environments, set config.enabled=false.
|
5
|
+
<% if (defined? EY::Config) %>
|
6
|
+
# Here we'll disable in 'test' and 'development':
|
7
|
+
if Rails.env.test? or Rails.env.development?
|
8
|
+
config.enabled = false
|
9
|
+
else
|
10
|
+
config.access_token = EY::Config.get('rollbar', 'ROLLBAR_ACCESS_TOKEN')
|
11
|
+
end
|
12
|
+
<% else %>
|
13
|
+
config.access_token = <%= access_token_expr %>
|
14
|
+
|
7
15
|
# Here we'll disable in 'test':
|
8
16
|
if Rails.env.test?
|
9
17
|
config.enabled = false
|
10
18
|
end
|
19
|
+
<% end %>
|
11
20
|
|
12
21
|
# By default, Rollbar will try to call the `current_user` controller method
|
13
22
|
# to fetch the logged-in user object, and then call that object's `id`,
|
data/lib/rollbar.rb
CHANGED
@@ -19,7 +19,7 @@ require 'rollbar/util'
|
|
19
19
|
require 'rollbar/railtie' if defined?(Rails)
|
20
20
|
|
21
21
|
module Rollbar
|
22
|
-
MAX_PAYLOAD_SIZE =
|
22
|
+
MAX_PAYLOAD_SIZE = 32 * 1024 #128kb
|
23
23
|
|
24
24
|
class << self
|
25
25
|
attr_writer :configuration
|
@@ -360,7 +360,8 @@ module Rollbar
|
|
360
360
|
result = MultiJson.dump(payload)
|
361
361
|
|
362
362
|
# Try to truncate strings in the payload a few times if the payload is too big
|
363
|
-
|
363
|
+
original_size = result.bytesize
|
364
|
+
if original_size > MAX_PAYLOAD_SIZE
|
364
365
|
thresholds = [1024, 512, 256]
|
365
366
|
thresholds.each_with_index do |threshold, i|
|
366
367
|
new_payload = payload.clone
|
@@ -372,7 +373,8 @@ module Rollbar
|
|
372
373
|
if result.bytesize <= MAX_PAYLOAD_SIZE
|
373
374
|
break
|
374
375
|
elsif i == thresholds.length - 1
|
375
|
-
|
376
|
+
final_size = result.bytesize
|
377
|
+
send_failsafe("Could not send payload due to it being too large after truncating attempts. Original size: #{original_size} Final size: #{final_size}", nil)
|
376
378
|
log_error "[Rollbar] Payload too large to be sent: #{MultiJson.dump(payload)}"
|
377
379
|
return
|
378
380
|
end
|
@@ -546,6 +548,8 @@ module Rollbar
|
|
546
548
|
truncator = Proc.new do |value|
|
547
549
|
if value.is_a?(String) and value.bytesize > byte_threshold
|
548
550
|
Rollbar::Util::truncate(value, byte_threshold)
|
551
|
+
elsif value.is_a?(Array) and value.length > byte_threshold
|
552
|
+
Rollbar::Util::truncate(value, byte_threshold)
|
549
553
|
else
|
550
554
|
value
|
551
555
|
end
|
data/lib/rollbar/util.rb
CHANGED
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: 0.12.
|
4
|
+
version: 0.12.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Rue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|