honeybadger 1.10.2 → 1.10.3

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: e0f85bcb71a37c3f43c8926267d0451df2ce4eb8
4
- data.tar.gz: e3ae25a5a9e56ce88518b3422776196c9e09ac3b
3
+ metadata.gz: edcae24e99958fe34acc363817dc30becf37ea99
4
+ data.tar.gz: 968da8e9f0c5a90d4f7e9d86a5c7525d427e6f28
5
5
  SHA512:
6
- metadata.gz: fa4789fdccd66511ca94abd6593ba1adc23da050f455663e4f7b8a0126b8771d4299247b59e56b92b0633b193ceab5751ae08ceb5352cbe19c6f9cf867d6fda4
7
- data.tar.gz: fc9dc62c29c7b3bf8289bdd4276f3a48cc510c0cd55cfbe55e22b6495bf0cc7691cc897ae22b91e4fdee1d162f993c6aa984e0149d6ad3290fede9cffa2e95db
6
+ metadata.gz: 718d30cb3969e876ca456a42bcbfaf4c739123e9cb905851f7eb06836974d6914b45a44f22e3344ccd07ddf65c45a9901d0736899411ca91f1a15e045e1ec47a
7
+ data.tar.gz: 53dc3063a6336f45986a894c96f1a86175110cf6d482ab560ebb2cb0919cc0f08813fce48f743fbe8a28d3e26e04d44d6f1b8dad707a8012632b842e444d6ae5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## Honeybadger 1.10.3 ##
2
+
3
+ * Fixed bug with missing stddev stats
4
+
5
+ *Ben Curtis*
6
+
7
+ * Fix concurrency race condition when modifying metrics hash
8
+
9
+ *Joshua Wood*
10
+
11
+ * Fix a JRuby memory leak
12
+
13
+ *Kevin Menard*
14
+
15
+ ## Honeybadger 1.10.2 ##
16
+
17
+ * Explictly cast division to float.
18
+
19
+ If you include mathn, a Rational is returned from #/, so we need
20
+ to explictly cast to a float.
21
+
22
+ *Austen Ito*
23
+
1
24
  ## Honeybadger 1.10.1 ##
2
25
 
3
26
  * Stop sending ENV with rake exceptions
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- honeybadger (1.10.2)
4
+ honeybadger (1.10.3)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.10.2)
4
+ honeybadger (1.10.3)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.10.2)
4
+ honeybadger (1.10.3)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.10.2)
4
+ honeybadger (1.10.3)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.10.2)
4
+ honeybadger (1.10.3)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.10.2)
4
+ honeybadger (1.10.3)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.10.2)
4
+ honeybadger (1.10.3)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.10.2)
4
+ honeybadger (1.10.3)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.10.2)
4
+ honeybadger (1.10.3)
5
5
  json
6
6
 
7
7
  GEM
data/honeybadger.gemspec CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'honeybadger'
7
- s.version = '1.10.2'
8
- s.date = '2014-01-22'
7
+ s.version = '1.10.3'
8
+ s.date = '2014-02-05'
9
9
 
10
10
  s.summary = 'Error reports you can be happy about.'
11
11
  s.description = 'Make managing application errors a more pleasant experience.'
data/lib/honeybadger.rb CHANGED
@@ -16,7 +16,7 @@ require 'honeybadger/user_feedback'
16
16
  require 'honeybadger/railtie' if defined?(Rails::Railtie)
17
17
 
18
18
  module Honeybadger
19
- VERSION = '1.10.2'
19
+ VERSION = '1.10.3'
20
20
  LOG_PREFIX = "** [Honeybadger] "
21
21
 
