leafy-rack 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +10 -0
- data/LICENSE +22 -0
- data/README.md +155 -0
- data/Rakefile +14 -0
- data/leafy-rack.gemspec +29 -0
- data/lib/leafy/instrumented/basic_instrumented.rb +38 -0
- data/lib/leafy/instrumented/instrumented.rb +27 -0
- data/lib/leafy/json/health_writer.rb +15 -0
- data/lib/leafy/json/json_writer.rb +33 -0
- data/lib/leafy/json/metrics_writer.rb +22 -0
- data/lib/leafy/rack/admin.rb +72 -0
- data/lib/leafy/rack/health.rb +36 -0
- data/lib/leafy/rack/instrumented.rb +20 -0
- data/lib/leafy/rack/metrics.rb +35 -0
- data/lib/leafy/rack/ping.rb +29 -0
- data/lib/leafy/rack/thread_dump.rb +56 -0
- data/lib/leafy/rack/version.rb +6 -0
- data/lib/leafy/rack.rb +1 -0
- data/lib/leafy-rack.rb +1 -0
- data/lib/leafy-rack_jars.rb +10 -0
- data/spec/admin_rack_spec.rb +141 -0
- data/spec/basic_instrumented_spec.rb +31 -0
- data/spec/health_rack_spec.rb +136 -0
- data/spec/health_writer_spec.rb +47 -0
- data/spec/instrumented_rack_spec.rb +37 -0
- data/spec/instrumented_spec.rb +36 -0
- data/spec/metrics_rack_spec.rb +110 -0
- data/spec/metrics_writer_spec.rb +55 -0
- data/spec/ping_rack_spec.rb +63 -0
- data/spec/setup.rb +3 -0
- data/spec/thread_dump_spec.rb +59 -0
- metadata +163 -0
@@ -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
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: leafy-rack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- christian meier
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jar-dependencies
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.8
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: leafy-metrics
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: leafy-health
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.1.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.1.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.8.7
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.8.7
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.2'
|
97
|
+
description: rack middleware to expose leafy metrics/health data as well a ping rack
|
98
|
+
and a thread-dump rack
|
99
|
+
email:
|
100
|
+
- christian.meier@lookout.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- leafy-rack.gemspec
|
111
|
+
- lib/leafy-rack.rb
|
112
|
+
- lib/leafy-rack_jars.rb
|
113
|
+
- lib/leafy/instrumented/basic_instrumented.rb
|
114
|
+
- lib/leafy/instrumented/instrumented.rb
|
115
|
+
- lib/leafy/json/health_writer.rb
|
116
|
+
- lib/leafy/json/json_writer.rb
|
117
|
+
- lib/leafy/json/metrics_writer.rb
|
118
|
+
- lib/leafy/rack.rb
|
119
|
+
- lib/leafy/rack/admin.rb
|
120
|
+
- lib/leafy/rack/health.rb
|
121
|
+
- lib/leafy/rack/instrumented.rb
|
122
|
+
- lib/leafy/rack/metrics.rb
|
123
|
+
- lib/leafy/rack/ping.rb
|
124
|
+
- lib/leafy/rack/thread_dump.rb
|
125
|
+
- lib/leafy/rack/version.rb
|
126
|
+
- spec/admin_rack_spec.rb
|
127
|
+
- spec/basic_instrumented_spec.rb
|
128
|
+
- spec/health_rack_spec.rb
|
129
|
+
- spec/health_writer_spec.rb
|
130
|
+
- spec/instrumented_rack_spec.rb
|
131
|
+
- spec/instrumented_spec.rb
|
132
|
+
- spec/metrics_rack_spec.rb
|
133
|
+
- spec/metrics_writer_spec.rb
|
134
|
+
- spec/ping_rack_spec.rb
|
135
|
+
- spec/setup.rb
|
136
|
+
- spec/thread_dump_spec.rb
|
137
|
+
homepage: https://github.com/lookout/leafy
|
138
|
+
licenses:
|
139
|
+
- MIT
|
140
|
+
metadata: {}
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
requirements:
|
156
|
+
- jar io.dropwizard.metrics:metrics-json, 3.1.0
|
157
|
+
- jar io.dropwizard.metrics:metrics-jvm, 3.1.0
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.4.5
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: rack middleware to expose leafy metrics/health data and more
|
163
|
+
test_files: []
|