leafy-health 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +34 -4
  3. data/.travis.yml +19 -0
  4. data/CHANGELOG.md +7 -0
  5. data/Gemfile +1 -5
  6. data/README.md +10 -116
  7. data/examples/datadog/.gitignore +2 -0
  8. data/examples/datadog/Gemfile +12 -0
  9. data/examples/datadog/Mavenfile +22 -0
  10. data/examples/datadog/README.md +16 -0
  11. data/examples/datadog/lib/java_gauge.rb +20 -0
  12. data/examples/datadog/lib/metrics.rb +18 -0
  13. data/examples/datadog/lib/ruby_gauge.rb +19 -0
  14. data/examples/hellowarld/.gitignore +3 -0
  15. data/examples/hellowarld/Gemfile +15 -0
  16. data/examples/hellowarld/Mavenfile +162 -0
  17. data/examples/hellowarld/README.md +44 -0
  18. data/examples/hellowarld/Rakefile +13 -0
  19. data/examples/hellowarld/WEB-INF/web.xml +31 -0
  20. data/examples/hellowarld/app/hellowarld.rb +55 -0
  21. data/examples/hellowarld/app/views/person.erb +52 -0
  22. data/examples/hellowarld/config.ru +12 -0
  23. data/leafy-complete.gemspec +22 -0
  24. data/leafy-health/.gitignore +4 -0
  25. data/leafy-health/Gemfile +7 -0
  26. data/leafy-health/LICENSE +22 -0
  27. data/leafy-health/README.md +123 -0
  28. data/{Rakefile → leafy-health/Rakefile} +0 -0
  29. data/{leafy-health.gemspec → leafy-health/leafy-health.gemspec} +0 -0
  30. data/{lib → leafy-health/lib}/leafy-health.rb +0 -0
  31. data/{lib → leafy-health/lib}/leafy-health_jars.rb +0 -0
  32. data/{lib → leafy-health/lib}/leafy/health.rb +0 -0
  33. data/{lib → leafy-health/lib}/leafy/health/health_check.rb +0 -0
  34. data/{lib → leafy-health/lib}/leafy/health/registry.rb +0 -0
  35. data/{lib → leafy-health/lib}/leafy/health/version.rb +1 -1
  36. data/{spec → leafy-health/spec}/registry_spec.rb +0 -0
  37. data/{spec → leafy-health/spec}/setup.rb +0 -0
  38. data/leafy-logger/.gitignore +5 -0
  39. data/leafy-logger/Gemfile +9 -0
  40. data/leafy-logger/LICENSE +22 -0
  41. data/leafy-logger/README.md +174 -0
  42. data/leafy-logger/Rakefile +14 -0
  43. data/leafy-logger/leafy-logger.gemspec +32 -0
  44. data/leafy-logger/lib/leafy-logger.rb +1 -0
  45. data/leafy-logger/lib/leafy-logger_jars.rb +33 -0
  46. data/leafy-logger/lib/leafy/logger.rb +1 -0
  47. data/leafy-logger/lib/leafy/logger/appender_factories.rb +89 -0
  48. data/leafy-logger/lib/leafy/logger/factory.rb +141 -0
  49. data/leafy-logger/lib/leafy/logger/version.rb +6 -0
  50. data/leafy-logger/spec/appender_factories_spec.rb +147 -0
  51. data/leafy-logger/spec/factory_spec.rb +176 -0
  52. data/leafy-logger/spec/logging.yml +16 -0
  53. data/leafy-logger/spec/setup.rb +2 -0
  54. data/leafy-metrics/.gitignore +5 -0
  55. data/leafy-metrics/Gemfile +7 -0
  56. data/leafy-metrics/LICENSE +22 -0
  57. data/leafy-metrics/README.md +221 -0
  58. data/leafy-metrics/Rakefile +14 -0
  59. data/leafy-metrics/leafy-metrics.gemspec +29 -0
  60. data/leafy-metrics/lib/leafy-metrics.rb +2 -0
  61. data/leafy-metrics/lib/leafy-metrics_jars.rb +5 -0
  62. data/leafy-metrics/lib/leafy/metrics.rb +2 -0
  63. data/leafy-metrics/lib/leafy/metrics/console_reporter.rb +32 -0
  64. data/leafy-metrics/lib/leafy/metrics/csv_reporter.rb +26 -0
  65. data/leafy-metrics/lib/leafy/metrics/graphite/graphite.rb +28 -0
  66. data/leafy-metrics/lib/leafy/metrics/graphite/graphite_reporter.rb +43 -0
  67. data/leafy-metrics/lib/leafy/metrics/registry.rb +108 -0
  68. data/leafy-metrics/lib/leafy/metrics/reporter.rb +51 -0
  69. data/leafy-metrics/lib/leafy/metrics/version.rb +6 -0
  70. data/leafy-metrics/spec/console_reporter_spec.rb +72 -0
  71. data/leafy-metrics/spec/csv_reporter_spec.rb +75 -0
  72. data/leafy-metrics/spec/graphite_reporter_spec.rb +72 -0
  73. data/leafy-metrics/spec/graphite_spec.rb +23 -0
  74. data/leafy-metrics/spec/registry_spec.rb +106 -0
  75. data/leafy-metrics/spec/setup.rb +10 -0
  76. data/leafy-rack/.gitignore +4 -0
  77. data/leafy-rack/Gemfile +10 -0
  78. data/leafy-rack/LICENSE +22 -0
  79. data/leafy-rack/README.md +155 -0
  80. data/leafy-rack/Rakefile +14 -0
  81. data/leafy-rack/leafy-rack.gemspec +29 -0
  82. data/leafy-rack/lib/leafy-rack.rb +1 -0
  83. data/leafy-rack/lib/leafy-rack_jars.rb +10 -0
  84. data/leafy-rack/lib/leafy/instrumented/basic_instrumented.rb +38 -0
  85. data/leafy-rack/lib/leafy/instrumented/instrumented.rb +27 -0
  86. data/leafy-rack/lib/leafy/json/health_writer.rb +15 -0
  87. data/leafy-rack/lib/leafy/json/json_writer.rb +33 -0
  88. data/leafy-rack/lib/leafy/json/metrics_writer.rb +22 -0
  89. data/leafy-rack/lib/leafy/rack.rb +1 -0
  90. data/leafy-rack/lib/leafy/rack/admin.rb +73 -0
  91. data/leafy-rack/lib/leafy/rack/health.rb +43 -0
  92. data/leafy-rack/lib/leafy/rack/instrumented.rb +20 -0
  93. data/leafy-rack/lib/leafy/rack/metrics.rb +35 -0
  94. data/leafy-rack/lib/leafy/rack/ping.rb +29 -0
  95. data/leafy-rack/lib/leafy/rack/thread_dump.rb +56 -0
  96. data/leafy-rack/lib/leafy/rack/version.rb +6 -0
  97. data/leafy-rack/spec/admin_rack_spec.rb +141 -0
  98. data/leafy-rack/spec/basic_instrumented_spec.rb +31 -0
  99. data/leafy-rack/spec/health_rack_spec.rb +136 -0
  100. data/leafy-rack/spec/health_writer_spec.rb +47 -0
  101. data/leafy-rack/spec/instrumented_rack_spec.rb +37 -0
  102. data/leafy-rack/spec/instrumented_spec.rb +36 -0
  103. data/leafy-rack/spec/metrics_rack_spec.rb +110 -0
  104. data/leafy-rack/spec/metrics_writer_spec.rb +55 -0
  105. data/leafy-rack/spec/ping_rack_spec.rb +63 -0
  106. data/leafy-rack/spec/setup.rb +3 -0
  107. data/leafy-rack/spec/thread_dump_spec.rb +59 -0
  108. metadata +106 -12
