remnant 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/remnant/base.rb +12 -9
- data/lib/remnant/database.rb +2 -1
- data/lib/remnant/version.rb +1 -1
- metadata +2 -2
data/lib/remnant/base.rb
CHANGED
@@ -31,15 +31,18 @@ class Remnant
|
|
31
31
|
if ::Rails.env.production? || ::Rails.env.staging? || ::Rails.env.demo?
|
32
32
|
# only log if above sample rate
|
33
33
|
if @sample_counter > configuration.sample_rate
|
34
|
+
key_prefix = [
|
35
|
+
Remnant.configuration.tag,
|
36
|
+
Remnant.configuration.env,
|
37
|
+
extra_remnant_key
|
38
|
+
].compact.join('.')
|
39
|
+
|
34
40
|
Remnant::Discover.results.map do |remnant_key, ms|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
].compact.join('.')
|
41
|
-
|
42
|
-
Remnant.handler.timing(key, ms.to_i)
|
41
|
+
Remnant.handler.timing("#{key_prefix}.#{remnant_key}", ms.to_i)
|
42
|
+
end
|
43
|
+
|
44
|
+
if Remnant::Database.enabled?
|
45
|
+
Remnant.handler.timing("#{key_prefix}.db", Remnant::Database.queries.total_time.to_i)
|
43
46
|
end
|
44
47
|
|
45
48
|
@sample_counter = 0
|
@@ -69,7 +72,7 @@ class Remnant
|
|
69
72
|
|
70
73
|
if Remnant::Database.enabled?
|
71
74
|
Rails.logger.info ""
|
72
|
-
Rails.logger.info("#{color(false, true)}---- Database (%.2fms) -----#{color(true)}" %
|
75
|
+
Rails.logger.info("#{color(false, true)}---- Database (%.2fms) -----#{color(true)}" % Remnant::Database.queries.total_time)
|
73
76
|
if Remnant::Database.suppress?
|
74
77
|
Rails.logger.info "queries suppressed in development mode"
|
75
78
|
else
|
data/lib/remnant/database.rb
CHANGED
@@ -33,6 +33,7 @@ class Remnant
|
|
33
33
|
|
34
34
|
def reset
|
35
35
|
@suppress = true
|
36
|
+
@total_time = nil
|
36
37
|
Thread.current['remnant.database.queries'] = []
|
37
38
|
end
|
38
39
|
|
@@ -41,7 +42,7 @@ class Remnant
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def total_time
|
44
|
-
@total_time ||=
|
45
|
+
@total_time ||= queries.map(&:time).sum * 1000
|
45
46
|
end
|
46
47
|
end
|
47
48
|
extend ClassMethods
|
data/lib/remnant/version.rb
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.3.
|
4
|
+
version: 0.3.2
|
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-01-
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: statsd-ruby
|