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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5637ea6e69ef66219cfdfca6ab1445d78689a4b5
4
- data.tar.gz: 63b33b241cbd35c6e74ec1d35d9280f0615ca7f3
3
+ metadata.gz: d8f4d982355c0e4abc963aebf2443a2f99718bac
4
+ data.tar.gz: 77129393c5bc6d6fc3519019f1f9eec7917eaa5e
5
5
  SHA512:
6
- metadata.gz: 961b7c02093f6b6cf2437130de7da18273fdf0c16db685a1b7783988d5c341e9e43ad96aa705f79fed0303ca26b0ad4b8c0fb82abb426dd8b358202fcc57d6fe
7
- data.tar.gz: 4e0565a24b5d49f169bebd3dabc55b6b6301ceb3889a4fea01342322ad0cbadb1c3e6438512aadcb2f0a2c0f4b3ec24e102b1ed2bad19dc6720e2a56f4c53c43
6
+ metadata.gz: 4df8dfe02f00cf272b6f97fc20592409afac28aa429943c8772990182f2ea0d8638715148d51fe7675ef4fb71f1df83c729d6816fd836c693922d6d70e8967a2
7
+ data.tar.gz: 816ef033bc2041be2fe0b581838904353942c56bb547f9c44feb1dc2a6d63bfd0f634f0bc6621827b6eb523f2ebc7aed19437a314d80223e6474000fa494fed9
@@ -35,54 +35,63 @@ class Remnant
35
35
  @handler ||= Statsd.new(Remnant.configuration.hostname, Remnant.configuration.port_number)
36
36
  end
37
37
 
38
- def collect
39
- @sample_counter ||= 0
40
-
41
- extra_remnant_key = Remnant::Discover.results.delete(:extra_remnant_key)
42
-
43
- if ::Rails.env.development? || ::Rails.env.test?
44
- # always log in development mode
45
- Rails.logger.info "#{color(false, true)}--------------Remnants Discovered--------------#{color(true)}"
46
-
47
- Remnant::Discover.results.map do |remnant_key, ms|
48
- key = [
49
- extra_remnant_key,
50
- remnant_key
51
- ].compact.join('.')
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
- Rails.logger.info "#{Remnant.color}#{ms.to_i}ms#{Remnant.color(true)}\t#{key}"
54
- end
55
- Rails.logger.info "#{Remnant.color}#{Remnant::GC.time.to_i}ms (#{Remnant::GC.collections} collections)#{Remnant.color(true)}\tGC"
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
- # filters
62
+ # template captures
63
+ if Remnant::Template.enabled?
58
64
  Rails.logger.info ""
59
- Rails.logger.info("#{color(false, true)}----- Filters (%.2fms) -----#{color(true)}" % Remnant::Filters.total_time)
60
- Remnant::Filters.filters.map do |filter|
61
- Rails.logger.info("#{color}%.2fms#{color(true)}\t#{filter[:name]} (#{filter[:type]})" % filter[:ms])
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
- # template captures
65
- if Remnant::Template.enabled?
66
- Rails.logger.info ""
67
- Rails.logger.info "#{color(false, true)}----- Templates -----#{color(true)}"
68
- Remnant::Template.trace.root.children.map do |rendering|
69
- Remnant::Template.trace.log(Rails.logger, rendering)
70
- end
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
- # sql captures
74
- Rails.logger.info ""
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
- Rails.logger.info "#{color(false, true)}-----------------------------------------------#{color(true)}"
85
- else
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
@@ -1,3 +1,3 @@
1
1
  class Remnant
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
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
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-03-05 00:00:00.000000000 Z
11
+ date: 2014-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: statsd-ruby