@@ -0,0 +1,63 @@
1
+ require_relative 'setup'
2
+
3
+ require 'leafy/rack/ping'
4
+ require 'yaml'
5
+ require 'json'
6
+
7
+ describe Leafy::Rack::Ping do
8
+
9
+ subject { Leafy::Rack::Ping }
10
+
11
+ let( :expected_headers ) do
12
+ { 'Content-Type' => 'text/plain',
13
+ 'Cache-Control' => 'must-revalidate,no-cache,no-store' }
14
+ end
15
+
16
+ let( :result ){ [ 200, nil, [] ] }
17
+ let( :app ) do
18
+ Proc.new() { result }
19
+ end
20
+
21
+ it 'has response' do
22
+ status, headers, body = subject.response
23
+ expect( status ).to eq 200
24
+ expect( headers.to_yaml).to eq expected_headers.to_yaml
25
+ expect( body ).to eq ['pong']
26
+ end
27
+
28
+ describe 'default path' do
29
+ subject { Leafy::Rack::Ping.new( app ) }
30
+
31
+ it 'passes request if not matches the given path' do
32
+ env = { 'PATH_INFO'=> '/something' }
33
+ expect( subject.call( env ) ).to eq result
34
+ end
35
+
36
+ it 'pongs on ping path' do
37
+ env = { 'PATH_INFO'=> '/ping' }
38
+ status, headers, body = subject.call( env )
39
+ expect( status ).to eq 200
40
+ expect( headers.to_yaml).to eq expected_headers.to_yaml
41
+ expect( body ).to eq ['pong']
42
+ end
43
+ end
44
+
45
+ describe 'custom path' do
46
+ subject { Leafy::Rack::Ping.new( app, '/custom' ) }
47
+
48
+ it 'passes request if not matches the given path' do
49
+ env = { 'PATH_INFO'=> '/something' }
50
+ expect( subject.call( env ) ).to eq result
51
+ env = { 'PATH_INFO'=> '/ping' }
52
+ expect( subject.call( env ) ).to eq result
53
+ end
54
+
55
+ it 'pongs on ping path' do
56
+ env = { 'PATH_INFO'=> '/custom' }
57
+ status, headers, body = subject.call( env )
58
+ expect( status ).to eq 200
59
+ expect( headers.to_yaml).to eq expected_headers.to_yaml
60
+ expect( body ).to eq ['pong']
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH.unshift File.expand_path( '../../lib', __FILE__ )
2
+ $LOAD_PATH.unshift File.expand_path( '../../../leafy-health/lib', __FILE__ )
3
+ $LOAD_PATH.unshift File.expand_path( '../../../leafy-metrics/lib', __FILE__ )
@@ -0,0 +1,59 @@
1
+ require_relative 'setup'
2
+
3
+ require 'leafy/rack/thread_dump'
4
+ require 'yaml'
5
+ require 'json'
6
+
7
+ describe Leafy::Rack::ThreadDump do
8
+
9
+ subject { Leafy::Rack::ThreadDump }
10
+
11
+ let( :expected_headers ) do
12
+ { 'Content-Type' => 'text/plain',
13
+ 'Cache-Control' => 'must-revalidate,no-cache,no-store' }
14
+ end
15
+
16
+ let( :result ){ [ 200, nil, [] ] }
17
+ let( :app ) do
18
+ Proc.new() { result }
19
+ end
20
+
21
+ it 'has response' do
22
+ status, headers, body = subject.response
23
+ expect( status ).to eq 200
24
+ expect( headers.to_yaml).to eq expected_headers.to_yaml
25
+ expect( body.join.count( "\n" ) ).to be > 100
26
+ end
27
+
28
+ describe 'default path' do
29
+ it 'passes request if not matches the given path' do
30
+ env = { 'PATH_INFO'=> '/something' }
31
+ expect( subject.new( app ).call( env ) ).to eq result
32
+ end
33
+
34
+ it 'thread dump on threads path' do
35
+ env = { 'PATH_INFO'=> '/threads' }
36
+ status, headers, body = subject.new( app ).call( env )
37
+ expect( status ).to eq 200
38
+ expect( headers.to_yaml).to eq expected_headers.to_yaml
39
+ expect( body.join.count( "\n" ) ).to be > 100
40
+ end
41
+ end
42
+
43
+ describe 'custom path' do
44
+ it 'passes request if not matches the given path' do
45
+ env = { 'PATH_INFO'=> '/something' }
46
+ expect( subject.new( app, '/custom' ).call( env ) ).to eq result
47
+ env = { 'PATH_INFO'=> '/threads' }
48
+ expect( subject.new( app, '/custom' ).call( env ) ).to eq result
49
+ end
50
+
51
+ it 'thread dump on threads path' do
52
+ env = { 'PATH_INFO'=> '/custom' }
53
+ status, headers, body = subject.new( app, '/custom' ).call( env )
54
+ expect( status ).to eq 200
55
+ expect( headers.to_yaml).to eq expected_headers.to_yaml
56
+ expect( body.join.count( "\n" ) ).to be > 100
57
+ end
58
+ end
59
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leafy-health
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian meier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-22 00:00:00.000000000 Z
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jar-dependencies
@@ -74,19 +74,113 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
+ - ".travis.yml"
78
+ - CHANGELOG.md
77
79
  - Gemfile
