librato-rack 0.4.2 → 0.4.3
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.
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +3 -0
- data/lib/librato/rack.rb +4 -4
- data/lib/librato/rack/version.rb +1 -1
- data/test/apps/queue_wait.ru +3 -0
- data/test/integration/queue_wait_test.rb +10 -0
- metadata +4 -4
- metadata.gz.sig +1 -3
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
data/lib/librato/rack.rb
CHANGED
@@ -103,13 +103,13 @@ module Librato
|
|
103
103
|
def record_header_metrics(env)
|
104
104
|
queue_start = env['HTTP_X_REQUEST_START'] || env['HTTP_X_QUEUE_START']
|
105
105
|
if queue_start
|
106
|
-
queue_start = queue_start.to_s.
|
107
|
-
case queue_start.
|
106
|
+
queue_start = queue_start.to_s.sub('t=', '').sub('.', '')
|
107
|
+
case queue_start.length
|
108
108
|
when 16 # microseconds
|
109
|
-
wait = ((Time.now.to_f * 1000000).to_i - queue_start) / 1000.0
|
109
|
+
wait = ((Time.now.to_f * 1000000).to_i - queue_start.to_i) / 1000.0
|
110
110
|
tracker.timing 'rack.request.queue.time', wait
|
111
111
|
when 13 # milliseconds
|
112
|
-
wait = (Time.now.to_f * 1000).to_i - queue_start
|
112
|
+
wait = (Time.now.to_f * 1000).to_i - queue_start.to_i
|
113
113
|
tracker.timing 'rack.request.queue.time', wait
|
114
114
|
end
|
115
115
|
end
|
data/lib/librato/rack/version.rb
CHANGED
data/test/apps/queue_wait.ru
CHANGED
@@ -52,6 +52,16 @@ class QueueWaitTest < Minitest::Test
|
|
52
52
|
assert_in_delta 20, aggregate["rack.request.queue.time"][:sum], 4
|
53
53
|
end
|
54
54
|
|
55
|
+
def test_with_period
|
56
|
+
get '/with_period'
|
57
|
+
|
58
|
+
# give jruby a bit more time since it can be slow
|
59
|
+
delta = defined?(JRUBY_VERSION) ? 10 : 4
|
60
|
+
assert_equal 1, aggregate["rack.request.queue.time"][:count],
|
61
|
+
'should track total queue time'
|
62
|
+
assert_in_delta 25, aggregate["rack.request.queue.time"][:sum], delta
|
63
|
+
end
|
64
|
+
|
55
65
|
private
|
56
66
|
|
57
67
|
def aggregate
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librato-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
bktaNmhlblFBRjFDSDk2WmNxY0pIMTc5UzJ0SWlLRE04a2VlUklVT1BDM1dU
|
38
38
|
MGZhb2svMgpnQTJvemRyODUxYy9uQT09Ci0tLS0tRU5EIENFUlRJRklDQVRF
|
39
39
|
LS0tLS0K
|
40
|
-
date: 2013-
|
40
|
+
date: 2013-09-04 00:00:00.000000000 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: librato-metrics
|
@@ -131,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
segments:
|
133
133
|
- 0
|
134
|
-
hash:
|
134
|
+
hash: 2186855998038082473
|
135
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
136
|
none: false
|
137
137
|
requirements:
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
segments:
|
142
142
|
- 0
|
143
|
-
hash:
|
143
|
+
hash: 2186855998038082473
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
146
|
rubygems_version: 1.8.23
|
metadata.gz.sig
CHANGED