remnant 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/remnant/base.rb +50 -41
- data/lib/remnant/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f4d982355c0e4abc963aebf2443a2f99718bac
|
4
|
+
data.tar.gz: 77129393c5bc6d6fc3519019f1f9eec7917eaa5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4df8dfe02f00cf272b6f97fc20592409afac28aa429943c8772990182f2ea0d8638715148d51fe7675ef4fb71f1df83c729d6816fd836c693922d6d70e8967a2
|
7
|
+
data.tar.gz: 816ef033bc2041be2fe0b581838904353942c56bb547f9c44feb1dc2a6d63bfd0f634f0bc6621827b6eb523f2ebc7aed19437a314d80223e6474000fa494fed9
|
data/lib/remnant/base.rb
CHANGED
@@ -35,54 +35,63 @@ class Remnant
|
|
35
35
|
@handler ||= Statsd.new(Remnant.configuration.hostname, Remnant.configuration.port_number)
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
38
|
+
#
|
39
|
+
# Log everything to Rails logger for output
|
40
|
+
#
|
41
|
+
def output
|
42
|
+
# always log in development mode
|
43
|
+
Rails.logger.info "#{color(false, true)}--------------Remnants Discovered--------------#{color(true)}"
|
44
|
+
|
45
|
+
Remnant::Discover.results.map do |remnant_key, ms|
|
46
|
+
key = [
|
47
|
+
extra_remnant_key,
|
48
|
+
remnant_key
|
49
|
+
].compact.join('.')
|
50
|
+
|
51
|
+
Rails.logger.info "#{Remnant.color}#{ms.to_i}ms#{Remnant.color(true)}\t#{key}"
|
52
|
+
end
|
53
|
+
Rails.logger.info "#{Remnant.color}#{Remnant::GC.time.to_i}ms (#{Remnant::GC.collections} collections)#{Remnant.color(true)}\tGC"
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
|
55
|
+
# filters
|
56
|
+
Rails.logger.info ""
|
57
|
+
Rails.logger.info("#{color(false, true)}----- Filters (%.2fms) -----#{color(true)}" % Remnant::Filters.total_time)
|
58
|
+
Remnant::Filters.filters.map do |filter|
|
59
|
+
Rails.logger.info("#{color}%.2fms#{color(true)}\t#{filter[:name]} (#{filter[:type]})" % filter[:ms])
|
60
|
+
end
|
56
61
|
|
57
|
-
|
62
|
+
# template captures
|
63
|
+
if Remnant::Template.enabled?
|
58
64
|
Rails.logger.info ""
|
59
|
-
Rails.logger.info
|
60
|
-
Remnant::
|
61
|
-
Rails.logger
|
65
|
+
Rails.logger.info "#{color(false, true)}----- Templates -----#{color(true)}"
|
66
|
+
Remnant::Template.trace.root.children.map do |rendering|
|
67
|
+
Remnant::Template.trace.log(Rails.logger, rendering)
|
62
68
|
end
|
69
|
+
end
|
63
70
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
+
# sql captures
|
72
|
+
Rails.logger.info ""
|
73
|
+
Rails.logger.info("#{color(false, true)}---- Database (%.2fms) -----#{color(true)}" % Remnant::Database.total_time)
|
74
|
+
if Remnant::Database.suppress?
|
75
|
+
Rails.logger.info "queries suppressed in development mode"
|
76
|
+
else
|
77
|
+
Remnant::Database.queries.map do |query|
|
78
|
+
Rails.logger.info("#{color}%.2fms#{color(true)}\t#{query.sql}" % (query.time * 1000))
|
71
79
|
end
|
80
|
+
end
|
72
81
|
|
73
|
-
|
74
|
-
|
75
|
-
Rails.logger.info("#{color(false, true)}---- Database (%.2fms) -----#{color(true)}" % Remnant::Database.total_time)
|
76
|
-
if Remnant::Database.suppress?
|
77
|
-
Rails.logger.info "queries suppressed in development mode"
|
78
|
-
else
|
79
|
-
Remnant::Database.queries.map do |query|
|
80
|
-
Rails.logger.info("#{color}%.2fms#{color(true)}\t#{query.sql}" % (query.time * 1000))
|
81
|
-
end
|
82
|
-
end
|
82
|
+
Rails.logger.info "#{color(false, true)}-----------------------------------------------#{color(true)}"
|
83
|
+
end
|
83
84
|
|
84
|
-
|
85
|
-
|
85
|
+
#
|
86
|
+
# Collect data, report statsd timings, run hook
|
87
|
+
#
|
88
|
+
def collect
|
89
|
+
@sample_counter ||= 0
|
90
|
+
|
91
|
+
extra_remnant_key = Remnant::Discover.results.delete(:extra_remnant_key)
|
92
|
+
|
93
|
+
# don't send timings in development or test environments
|
94
|
+
unless ::Rails.env.development? || ::Rails.env.test?
|
86
95
|
# only log if above sample rate
|
87
96
|
if @sample_counter > configuration.sample_rate
|
88
97
|
key_prefix = [
|
@@ -105,7 +114,7 @@ class Remnant
|
|
105
114
|
end
|
106
115
|
end
|
107
116
|
|
108
|
-
# run hook if given
|
117
|
+
# run hook if given for all environments
|
109
118
|
unless Remnant.configuration.custom_hook.nil?
|
110
119
|
Remnant.configuration.custom_hook.call(Remnant::Discover.results)
|
111
120
|
end
|
data/lib/remnant/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John 'asceth' Long
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: statsd-ruby
|