22
22
  HEADERS = {
@@ -5,19 +5,33 @@ module Honeybadger
5
5
  class Worker
6
6
  include Singleton
7
7
 
8
+ # Sub-class thread so we have a named thread (useful for debugging in Thread.list).
9
+ class MetricsThread < Thread
10
+ end
11
+
8
12
  def initialize
9
13
  init_metrics
10
14
  @delay = 60
11
15
  @per_request = 100
12
16
  @sender = Monitor::Sender.new(Honeybadger.configuration)
13
- @thread = Thread.new do
14
- while true do
17
+ @lock = Mutex.new
18
+ start
19
+ at_exit { stop }
20
+ end
21
+
22
+ def start
23
+ @thread = MetricsThread.new do
24
+ until Thread.current[:should_exit] do
15
25
  send_metrics
16
26
  sleep @delay
17
27
  end
18
28
  end
19
29
  end
20
30
 
31
+ def stop
32
+ @thread[:should_exit] = true if @thread
33
+ end
34
+
21
35
  def timing(name, value)
22
36
  add_metric(name, value, :timing)
23
37
  end
@@ -32,10 +46,17 @@ module Honeybadger
32
46
  @metrics = { :timing => {}, :counter => {} }
33
47
  end
34
48
 
49
+ def collect_metrics
50
+ @lock.synchronize do
51
+ metrics = @metrics
52
+ init_metrics
53
+ metrics
54
+ end
55
+ end
56
+
35
57
  def send_metrics
36
- metrics = @metrics.dup
58
+ metrics = collect_metrics
37
59
  return unless metrics[:timing].any? || metrics[:counter].any?
38
- init_metrics
39
60
  [].tap do |m|
40
61
  metrics[:counter].each do |metric, values|
41
62
  m << "#{metric} #{values.sum}"
@@ -51,7 +72,7 @@ module Honeybadger
51
72
  end
52
73
  end.each_slice(@per_request) do |mm|
53
74
  begin
54
- @sender.send_metrics({ :metrics => mm, :environment => Honeybadger.configuration.environment_name, :hostname => Honeybadger.configuration.hostname })
75
+ @sender.send_metrics({ :metrics => mm.compact, :environment => Honeybadger.configuration.environment_name, :hostname => Honeybadger.configuration.hostname })
55
76
  rescue Exception => e
56
77
  log(:error, "[Honeybadger::Monitor::Worker#send_metrics] Failed to send #{mm.count} metrics: #{e.class} - #{e.message}\nBacktrace:\n#{e.backtrace.join("\n\t")}")
57
78
  end
@@ -59,7 +80,9 @@ module Honeybadger
59
80
  end
60
81
 
61
82
  def add_metric(name, value, kind)
62
- (@metrics[kind][name] ||= Honeybadger::Array.new) << value
83
+ @lock.synchronize do
84
+ (@metrics[kind][name] ||= Honeybadger::Array.new) << value
85
+ end
63
86
  end
64
87
 
65
88
  def log(level, message)
@@ -7,12 +7,13 @@ describe Honeybadger::Monitor::Worker do
7
7
 
8
8
  before(:each) do
9
9
  Thread.stub(:new)
10
+
10
11
  # Create an attr_reader for @metrics and @sender
11
12
  instance.stub(:metrics) { instance.instance_variable_get(:@metrics) }
12
13
  instance.stub(:sender) { instance.instance_variable_get(:@sender) }
13
14
  end
14
15
 
15
- context 'initializing' do
16
+ describe '#initialize' do
16
17
  describe '@metrics' do
17
18
  subject { instance.instance_variable_get(:@metrics) }
18
19
 
@@ -49,6 +50,16 @@ describe Honeybadger::Monitor::Worker do
49
50
  Honeybadger::Monitor::Worker.send(:new)
50
51
  end
51
52
  end
53
+
54
+ it 'starts the worker loop'
55
+ end
56
+
57
+ describe '#start' do
58
+ it 'creates a new Thread'
59
+ end
60
+
61
+ describe '#stop' do
62
+ it 'asks current thread to exit gracefully'
52
63
  end
53
64
 
54
65
  describe '#timing' do
@@ -88,7 +99,9 @@ describe Honeybadger::Monitor::Worker do
88
99
 
89
100
  it 're-inits metrics' do
90
101
  instance.increment(:test, 60)
102
+ previous_metrics = instance.metrics
91
103
  expect { subject }.to change(instance, :metrics).to({ :timing => {}, :counter => {} })
104
+ expect(instance.metrics).not_to be(previous_metrics)
92
105
  end
93
106
 
94
107
  it 'returns nil when there are no metrics to send' do
@@ -105,9 +118,8 @@ describe Honeybadger::Monitor::Worker do
105
118
  expect(subject).to be_nil
106
119
  end
107
120
 
108
- context 'when constructingtiming metrics' do
121
+ context 'when constructing timing metrics' do
109
122
  before(:each) { 10.times { |i| instance.timing(:test, i) } }
110
- after(:each) { subject }
111
123
 
112
124
  it 'includes the mean value' do
113
125
  instance.sender.should_receive(:send_metrics).with(hash_including(:metrics => array_including(['test:mean 4.5'])))
@@ -136,6 +148,8 @@ describe Honeybadger::Monitor::Worker do
136
148
  it 'includes a count of total metrics' do
137
149
  instance.sender.should_receive(:send_metrics).with(hash_including(:metrics => array_including(['test 10'])))
138
150
  end
151
+
152
+ after(:each) { subject }
139
153
  end
140
154
 
141
155
  context 'when constructing counter metrics' do
@@ -148,7 +162,6 @@ describe Honeybadger::Monitor::Worker do
148
162
 
149
163
  context 'when sending metrics' do
150
164
  before(:each) { instance.increment(:test, 1) }
151
- after(:each) { subject }
152
165
 
153
166
  it 'executes batches of 100' do
154
167
  199.times { |i| instance.increment(:"test_#{i}", 1) }
@@ -168,6 +181,8 @@ describe Honeybadger::Monitor::Worker do
168
181
  end
169
182
  instance.sender.should_receive(:send_metrics).with(hash_including(:hostname => 'zxcv'))
170
183
  end
184
+
185
+ after(:each) { subject }
171
186
  end
172
187
 
173
188
  context 'when an exception occurrs' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2
4
+ version: 1.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Wood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-22 00:00:00.000000000 Z
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json