metrician 0.0.3 → 0.0.4

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: ab0cafbd476b019c807691285fbdbe519e009c5d
4
- data.tar.gz: db71e9161020218c01d26fbfcbdd328863c01396
3
+ metadata.gz: a191afe161c4357de6c30940adf1dd405419aed1
4
+ data.tar.gz: a1154276f6c09cc3c4ca9bdffbcdfcf00044309a
5
5
  SHA512:
6
- metadata.gz: 13ccde697c529f5c19019f964e7be4f2c8263f819c0b7d7ca908302ba1fe6695921a44d0ec77a3a816a3e81e80783d5fdf74b5fcdf526e3016bdc891e7864367
7
- data.tar.gz: 612ddbe8de8989b52bcae7ae06b5fe94c4281d041e3ce573f8d7ae2707803f022916eb378b1bd70d1ed437c92d4c64b086fc0bdc34532d85b9b6e748e27387bb
6
+ metadata.gz: e3dde17cb1da6670d88fa0bf88d7833b28fdf979519e107b1ccb24b9986a359aa6b8b00e1cb62e4dd91e15052a3be8bbc53ab65313c036d7cb31e7a880c957a5
7
+ data.tar.gz: 95c30e45864e10cd236739eb5b1f5d1aaa74dc2e592db616cf5f803fe9ba3b2a0bc10f8ee16730ee5db4daf8b81d4f12b12d17717c30babd774d0c4420c484c0
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ### 0.0.4 [July 24, 2017]
2
+ * Handle exceptions in other middlewares for response size tracking
3
+
4
+ ### 0.0.3 [July 20, 2017]
5
+ * Publish to Rubygems
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- metrician (0.0.1)
4
+ metrician (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- metrician (0.0.1)
4
+ metrician (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/metrician.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "English"
1
2
  require "metrician/configuration"
2
3
  require "metrician/reporter"
3
4
  require "metrician/jobs"
@@ -51,7 +51,7 @@ module Metrician
51
51
  if Middleware.error?
52
52
  # We to_i the status because in some circumstances it is a
53
53
  # Fixnum and some it is a string. Because why not.
54
- increment(:error, current_route) if status.to_i >= 500
54
+ increment(:error, current_route) if $ERROR_INFO || status.to_i >= 500
55
55
  end
56
56
  if Middleware.response_size?
57
57
  # Note that 30xs don't have content-length, so cached
@@ -143,7 +143,7 @@ module Metrician
143
143
  end
144
144
 
145
145
  def self.get_response_size(headers:, body:)
146
- return headers[HEADER_CONTENT_LENGTH] if headers[HEADER_CONTENT_LENGTH]
146
+ return headers[HEADER_CONTENT_LENGTH] if headers && headers[HEADER_CONTENT_LENGTH]
147
147
  body.first.length.to_s if body.respond_to?(:length) && body.length == 1
148
148
  end
149
149
 
@@ -1,5 +1,5 @@
1
1
  module Metrician
2
2
 
3
- VERSION = "0.0.3".freeze
3
+ VERSION = "0.0.4".freeze
4
4
 
5
5
  end
@@ -271,6 +271,28 @@ RSpec.describe Metrician do
271
271
  end
272
272
  end
273
273
 
274
+ describe "middleware exceptions" do
275
+ def app
276
+ require "metrician/middleware/request_timing"
277
+ require "metrician/middleware/application_timing"
278
+ Rack::Builder.app do
279
+ use Metrician::Middleware::RequestTiming
280
+ use Metrician::Middleware::ApplicationTiming
281
+ run lambda { |env| raise "boom" }
282
+ end
283
+ end
284
+
285
+ specify "middleware exceptions don't cause errors in response size tracking" do
286
+ Metrician.configuration[:request_timing][:response_size][:enabled] = true
287
+ agent.stub(:gauge)
288
+ agent.stub(:increment)
289
+
290
+ agent.should_receive(:gauge).with("web.request", anything)
291
+ agent.should_receive(:increment).with("web.error", 1)
292
+ lambda { get "/" }.should raise_error(RuntimeError, "boom")
293
+ end
294
+ end
295
+
274
296
  describe "queueing timing" do
275
297
  def app
276
298
  require "metrician/middleware/request_timing"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metrician
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Expected Behavior
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-20 00:00:00.000000000 Z
11
+ date: 2017-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: instrumental_agent
@@ -108,6 +108,7 @@ files:
108
108
  - ".rubocop_todo.yml"
109
109
  - ".ruby-version"
110
110
  - ".travis.yml"
111
+ - CHANGELOG.md
111
112
  - Gemfile
112
113
  - Gemfile.lock
113
114
  - METRICS.MD