rack-timing 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/README.md +2 -2
- data/lib/timing/reporter.rb +5 -5
- data/lib/timing/version.rb +1 -1
- metadata +2 -6
- data/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/timing.rb +0 -7
- data/timing/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6af39d6c6ef63525e3a883e9df2da43a0b90bd7f
|
4
|
+
data.tar.gz: ad684a83dffaec1050b4dc08129ee5c4e9c21415
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 321d7619fd414d80f944d507ff1bc74baa0457dbe1cb91d57edf3b79b0d05b9bab43620f424168a981d7ee8ad591d9ac5b1a0750c3a59d9bfc079cd1ca664b70
|
7
|
+
data.tar.gz: ffdfe08dc767c15749ffedbf9f32fa2090bcc727991ef9d01c98a593cd80d6e797fef32f2147269c259525fd4ee99e15f62d6ec99ff40306d58f93b1641eef12
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# rack-timing
|
2
2
|
|
3
|
-
Add this gem to a Rails app to get a log line like this for each request:
|
3
|
+
Ever wondered if some of your app's latency is coming from myserious middleware? Want to be able to tie requests to specific workers and threads while you're at it? Add this gem to a Rails app to get a log line like this for each request:
|
4
4
|
|
5
5
|
at=info thread_id=70351652783840 process_id=55394 request_id=013f9cc29c1e4c483435dbc15ab260f4 pre_request=0ms rack_in=202ms app=505ms rack_out=301ms
|
6
6
|
|
@@ -8,7 +8,7 @@ That includes:
|
|
8
8
|
|
9
9
|
* `thread_id`: For tracking requests across threads, (e.g. Puma)
|
10
10
|
* `process_id`: For tracking requests across workers (e.g. Puma or Unicorn)
|
11
|
-
* `request_id`: Correlate with
|
11
|
+
* `request_id`: Correlate with your app (or Heroku router) logs
|
12
12
|
* `pre_request`: Measure the time between `HTTP_X_REQUEST_START` and the start of your rack stack (similar to New Relic's 'reuqest queueing' metric)
|
13
13
|
* `rack_in`: The time in the rack stack before your app sees the request
|
14
14
|
* `app`: The time spent processing the request in your app
|
data/lib/timing/reporter.rb
CHANGED
@@ -7,9 +7,9 @@ module Rack
|
|
7
7
|
status, headers, response = @app.call(env)
|
8
8
|
|
9
9
|
measure_pre_request_time(env)
|
10
|
-
measure(
|
11
|
-
measure(
|
12
|
-
measure(
|
10
|
+
measure("measure#rack_in", :rack_in_start, :rack_in_end, env)
|
11
|
+
measure("measure#app", :rack_in_end, :rack_out_start, env)
|
12
|
+
measure("measure#rack_out", :rack_out_start, :rack_out_end, env)
|
13
13
|
|
14
14
|
@metrics = {thread_id: Thread.current.object_id, process_id: Process.pid, request_id: (env["action_dispatch.request_id"] || "")}.merge(@metrics)
|
15
15
|
notify(@metrics) if should_notify?
|
@@ -30,9 +30,9 @@ module Rack
|
|
30
30
|
|
31
31
|
def measure_pre_request_time(env)
|
32
32
|
if (request_start = (env["HTTP_X_REQUEST_START"] || 0).to_i) > 0
|
33
|
-
@metrics[
|
33
|
+
@metrics["measure#pre_request"] = (env["RACK_IN_START"] - request_start).to_s + "ms"
|
34
34
|
else
|
35
|
-
@metrics[
|
35
|
+
@metrics["measure#pre_request"] = "0ms"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
data/lib/timing/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-timing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Bailey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -45,13 +45,11 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .DS_Store
|
49
48
|
- .gitignore
|
50
49
|
- Gemfile
|
51
50
|
- LICENSE.txt
|
52
51
|
- README.md
|
53
52
|
- Rakefile
|
54
|
-
- lib/.DS_Store
|
55
53
|
- lib/rack-timing.rb
|
56
54
|
- lib/timing/base.rb
|
57
55
|
- lib/timing/end.rb
|
@@ -61,8 +59,6 @@ files:
|
|
61
59
|
- lib/timing/start.rb
|
62
60
|
- lib/timing/version.rb
|
63
61
|
- rack-timing.gemspec
|
64
|
-
- timing.rb
|
65
|
-
- timing/version.rb
|
66
62
|
homepage: ''
|
67
63
|
licenses:
|
68
64
|
- MIT
|
data/.DS_Store
DELETED
Binary file
|
data/lib/.DS_Store
DELETED
Binary file
|
data/timing.rb
DELETED