stackprof-remote 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -4
- data/Gemfile.lock +5 -22
- data/VERSION +1 -1
- data/lib/stackprof/remote/client.rb +11 -4
- data/lib/stackprof/remote/middleware.rb +3 -3
- data/lib/stackprof/remote/process_report_collector.rb +15 -3
- data/stackprof-remote.gemspec +13 -15
- data/test/helper.rb +2 -5
- data/test/test.dump +0 -0
- data/test/test_stackprof-remote.rb +14 -3
- metadata +11 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e025e9b063b4823e5d05bed0ed3aae1d472a871
|
4
|
+
data.tar.gz: beb4078dc48598e97b286dede4ab883bb970eeb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcd209a05434b05d042c1ca16aadce354b618ee17617998e0b31e6fb470ebd5d750d1d86a7c35db243cdce4c519864d14d29cf552a25c111c2d55dcb41f1e448
|
7
|
+
data.tar.gz: 219ef3134ebf6d54d15626b0d537e59f1dad16447ef4001b2aa99e912b6b7c30e6d75691ef84a90254101d251586fe58ec98b85fc81344403cd76bbafb6587fb
|
data/Gemfile
CHANGED
@@ -2,14 +2,13 @@ source "http://rubygems.org"
|
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
5
|
-
gem "rbtrace", "~>0.4.
|
6
|
-
gem "stackprof", "~>0.2.
|
7
|
-
gem "pry"
|
5
|
+
gem "rbtrace", "~>0.4.4"
|
6
|
+
gem "stackprof", "~>0.2.7"
|
7
|
+
gem "pry", "~>0.10.0"
|
8
8
|
|
9
9
|
# Add dependencies to develop your gem here.
|
10
10
|
# Include everything needed to run rake, tests, features, etc.
|
11
11
|
group :development do
|
12
|
-
gem "shoulda", ">= 0"
|
13
12
|
gem "rdoc", "~> 3.12"
|
14
13
|
gem "bundler", "~> 1.0"
|
15
14
|
gem "jeweler", "~> 2.0.1"
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (4.1.1)
|
5
|
-
i18n (~> 0.6, >= 0.6.9)
|
6
|
-
json (~> 1.7, >= 1.7.7)
|
7
|
-
minitest (~> 5.1)
|
8
|
-
thread_safe (~> 0.1)
|
9
|
-
tzinfo (~> 1.1)
|
10
4
|
addressable (2.3.6)
|
11
5
|
builder (3.2.2)
|
12
6
|
coderay (1.1.0)
|
@@ -27,7 +21,6 @@ GEM
|
|
27
21
|
oauth2
|
28
22
|
hashie (3.0.0)
|
29
23
|
highline (1.6.21)
|
30
|
-
i18n (0.6.9)
|
31
24
|
jeweler (2.0.1)
|
32
25
|
builder
|
33
26
|
bundler (>= 1.0)
|
@@ -41,7 +34,6 @@ GEM
|
|
41
34
|
jwt (1.0.0)
|
42
35
|
method_source (0.8.2)
|
43
36
|
mini_portile (0.6.0)
|
44
|
-
minitest (5.3.4)
|
45
37
|
msgpack (0.5.8)
|
46
38
|
multi_json (1.10.1)
|
47
39
|
multi_xml (0.5.5)
|
@@ -60,29 +52,21 @@ GEM
|
|
60
52
|
slop (~> 3.4)
|
61
53
|
rack (1.5.2)
|
62
54
|
rake (10.3.2)
|
63
|
-
rbtrace (0.4.
|
55
|
+
rbtrace (0.4.4)
|
64
56
|
ffi (>= 1.0.6)
|
65
57
|
msgpack (>= 0.4.3)
|
66
58
|
trollop (>= 1.16.2)
|
67
59
|
rdoc (3.12.2)
|
68
60
|
json (~> 1.4)
|
69
|
-
shoulda (3.5.0)
|
70
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
71
|
-
shoulda-matchers (>= 1.4.1, < 3.0)
|
72
|
-
shoulda-context (1.2.1)
|
73
|
-
shoulda-matchers (2.6.1)
|
74
|
-
activesupport (>= 3.0.0)
|
75
61
|
simplecov (0.8.2)
|
76
62
|
docile (~> 1.1.0)
|
77
63
|
multi_json
|
78
64
|
simplecov-html (~> 0.8.0)
|
79
65
|
simplecov-html (0.8.0)
|
80
66
|
slop (3.5.0)
|
81
|
-
stackprof (0.2.
|
67
|
+
stackprof (0.2.7)
|
82
68
|
thread_safe (0.3.4)
|
83
69
|
trollop (2.0)
|
84
|
-
tzinfo (1.2.1)
|
85
|
-
thread_safe (~> 0.1)
|
86
70
|
|
87
71
|
PLATFORMS
|
88
72
|
ruby
|
@@ -90,9 +74,8 @@ PLATFORMS
|
|
90
74
|
DEPENDENCIES
|
91
75
|
bundler (~> 1.0)
|
92
76
|
jeweler (~> 2.0.1)
|
93
|
-
pry
|
94
|
-
rbtrace (~> 0.4.
|
77
|
+
pry (~> 0.10.0)
|
78
|
+
rbtrace (~> 0.4.4)
|
95
79
|
rdoc (~> 3.12)
|
96
|
-
shoulda
|
97
80
|
simplecov
|
98
|
-
stackprof (~> 0.2.
|
81
|
+
stackprof (~> 0.2.7)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -39,10 +39,17 @@ module StackProf
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def fetch_results
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
response = Net::HTTP.get_response(host, "/__stackprof__/stop")
|
43
|
+
if response.code == '200'
|
44
|
+
@results = response.body
|
45
|
+
if !@results
|
46
|
+
raise "Could not retreive results"
|
47
|
+
end
|
48
|
+
puts "[#{host}] Results: #{@results.bytesize / 1024}kb"
|
49
|
+
else
|
50
|
+
puts "[#{host}] Returned a #{response.code} response"
|
51
|
+
puts response.body
|
52
|
+
raise "Bad Response"
|
46
53
|
end
|
47
54
|
end
|
48
55
|
|
@@ -24,7 +24,7 @@ module StackProf
|
|
24
24
|
|
25
25
|
def initialize(app, options = {})
|
26
26
|
@app = app
|
27
|
-
self.class.logger = options
|
27
|
+
self.class.logger = options[:logger] || Logger.new(STDOUT)
|
28
28
|
self.class.options = options
|
29
29
|
logger.info "[stackprof] Stackprof Middleware enabled"
|
30
30
|
end
|
@@ -77,11 +77,11 @@ module StackProf
|
|
77
77
|
if results = marshaled_results
|
78
78
|
FileUtils.mkdir_p(base_path)
|
79
79
|
filename = "stackprof-#{Process.pid}-#{Time.now.to_i}.dump"
|
80
|
-
path = File.
|
80
|
+
path = File.join(base_path, filename)
|
81
81
|
File.open(path, 'wb') do |f|
|
82
82
|
f.write results
|
83
83
|
end
|
84
|
-
path
|
84
|
+
File.readable?(path) ? path : nil
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
@@ -46,16 +46,28 @@ module StackProf
|
|
46
46
|
|
47
47
|
def marshaled_results
|
48
48
|
if @saved_files
|
49
|
+
logger.debug "[stackprof] Saved Files #{@saved_files.inspect}"
|
49
50
|
saved_data = @saved_files.collect {|f|
|
50
|
-
|
51
|
-
|
51
|
+
f = f.gsub(/"/,'') # RBTrace returns double quoted strings
|
52
|
+
if File.readable?(f)
|
53
|
+
Marshal.load(File.read(f))
|
54
|
+
else
|
55
|
+
logger.error "[stackprof] File #{f} not readable by process #{Process.pid}"
|
56
|
+
end
|
57
|
+
}.compact
|
52
58
|
Marshal.dump(saved_data)
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
56
62
|
def self.report_from_marshaled_results(marshaled_data)
|
57
63
|
data = Marshal.load(marshaled_data)
|
58
|
-
|
64
|
+
if data.is_a?(Array)
|
65
|
+
data.compact.inject(nil) do |sum, d|
|
66
|
+
sum ? StackProf::Report.new(d) + sum : StackProf::Report.new(d)
|
67
|
+
end
|
68
|
+
else
|
69
|
+
StackProf::Report.new(d)
|
70
|
+
end
|
59
71
|
end
|
60
72
|
|
61
73
|
private
|
data/stackprof-remote.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: stackprof-remote 0.0.
|
5
|
+
# stub: stackprof-remote 0.0.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "stackprof-remote"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Aaron Quint"]
|
14
|
-
s.date = "2014-06-
|
14
|
+
s.date = "2014-06-17"
|
15
15
|
s.description = "stackprof-remote consists of a middleware for easy creation and retreival of\n stackprof sampling profiler dumps from a remote machine, and a wrapper around\n pry (stackprof-cli) to create an interactive session for navigating stackprof\n dumps."
|
16
16
|
s.email = "aaron@quirkey.com"
|
17
17
|
s.executables = ["stackprof-cli", "stackprof-remote"]
|
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/stackprof/remote/process_report_collector.rb",
|
37
37
|
"stackprof-remote.gemspec",
|
38
38
|
"test/helper.rb",
|
39
|
+
"test/test.dump",
|
39
40
|
"test/test_stackprof-remote.rb"
|
40
41
|
]
|
41
42
|
s.homepage = "http://github.com/quirkey/stackprof-remote"
|
@@ -47,29 +48,26 @@ Gem::Specification.new do |s|
|
|
47
48
|
s.specification_version = 4
|
48
49
|
|
49
50
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
-
s.add_runtime_dependency(%q<rbtrace>, ["~> 0.4.
|
51
|
-
s.add_runtime_dependency(%q<stackprof>, ["~> 0.2.
|
52
|
-
s.add_runtime_dependency(%q<pry>, ["
|
53
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
51
|
+
s.add_runtime_dependency(%q<rbtrace>, ["~> 0.4.4"])
|
52
|
+
s.add_runtime_dependency(%q<stackprof>, ["~> 0.2.7"])
|
53
|
+
s.add_runtime_dependency(%q<pry>, ["~> 0.10.0"])
|
54
54
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
55
55
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
56
56
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
57
57
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
58
58
|
else
|
59
|
-
s.add_dependency(%q<rbtrace>, ["~> 0.4.
|
60
|
-
s.add_dependency(%q<stackprof>, ["~> 0.2.
|
61
|
-
s.add_dependency(%q<pry>, ["
|
62
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
59
|
+
s.add_dependency(%q<rbtrace>, ["~> 0.4.4"])
|
60
|
+
s.add_dependency(%q<stackprof>, ["~> 0.2.7"])
|
61
|
+
s.add_dependency(%q<pry>, ["~> 0.10.0"])
|
63
62
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
64
63
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
65
64
|
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
66
65
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
67
66
|
end
|
68
67
|
else
|
69
|
-
s.add_dependency(%q<rbtrace>, ["~> 0.4.
|
70
|
-
s.add_dependency(%q<stackprof>, ["~> 0.2.
|
71
|
-
s.add_dependency(%q<pry>, ["
|
72
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
68
|
+
s.add_dependency(%q<rbtrace>, ["~> 0.4.4"])
|
69
|
+
s.add_dependency(%q<stackprof>, ["~> 0.2.7"])
|
70
|
+
s.add_dependency(%q<pry>, ["~> 0.10.0"])
|
73
71
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
74
72
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
75
73
|
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
data/test/helper.rb
CHANGED
@@ -23,12 +23,9 @@ rescue Bundler::BundlerError => e
|
|
23
23
|
$stderr.puts "Run `bundle install` to install missing gems"
|
24
24
|
exit e.status_code
|
25
25
|
end
|
26
|
-
|
27
|
-
require '
|
26
|
+
|
27
|
+
require 'minitest/autorun'
|
28
28
|
|
29
29
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
30
30
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
31
31
|
require 'stackprof-remote'
|
32
|
-
|
33
|
-
class Test::Unit::TestCase
|
34
|
-
end
|
data/test/test.dump
ADDED
Binary file
|
@@ -1,7 +1,18 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class
|
4
|
-
|
5
|
-
|
3
|
+
class TestStackProfRemote < MiniTest::Unit::TestCase
|
4
|
+
|
5
|
+
def test_should_load_a_marshaled_dump
|
6
|
+
report = StackProf::Remote::ProcessReportCollector.report_from_marshaled_results(File.read('./test/test.dump'))
|
7
|
+
assert report
|
8
|
+
assert_kind_of StackProf::Report, report
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_should_print_text
|
12
|
+
report = StackProf::Remote::ProcessReportCollector.report_from_marshaled_results(File.read('./test/test.dump'))
|
13
|
+
str = StringIO.new
|
14
|
+
assert report.print_text(false, 10, str)
|
15
|
+
assert_match(/ActiveSupport/, str.string)
|
6
16
|
end
|
17
|
+
|
7
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackprof-remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Quint
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbtrace
|
@@ -16,56 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.4.
|
19
|
+
version: 0.4.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.4.
|
26
|
+
version: 0.4.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: stackprof
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.
|
33
|
+
version: 0.2.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.2.
|
40
|
+
version: 0.2.7
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.10.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: shoulda
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
52
|
+
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
54
|
+
version: 0.10.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rdoc
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,6 +138,7 @@ files:
|
|
152
138
|
- lib/stackprof/remote/process_report_collector.rb
|
153
139
|
- stackprof-remote.gemspec
|
154
140
|
- test/helper.rb
|
141
|
+
- test/test.dump
|
155
142
|
- test/test_stackprof-remote.rb
|
156
143
|
homepage: http://github.com/quirkey/stackprof-remote
|
157
144
|
licenses:
|