metrician 0.0.3 → 0.0.4
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 +5 -0
- data/gemfiles/Gemfile.4.2.sidekiq-4.lock +1 -1
- data/gemfiles/Gemfile.5.0.pg.lock +1 -1
- data/lib/metrician.rb +1 -0
- data/lib/metrician/middleware/request_timing.rb +2 -2
- data/lib/metrician/version.rb +1 -1
- data/spec/metrician_spec.rb +22 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a191afe161c4357de6c30940adf1dd405419aed1
|
4
|
+
data.tar.gz: a1154276f6c09cc3c4ca9bdffbcdfcf00044309a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3dde17cb1da6670d88fa0bf88d7833b28fdf979519e107b1ccb24b9986a359aa6b8b00e1cb62e4dd91e15052a3be8bbc53ab65313c036d7cb31e7a880c957a5
|
7
|
+
data.tar.gz: 95c30e45864e10cd236739eb5b1f5d1aaa74dc2e592db616cf5f803fe9ba3b2a0bc10f8ee16730ee5db4daf8b81d4f12b12d17717c30babd774d0c4420c484c0
|
data/CHANGELOG.md
ADDED
data/lib/metrician.rb
CHANGED
@@ -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
|
|
data/lib/metrician/version.rb
CHANGED
data/spec/metrician_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|