remnant 0.9.2 → 0.9.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/README.md +4 -6
- data/lib/remnant/base.rb +22 -22
- data/lib/remnant/version.rb +1 -1
- data/remnant.gemspec +1 -0
- metadata +4 -3
data/README.md
CHANGED
@@ -2,7 +2,8 @@ Remnant hooks into your Rails and discovers your hidden statistics.
|
|
2
2
|
|
3
3
|
##### Supports
|
4
4
|
|
5
|
-
* Rails 2.3.x
|
5
|
+
* Rails 2.3.x with REE for GC (v0.4.3)
|
6
|
+
* Rails 3.2.x with 1.9.3 and 2.0.0 for GC (v0.9.x)
|
6
7
|
|
7
8
|
#### What Remnant Captures
|
8
9
|
* request - time it takes for a request to be served
|
@@ -20,12 +21,9 @@ request, action, view, gc, db, filters
|
|
20
21
|
|
21
22
|
#### Install
|
22
23
|
|
23
|
-
|
24
|
-
$ [sudo] gem install remnant
|
25
|
-
```
|
24
|
+
Using bundler:
|
26
25
|
|
27
26
|
```ruby
|
28
|
-
# For Rails 2.3.x
|
29
27
|
gem 'remnant'
|
30
28
|
```
|
31
29
|
|
@@ -67,7 +65,7 @@ before_filter {|c| Remnant::Template.enable! }
|
|
67
65
|
```
|
68
66
|
|
69
67
|
If you want to capture the sql query times you should enable Database
|
70
|
-
capturing in a before filter (or before
|
68
|
+
capturing in a before filter (or before any database calls take place)
|
71
69
|
```ruby
|
72
70
|
before_filter {|c| Remnant::Database.enable! }
|
73
71
|
```
|
data/lib/remnant/base.rb
CHANGED
@@ -40,28 +40,7 @@ class Remnant
|
|
40
40
|
|
41
41
|
extra_remnant_key = Remnant::Discover.results.delete(:extra_remnant_key)
|
42
42
|
|
43
|
-
if ::Rails.env.
|
44
|
-
# only log if above sample rate
|
45
|
-
if @sample_counter > configuration.sample_rate
|
46
|
-
key_prefix = [
|
47
|
-
Remnant.configuration.tag,
|
48
|
-
Remnant.configuration.env,
|
49
|
-
extra_remnant_key
|
50
|
-
].compact.join('.')
|
51
|
-
|
52
|
-
Remnant::Discover.results.map do |remnant_key, ms|
|
53
|
-
Remnant.handler.timing("#{key_prefix}.#{remnant_key}", ms.to_i)
|
54
|
-
end
|
55
|
-
|
56
|
-
Remnant.handler.timing("#{key_prefix}.gc", Remnant::GC.time.to_i)
|
57
|
-
Remnant.handler.timing("#{key_prefix}.db", Remnant::Database.total_time.to_i)
|
58
|
-
Remnant.handler.timing("#{key_prefix}.filters", Remnant::Filters.total_time.to_i)
|
59
|
-
|
60
|
-
@sample_counter = 0
|
61
|
-
else
|
62
|
-
@sample_counter += 1
|
63
|
-
end
|
64
|
-
else
|
43
|
+
if ::Rails.env.development? || ::Rails.env.test?
|
65
44
|
# always log in development mode
|
66
45
|
Rails.logger.info "#{color(false, true)}--------------Remnants Discovered--------------#{color(true)}"
|
67
46
|
|
@@ -103,6 +82,27 @@ class Remnant
|
|
103
82
|
end
|
104
83
|
|
105
84
|
Rails.logger.info "#{color(false, true)}-----------------------------------------------#{color(true)}"
|
85
|
+
else
|
86
|
+
# only log if above sample rate
|
87
|
+
if @sample_counter > configuration.sample_rate
|
88
|
+
key_prefix = [
|
89
|
+
Remnant.configuration.tag,
|
90
|
+
Remnant.configuration.env,
|
91
|
+
extra_remnant_key
|
92
|
+
].compact.join('.')
|
93
|
+
|
94
|
+
Remnant::Discover.results.map do |remnant_key, ms|
|
95
|
+
Remnant.handler.timing("#{key_prefix}.#{remnant_key}", ms.to_i)
|
96
|
+
end
|
97
|
+
|
98
|
+
Remnant.handler.timing("#{key_prefix}.gc", Remnant::GC.time.to_i)
|
99
|
+
Remnant.handler.timing("#{key_prefix}.db", Remnant::Database.total_time.to_i)
|
100
|
+
Remnant.handler.timing("#{key_prefix}.filters", Remnant::Filters.total_time.to_i)
|
101
|
+
|
102
|
+
@sample_counter = 0
|
103
|
+
else
|
104
|
+
@sample_counter += 1
|
105
|
+
end
|
106
106
|
end
|
107
107
|
|
108
108
|
# run hook if given
|
data/lib/remnant/version.rb
CHANGED
data/remnant.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remnant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: statsd-ruby
|
@@ -163,7 +163,8 @@ files:
|
|
163
163
|
- spec/spec_helper.rb
|
164
164
|
- spec/support/rr.rb
|
165
165
|
homepage: https://github.com/asceth/remnant
|
166
|
-
licenses:
|
166
|
+
licenses:
|
167
|
+
- MIT
|
167
168
|
post_install_message:
|
168
169
|
rdoc_options: []
|
169
170
|
require_paths:
|