78
80
  - LICENSE
79
81
  - README.md
80
- - Rakefile
81
- - leafy-health.gemspec
82
- - lib/leafy-health.rb
83
- - lib/leafy-health_jars.rb
84
- - lib/leafy/health.rb
85
- - lib/leafy/health/health_check.rb
86
- - lib/leafy/health/registry.rb
87
- - lib/leafy/health/version.rb
88
- - spec/registry_spec.rb
89
- - spec/setup.rb
82
+ - examples/datadog/.gitignore
83
+ - examples/datadog/Gemfile
84
+ - examples/datadog/Mavenfile
85
+ - examples/datadog/README.md
86
+ - examples/datadog/lib/java_gauge.rb
87
+ - examples/datadog/lib/metrics.rb
88
+ - examples/datadog/lib/ruby_gauge.rb
89
+ - examples/hellowarld/.gitignore
90
+ - examples/hellowarld/Gemfile
91
+ - examples/hellowarld/Gemfile.lock
92
+ - examples/hellowarld/Mavenfile
93
+ - examples/hellowarld/README.md
94
+ - examples/hellowarld/Rakefile
95
+ - examples/hellowarld/WEB-INF/web.xml
96
+ - examples/hellowarld/app/hellowarld.rb
97
+ - examples/hellowarld/app/views/person.erb
98
+ - examples/hellowarld/config.ru
99
+ - leafy-complete.gemspec
100
+ - leafy-health/.gitignore
101
+ - leafy-health/Gemfile
102
+ - leafy-health/LICENSE
103
+ - leafy-health/README.md
104
+ - leafy-health/Rakefile
105
+ - leafy-health/leafy-health.gemspec
106
+ - leafy-health/lib/leafy-health.rb
107
+ - leafy-health/lib/leafy-health_jars.rb
108
+ - leafy-health/lib/leafy/health.rb
109
+ - leafy-health/lib/leafy/health/health_check.rb
110
+ - leafy-health/lib/leafy/health/registry.rb
111
+ - leafy-health/lib/leafy/health/version.rb
112
+ - leafy-health/spec/registry_spec.rb
113
+ - leafy-health/spec/setup.rb
114
+ - leafy-logger/.gitignore
115
+ - leafy-logger/Gemfile
116
+ - leafy-logger/LICENSE
117
+ - leafy-logger/README.md
118
+ - leafy-logger/Rakefile
119
+ - leafy-logger/leafy-logger.gemspec
120
+ - leafy-logger/lib/leafy-logger.rb
121
+ - leafy-logger/lib/leafy-logger_jars.rb
122
+ - leafy-logger/lib/leafy/logger.rb
123
+ - leafy-logger/lib/leafy/logger/appender_factories.rb
124
+ - leafy-logger/lib/leafy/logger/factory.rb
125
+ - leafy-logger/lib/leafy/logger/version.rb
126
+ - leafy-logger/spec/appender_factories_spec.rb
127
+ - leafy-logger/spec/factory_spec.rb
128
+ - leafy-logger/spec/logging.yml
129
+ - leafy-logger/spec/setup.rb
130
+ - leafy-metrics/.gitignore
131
+ - leafy-metrics/Gemfile
132
+ - leafy-metrics/LICENSE
133
+ - leafy-metrics/README.md
134
+ - leafy-metrics/Rakefile
135
+ - leafy-metrics/leafy-metrics.gemspec
136
+ - leafy-metrics/lib/leafy-metrics.rb
137
+ - leafy-metrics/lib/leafy-metrics_jars.rb
138
+ - leafy-metrics/lib/leafy/metrics.rb
139
+ - leafy-metrics/lib/leafy/metrics/console_reporter.rb
140
+ - leafy-metrics/lib/leafy/metrics/csv_reporter.rb
141
+ - leafy-metrics/lib/leafy/metrics/graphite/graphite.rb
142
+ - leafy-metrics/lib/leafy/metrics/graphite/graphite_reporter.rb
143
+ - leafy-metrics/lib/leafy/metrics/registry.rb
144
+ - leafy-metrics/lib/leafy/metrics/reporter.rb
145
+ - leafy-metrics/lib/leafy/metrics/version.rb
146
+ - leafy-metrics/spec/console_reporter_spec.rb
147
+ - leafy-metrics/spec/csv_reporter_spec.rb
148
+ - leafy-metrics/spec/graphite_reporter_spec.rb
149
+ - leafy-metrics/spec/graphite_spec.rb
150
+ - leafy-metrics/spec/registry_spec.rb
151
+ - leafy-metrics/spec/setup.rb
152
+ - leafy-rack/.gitignore
153
+ - leafy-rack/Gemfile
154
+ - leafy-rack/LICENSE
155
+ - leafy-rack/README.md
156
+ - leafy-rack/Rakefile
157
+ - leafy-rack/leafy-rack.gemspec
158
+ - leafy-rack/lib/leafy-rack.rb
159
+ - leafy-rack/lib/leafy-rack_jars.rb
160
+ - leafy-rack/lib/leafy/instrumented/basic_instrumented.rb
161
+ - leafy-rack/lib/leafy/instrumented/instrumented.rb
162
+ - leafy-rack/lib/leafy/json/health_writer.rb
163
+ - leafy-rack/lib/leafy/json/json_writer.rb
164
+ - leafy-rack/lib/leafy/json/metrics_writer.rb
165
+ - leafy-rack/lib/leafy/rack.rb
166
+ - leafy-rack/lib/leafy/rack/admin.rb
167
+ - leafy-rack/lib/leafy/rack/health.rb
168
+ - leafy-rack/lib/leafy/rack/instrumented.rb
169
+ - leafy-rack/lib/leafy/rack/metrics.rb
170
+ - leafy-rack/lib/leafy/rack/ping.rb
171
+ - leafy-rack/lib/leafy/rack/thread_dump.rb
172
+ - leafy-rack/lib/leafy/rack/version.rb
173
+ - leafy-rack/spec/admin_rack_spec.rb
174
+ - leafy-rack/spec/basic_instrumented_spec.rb
175
+ - leafy-rack/spec/health_rack_spec.rb
176
+ - leafy-rack/spec/health_writer_spec.rb
177
+ - leafy-rack/spec/instrumented_rack_spec.rb
178
+ - leafy-rack/spec/instrumented_spec.rb
179
+ - leafy-rack/spec/metrics_rack_spec.rb
180
+ - leafy-rack/spec/metrics_writer_spec.rb
181
+ - leafy-rack/spec/ping_rack_spec.rb
182
+ - leafy-rack/spec/setup.rb
183
+ - leafy-rack/spec/thread_dump_spec.rb
90
184
  homepage: https://github.com/lookout/leafy
91
185
  licenses:
92
186
  - MIT