rollbar 0.12.11 → 0.12.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 224237219a5e86bf176e6b7bb6752e7afd93e4b2
4
- data.tar.gz: 178f549cc06d75334172dceedecc3ba98e47c68e
3
+ metadata.gz: d15606de22469d888a7845fe9de075e8436cb3b1
4
+ data.tar.gz: a19b11e9376b8ca3a32f9c5e0a0892fe78b35752
5
5
  SHA512:
6
- metadata.gz: f71e6ece9ee2010b4b176757ba096652606ff415457a6c5304379a4c8c8af96d484da3662a0c73ebd4c3930c75c2478c3a8a52101984566a02f8061e689d0906
7
- data.tar.gz: 761e80838ce6cbd442ea66eae9fb69bb3426f71194cb7003761587cd6a1f400c318fab09e47f203678c4c4b7d1d7b38f56e7b02e7aa39eb14b13435468e76942
6
+ metadata.gz: 92e66df6defcf5e9cc8a529969072b66820c43ba1eeab67a083075caa17163f65710b5646d3506af45c7e87627fcbf5ec1813bc8063d0da10b03621b8e1a5e82
7
+ data.tar.gz: a7de71a752d7239bb02fa0a7cf5fb0acc1a2535b29d939a4a36123d96557bfd3d232f328fbbedf13154071b97fe466e1b580ce92a514bc3f017bcd4d9073471d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ **0.12.12**
4
+ - Changes to support Engine Yard add-on setup
5
+
3
6
  **0.12.11**
4
7
  - Raise payload size limit to 128k
5
8
 
@@ -16,16 +16,25 @@ module Rollbar
16
16
  exit
17
17
  end
18
18
 
19
- if access_token === :use_env_sentinel
20
- say "Generator run without an access token; assuming you want to configure using an environment variable."
21
- say "You'll need to add an environment variable ROLLBAR_ACCESS_TOKEN with your access token:"
22
- say "\n$ export ROLLBAR_ACCESS_TOKEN=yourtokenhere"
23
- say "\nIf that's not what you wanted to do:"
24
- say "\n$ rm config/initializers/rollbar.rb"
25
- say "$ rails generate rollbar yourtokenhere"
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
- say "access token: " << access_token
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 = 128 * 1024 #128kb
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
- if result.bytesize > MAX_PAYLOAD_SIZE
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
- send_failsafe('Could not send payload due to it being too large after truncating attempts', nil)
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
@@ -32,4 +32,4 @@ module Rollbar
32
32
  str.unpack("U*").slice(0, length - ellipsis.length).pack("U*") + ellipsis
33
33
  end
34
34
  end
35
- end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = "0.12.11"
2
+ VERSION = "0.12.12"
3
3
  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: 0.12.11
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-19 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json