jruby-monitoring 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/jruby-ext/target/classes/com/purbon/jrmonitor/JRMonitorService$1.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/JRMonitorService$2.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/JRMonitorService$3.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/JRMonitorService.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/JRubyUtils.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/monitors/HotThreadsMonitor$1.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/monitors/HotThreadsMonitor$ThreadReport.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/monitors/HotThreadsMonitor.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/monitors/MemoryMonitor$Report.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/monitors/MemoryMonitor$Type.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/monitors/MemoryMonitor.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/monitors/SystemMonitor$Report.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/monitors/SystemMonitor.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/reports/RubyMemoryReport.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/reports/RubySystemReport.class +0 -0
- data/jruby-ext/target/classes/com/purbon/jrmonitor/reports/RubyThreadsReport.class +0 -0
- data/jruby-monitoring.gemspec +25 -0
- data/lib/monitoring.rb +20 -0
- data/lib/monitoring/version.rb +3 -0
- data/spec/lib/memory_monitor_spec.rb +37 -0
- data/spec/lib/system_monitor_spec.rb +27 -0
- data/spec/lib/thread_monitor_spec.rb +83 -0
- data/spec/spec_helper.rb +2 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 276d23e37de73d76cf0361fd7807992d8e15a571
|
4
|
+
data.tar.gz: 31f02c0a22fe90f37b6f127c4de3046d204c00b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 19c482c97df560bbcb67a80a05328623e36b5d2bd6966a188b0560d9b61c4176a7279ab011179452717f8b0292027ebda2e393a4095ffc73da0c8bdeb5d3c18c
|
7
|
+
data.tar.gz: de036c616f265489076b20cf90db3281c4b06d2c70e414aab0b8fc9fa6a8dc9f27e6b7fe4698f57c22c211df97d6f47c23ff8267b27bc5f3f4d4af0420b49630
|
Binary file
|
Binary file
|
data/jruby-ext/target/classes/com/purbon/jrmonitor/monitors/HotThreadsMonitor$ThreadReport.class
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'monitoring/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jruby-monitoring"
|
8
|
+
spec.version = JRMonitor::VERSION
|
9
|
+
spec.authors = ["Pere Urbon-Bayes"]
|
10
|
+
spec.email = ["pere.urbon@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{JVM Platform MXBeans wrapper used for monitoring.}
|
13
|
+
spec.description = %q{This gems allows you to access in a Ruby friendly way the internal JVM monitoring tools for things like System, Threads and Memory information}
|
14
|
+
spec.homepage = "http://www.purbon.com"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = Dir.glob(["jruby-monitoring.gemspec", "lib/**/*.rb", "spec/**/*.rb", "jruby-ext/target/classes/**/*.class"])
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib", "jruby-ext"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
data/lib/monitoring.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "java"
|
2
|
+
$CLASSPATH << File.join(File.dirname(__FILE__), "..", "jruby-ext", "target", "classes")
|
3
|
+
|
4
|
+
require "monitoring/version"
|
5
|
+
require "com/purbon/jrmonitor/JRMonitor"
|
6
|
+
|
7
|
+
module JRMonitor
|
8
|
+
|
9
|
+
def self.threads
|
10
|
+
Report::Threads.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.system
|
14
|
+
Report::System.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.memory
|
18
|
+
Report::Memory.new
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe JRMonitor::Report::Memory do
|
4
|
+
|
5
|
+
let(:report) { subject.generate }
|
6
|
+
|
7
|
+
it 'pulls usage for heap and non heap memory' do
|
8
|
+
expect(report.keys).to include("heap")
|
9
|
+
expect(report.keys).to include("non_heap")
|
10
|
+
end
|
11
|
+
|
12
|
+
context "#heap memory"do
|
13
|
+
|
14
|
+
let(:report) { subject.generate_with_heap }
|
15
|
+
|
16
|
+
it "pull usage for each space" do
|
17
|
+
spaces = ["PS Survivor Space", "PS Old Gen", "PS Eden Space"]
|
18
|
+
report.keys.each do |space|
|
19
|
+
expect(spaces).to include(space);
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "pull usage and peak info for each space" do
|
24
|
+
report.each_pair do |_, values|
|
25
|
+
expect(values).to include("usage.used" => kind_of(Fixnum))
|
26
|
+
expect(values).to include("usage.max" => kind_of(Fixnum))
|
27
|
+
expect(values).to include("usage.committed" => kind_of(Fixnum))
|
28
|
+
expect(values).to include("usage.init" => kind_of(Fixnum))
|
29
|
+
expect(values).to include("peak.used" => kind_of(Fixnum))
|
30
|
+
expect(values).to include("peak.max" => kind_of(Fixnum))
|
31
|
+
expect(values).to include("peak.committed" => kind_of(Fixnum))
|
32
|
+
expect(values).to include("peak.init" => kind_of(Fixnum))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe JRMonitor::Report::System do
|
4
|
+
|
5
|
+
let(:report) { subject.generate }
|
6
|
+
|
7
|
+
it 'pulls system load information' do
|
8
|
+
expect(report).to include( "system.load_average" => a_kind_of(Float) )
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'pulls system available processors information' do
|
12
|
+
expect(report).to include( "system.available_processors" => a_kind_of(Fixnum) )
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'pulls os version information' do
|
16
|
+
expect(report).to include( "os.version" => a_kind_of(String) )
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'pulls os arch information' do
|
20
|
+
expect(report).to include( "os.arch" => a_kind_of(String) )
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'pulls os name information' do
|
24
|
+
expect(report).to include( "os.name" => a_kind_of(String) )
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe JRMonitor::Report::Threads do
|
4
|
+
|
5
|
+
let(:threads) { subject.generate }
|
6
|
+
|
7
|
+
it 'pull running threads' do
|
8
|
+
expect(threads.keys.count).to be > 0
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'fetch foreach threads information about cpu time' do
|
12
|
+
threads.each_pair do |_, values|
|
13
|
+
expect(values).to include('cpu.time')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'fetch foreach threads information about thread state' do
|
18
|
+
threads.each_pair do |_, values|
|
19
|
+
expect(values).to include('thread.state')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'fetch foreach threads information about blocked information' do
|
24
|
+
threads.each_pair do |_, values|
|
25
|
+
expect(values).to include('blocked.count')
|
26
|
+
expect(values).to include('blocked.time')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'fetch foreach threads information about waited information' do
|
31
|
+
threads.each_pair do |_, values|
|
32
|
+
expect(values).to include('waited.count')
|
33
|
+
expect(values).to include('waited.time')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#ordering" do
|
38
|
+
|
39
|
+
let(:type) { "cpu" }
|
40
|
+
|
41
|
+
let(:threads) do
|
42
|
+
subject.generate(type)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'fetch values ordered by cpu.time' do
|
46
|
+
last_cpu_time = 0
|
47
|
+
threads.each_pair do |_, values|
|
48
|
+
current_cpu_time = values["cpu.time"]
|
49
|
+
expect(last_cpu_time).to be >= current_cpu_time if last_cpu_time != 0
|
50
|
+
last_cpu_time = current_cpu_time
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "with block" do
|
55
|
+
|
56
|
+
let(:type) { "block" }
|
57
|
+
|
58
|
+
it 'fetch values ordered by blocked.time' do
|
59
|
+
last_time = 0
|
60
|
+
threads.each_pair do |_, values|
|
61
|
+
current_time = values["blocked.time"]
|
62
|
+
expect(last_time).to be >= current_time if last_time != 0
|
63
|
+
last_time = current_time
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "with wait" do
|
69
|
+
|
70
|
+
let(:type) { "wait" }
|
71
|
+
|
72
|
+
it 'fetch values ordered by waited.time' do
|
73
|
+
last_time = 0
|
74
|
+
threads.each_pair do |_, values|
|
75
|
+
current_time = values["waited.time"]
|
76
|
+
expect(last_time).to be >= current_time if last_time != 0
|
77
|
+
last_time = current_time
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jruby-monitoring
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pere Urbon-Bayes
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '1.10'
|
25
|
+
prerelease: false
|
26
|
+
type: :development
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '10.0'
|
39
|
+
prerelease: false
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
prerelease: false
|
54
|
+
type: :development
|
55
|
+
description: This gems allows you to access in a Ruby friendly way the internal JVM monitoring tools for things like System, Threads and Memory information
|
56
|
+
email:
|
57
|
+
- pere.urbon@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/JRMonitorService$1.class
|
63
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/JRMonitorService$2.class
|
64
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/JRMonitorService$3.class
|
65
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/JRMonitorService.class
|
66
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/JRubyUtils.class
|
67
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/monitors/HotThreadsMonitor$1.class
|
68
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/monitors/HotThreadsMonitor$ThreadReport.class
|
69
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/monitors/HotThreadsMonitor.class
|
70
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/monitors/MemoryMonitor$Report.class
|
71
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/monitors/MemoryMonitor$Type.class
|
72
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/monitors/MemoryMonitor.class
|
73
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/monitors/SystemMonitor$Report.class
|
74
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/monitors/SystemMonitor.class
|
75
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/reports/RubyMemoryReport.class
|
76
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/reports/RubySystemReport.class
|
77
|
+
- jruby-ext/target/classes/com/purbon/jrmonitor/reports/RubyThreadsReport.class
|
78
|
+
- jruby-monitoring.gemspec
|
79
|
+
- lib/monitoring.rb
|
80
|
+
- lib/monitoring/version.rb
|
81
|
+
- spec/lib/memory_monitor_spec.rb
|
82
|
+
- spec/lib/system_monitor_spec.rb
|
83
|
+
- spec/lib/thread_monitor_spec.rb
|
84
|
+
- spec/spec_helper.rb
|
85
|
+
homepage: http://www.purbon.com
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
- jruby-ext
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.6
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: JVM Platform MXBeans wrapper used for monitoring.
|
110
|
+
test_files: []
|
111
|
+
has_rdoc:
|