fiveruns-dash-ruby 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/fiveruns/dash/exception_recorder.rb +9 -3
- data/lib/fiveruns/dash/host.rb +9 -0
- data/recipes/ruby.rb +35 -28
- data/version.yml +1 -1
- metadata +5 -4
@@ -8,6 +8,11 @@ module Fiveruns
|
|
8
8
|
RULES = []
|
9
9
|
|
10
10
|
class << self
|
11
|
+
|
12
|
+
def host
|
13
|
+
::Fiveruns::Dash.host
|
14
|
+
end
|
15
|
+
|
11
16
|
def replacements
|
12
17
|
@replacements ||= begin
|
13
18
|
paths = {
|
@@ -24,11 +29,11 @@ module Fiveruns
|
|
24
29
|
end
|
25
30
|
|
26
31
|
def system_gempaths
|
27
|
-
|
32
|
+
host.result :gem, 'environment gempath', :bat
|
28
33
|
end
|
29
|
-
|
34
|
+
|
30
35
|
def system_paths
|
31
|
-
|
36
|
+
host.result :ruby, %(-e 'puts $:.reject { |p| p == "." }.join(":")'), :exe
|
32
37
|
end
|
33
38
|
|
34
39
|
def regexp_for_path(path)
|
@@ -46,6 +51,7 @@ module Fiveruns
|
|
46
51
|
def add_ignore_rule(&rule)
|
47
52
|
RULES << rule
|
48
53
|
end
|
54
|
+
|
49
55
|
end
|
50
56
|
|
51
57
|
def initialize(session)
|
data/lib/fiveruns/dash/host.rb
CHANGED
@@ -65,6 +65,15 @@ module Fiveruns::Dash
|
|
65
65
|
def execute_on_windows(&block)
|
66
66
|
block.call if RUBY_PLATFORM =~ /win32|i386-mingw32/
|
67
67
|
end
|
68
|
+
|
69
|
+
def result(command, args, windows_ext=nil)
|
70
|
+
name = if windows_ext && os_name_match?(:windows)
|
71
|
+
"#{command}.#{windows_ext}"
|
72
|
+
else
|
73
|
+
command.to_s
|
74
|
+
end
|
75
|
+
`#{name} #{args}`
|
76
|
+
end
|
68
77
|
|
69
78
|
def hostname
|
70
79
|
@hostname
|
data/recipes/ruby.rb
CHANGED
@@ -1,34 +1,41 @@
|
|
1
1
|
Fiveruns::Dash.register_recipe :ruby, :url => 'http://dash.fiveruns.com' do |metrics|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
|
3
|
+
# TODO: Support Windows
|
4
|
+
Fiveruns::Dash.host.execute_on_unix do
|
5
|
+
|
6
|
+
metrics.absolute :vsz,
|
7
|
+
"Virtual Memory Usage", "The amount of virtual memory used by this process",
|
8
|
+
:unit => 'kbytes', :scope => :host do
|
9
|
+
Integer(`ps -o vsz -p #{Process.pid}`[/(\d+)/, 1])
|
10
|
+
end
|
11
|
+
metrics.absolute :rss, "Resident Memory Usage",
|
12
|
+
"The amount of physical memory used by this process",
|
13
|
+
:unit => 'kbytes',
|
14
|
+
:scope => :host do
|
15
|
+
Integer(`ps -o rss -p #{Process.pid}`[/(\d+)/, 1])
|
16
|
+
end
|
17
|
+
metrics.percentage :pmem,
|
18
|
+
"Resident Memory Usage",
|
19
|
+
"Percentage of Resident Memory Usage",
|
10
20
|
:scope => :host do
|
11
|
-
|
12
|
-
|
13
|
-
metrics.percentage :pmem,
|
14
|
-
"Resident Memory Usage",
|
15
|
-
"Percentage of Resident Memory Usage",
|
16
|
-
:scope => :host do
|
17
|
-
Float(`ps -o pmem -p #{Process.pid}`[/(\d+\.\d+)/, 1])
|
18
|
-
end
|
21
|
+
Float(`ps -o pmem -p #{Process.pid}`[/(\d+\.\d+)/, 1])
|
22
|
+
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
if RUBY_PLATFORM == 'java'
|
25
|
+
Fiveruns::Dash.logger.warn "Cannot collect CPU usage data on JRuby"
|
26
|
+
else
|
27
|
+
metrics.percentage :cpu,
|
28
|
+
'CPU Usage',
|
29
|
+
'Percentage CPU Usage',
|
30
|
+
:scope => :host do
|
31
|
+
before = Thread.current[:dash_utime] ||= Process.times.utime
|
32
|
+
after = Process.times.utime
|
33
|
+
this_minute = after - before
|
34
|
+
Thread.current[:dash_utime] = after
|
35
|
+
(this_minute / 60) * 100.00
|
36
|
+
end
|
32
37
|
end
|
38
|
+
|
33
39
|
end
|
40
|
+
|
34
41
|
end
|
data/version.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiveruns-dash-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FiveRuns Development Team
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-18 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -19,8 +19,8 @@ executables: []
|
|
19
19
|
|
20
20
|
extensions: []
|
21
21
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
24
|
files:
|
25
25
|
- README.rdoc
|
26
26
|
- Rakefile
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- lib/fiveruns/dash/host.rb
|
33
33
|
- lib/fiveruns/dash/instrument.rb
|
34
34
|
- lib/fiveruns/dash/metric.rb
|
35
|
+
- lib/fiveruns/dash/read
|
35
36
|
- lib/fiveruns/dash/recipe.rb
|
36
37
|
- lib/fiveruns/dash/reporter.rb
|
37
38
|
- lib/fiveruns/dash/scm.rb
|