simple-metrics 0.0.11-java → 0.0.12-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -1
- data/README.md +22 -8
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/lib/simple/metrics/meter.rb +4 -3
- data/lib/simple/version.rb +1 -1
- data/simple-metrics.gemspec +3 -4
- metadata +34 -36
- data/.rbenv-version +0 -1
- data/build +0 -10
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Simple::Metrics
|
2
2
|
|
3
|
-
A simple JRuby wrapper around Coda's <a href="http://
|
3
|
+
A simple JRuby wrapper around Coda's excellent <a href="http://metrics.codahale.com/">Metrics package</a>
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,13 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Healthchecks
|
20
20
|
|
21
|
-
|
21
|
+
Monitor the health of your application in a granular way.
|
22
|
+
|
23
|
+
In a Sinatra/Padrino app, register healthchecks as an extension like so:
|
24
|
+
|
25
|
+
register Simple::Metrics::Healthchecks
|
26
|
+
|
27
|
+
To register a new healthcheck:
|
22
28
|
|
23
29
|
class NurseRatched
|
24
30
|
extend Simple::Metrics::Healthchecks
|
@@ -40,12 +46,16 @@ Run all healthchecks:
|
|
40
46
|
|
41
47
|
NurseRatched.run_all_healthchecks
|
42
48
|
|
43
|
-
|
49
|
+
Your healthchecks will be run in a separate thread every 5 seconds. This is a great way to monitor the health of your db connections, thread pools and connections to queues.
|
44
50
|
|
45
|
-
|
51
|
+
If you are running the servlet in a warbler .war file (see example below), you can monitor the overall health of your application with nagios or other monitoring tools.
|
46
52
|
|
47
53
|
## Timers
|
48
54
|
|
55
|
+
From: <a href="http://metrics.codahale.com/getting-started/#timers">Timers</a>:
|
56
|
+
|
57
|
+
A timer measures both the rate that a particular piece of code is called and the distribution of its duration.
|
58
|
+
|
49
59
|
class Samovar
|
50
60
|
include Simple::Metrics
|
51
61
|
|
@@ -58,10 +68,14 @@ In a Sinatra/Padrino app, register healthchecks as an extension like so:
|
|
58
68
|
|
59
69
|
## Meters
|
60
70
|
|
71
|
+
From: <a href="http://metrics.codahale.com/getting-started/#meters">Meters</a>:
|
72
|
+
|
73
|
+
"A meter measures the rate of events over time (e.g., “requests per second”). In addition to the mean rate, meters also track 1-, 5-, and 15-minute moving averages."
|
74
|
+
|
61
75
|
class Rdio
|
62
76
|
extend Simple::Metrics::Meter
|
63
77
|
|
64
|
-
define_meter :
|
78
|
+
define_meter :bump_meter
|
65
79
|
|
66
80
|
def bump_dat
|
67
81
|
bump_meter.mark
|
@@ -78,7 +92,7 @@ In a Sinatra app:
|
|
78
92
|
|
79
93
|
## Exposing metrics from within your app
|
80
94
|
|
81
|
-
In order to view the metrics
|
95
|
+
In order to view/collect the health and metrics of your application from the web, you'll need to add the servlet endpoints.
|
82
96
|
For this example, I'm using <a href="https://github.com/jruby/warbler">Warbler</a> to package
|
83
97
|
the application as a .war
|
84
98
|
|
@@ -117,10 +131,10 @@ In config/web.xml, add the following servlet mappings:
|
|
117
131
|
<url-pattern>/ping</url-pattern>
|
118
132
|
</servlet-mapping>
|
119
133
|
|
120
|
-
Now you can visit your application and get a thread dump:
|
134
|
+
Now you can visit your application and get a thread dump, health check or collect metrics using collectd:
|
121
135
|
|
122
136
|
> curl localhost:9292/threads
|
123
137
|
main id=1 state=WAITING
|
124
138
|
- waiting on <0x073772c5> (a java.lang.Object)
|
125
139
|
- locked <0x073772c5> (a java.lang.Object)
|
126
|
-
at java.lang.Object.wait(Native Method)
|
140
|
+
at java.lang.Object.wait(Native Method)
|
data/doc/file.README.html
CHANGED
@@ -131,7 +131,7 @@
|
|
131
131
|
<pre class="code ruby"><code><span class='rubyid_class class kw'>class</span> <span class='rubyid_Rdio constant id'>Rdio</span>
|
132
132
|
<span class='rubyid_extend identifier id'>extend</span> <span class='rubyid_Simple constant id'>Simple</span><span class='colon2 op'>::</span><span class='rubyid_Metrics constant id'>Metrics</span><span class='colon2 op'>::</span><span class='rubyid_Meter constant id'>Meter</span>
|
133
133
|
|
134
|
-
<span class='rubyid_define_meter identifier id'>define_meter</span> <span class='symbol val'>:
|
134
|
+
<span class='rubyid_define_meter identifier id'>define_meter</span> <span class='symbol val'>:bump_meter</span>
|
135
135
|
|
136
136
|
<span class='rubyid_def def kw'>def</span> <span class='rubyid_bump_dat identifier id'>bump_dat</span>
|
137
137
|
<span class='rubyid_bump_meter identifier id'>bump_meter</span><span class='dot token'>.</span><span class='rubyid_mark identifier id'>mark</span>
|
data/doc/index.html
CHANGED
@@ -131,7 +131,7 @@
|
|
131
131
|
<pre class="code ruby"><code><span class='rubyid_class class kw'>class</span> <span class='rubyid_Rdio constant id'>Rdio</span>
|
132
132
|
<span class='rubyid_extend identifier id'>extend</span> <span class='rubyid_Simple constant id'>Simple</span><span class='colon2 op'>::</span><span class='rubyid_Metrics constant id'>Metrics</span><span class='colon2 op'>::</span><span class='rubyid_Meter constant id'>Meter</span>
|
133
133
|
|
134
|
-
<span class='rubyid_define_meter identifier id'>define_meter</span> <span class='symbol val'>:
|
134
|
+
<span class='rubyid_define_meter identifier id'>define_meter</span> <span class='symbol val'>:bump_meter</span>
|
135
135
|
|
136
136
|
<span class='rubyid_def def kw'>def</span> <span class='rubyid_bump_dat identifier id'>bump_dat</span>
|
137
137
|
<span class='rubyid_bump_meter identifier id'>bump_meter</span><span class='dot token'>.</span><span class='rubyid_mark identifier id'>mark</span>
|
data/lib/simple/metrics/meter.rb
CHANGED
@@ -8,11 +8,12 @@ module Simple
|
|
8
8
|
# @param [String] name The name of the meter
|
9
9
|
# @param [String] klass_name The name of the class, usually the application. Defaults to
|
10
10
|
# `self.class.name`
|
11
|
-
|
11
|
+
# @param [TimeUnit] time_unit The rate at which to measure marked data. Defaults to
|
12
|
+
# TimeUnit::SECONDS
|
13
|
+
def define_meter(name, klass_name = self.class.name, time_unit = Simple::Metrics::DEFAULT_RATE_UNIT)
|
12
14
|
type = "meter"
|
13
15
|
metric_name = new_metric_name(klass_name, name, type)
|
14
|
-
meter = Java::ComYammerMetrics::Metrics.new_meter(metric_name, name.to_s,
|
15
|
-
Simple::Metrics::DEFAULT_RATE_UNIT)
|
16
|
+
meter = Java::ComYammerMetrics::Metrics.new_meter(metric_name, name.to_s, time_unit)
|
16
17
|
define_method("#{name}") do
|
17
18
|
meter
|
18
19
|
end
|
data/lib/simple/version.rb
CHANGED
data/simple-metrics.gemspec
CHANGED
@@ -2,13 +2,12 @@
|
|
2
2
|
require File.expand_path('../lib/simple/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["dan herrera"]
|
5
|
+
gem.authors = ["dan herrera", "james pozdena"]
|
6
6
|
gem.email = ["dan@simple.com"]
|
7
7
|
gem.platform = 'java'
|
8
|
-
gem.description = %q{A JRuby wrapper around codahale's metrics package}
|
8
|
+
gem.description = %q{A simple JRuby wrapper around codahale's metrics package}
|
9
9
|
gem.summary = %q{MEASURE ALL THE THINGS!}
|
10
|
-
gem.homepage = "
|
11
|
-
|
10
|
+
gem.homepage = "https://github.com/SimpleFinance/simple-metrics"
|
12
11
|
gem.files = `git ls-files`.split($\)
|
13
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
13
|
gem.name = "simple-metrics"
|
metadata
CHANGED
@@ -1,81 +1,82 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
version: 0.0.12
|
5
|
+
prerelease:
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- dan herrera
|
9
|
-
|
9
|
+
- james pozdena
|
10
|
+
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2013-05-14 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: rspec
|
16
|
-
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
17
19
|
requirements:
|
18
20
|
- - ! '>='
|
19
21
|
- !ruby/object:Gem::Version
|
20
22
|
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
26
|
none: false
|
22
|
-
requirement: !ruby/object:Gem::Requirement
|
23
27
|
requirements:
|
24
28
|
- - ! '>='
|
25
29
|
- !ruby/object:Gem::Version
|
26
30
|
version: '0'
|
27
|
-
none: false
|
28
|
-
prerelease: false
|
29
|
-
type: :development
|
30
31
|
- !ruby/object:Gem::Dependency
|
31
32
|
name: rake
|
32
|
-
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
33
35
|
requirements:
|
34
36
|
- - ! '>='
|
35
37
|
- !ruby/object:Gem::Version
|
36
38
|
version: '0'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
42
|
none: false
|
38
|
-
requirement: !ruby/object:Gem::Requirement
|
39
43
|
requirements:
|
40
44
|
- - ! '>='
|
41
45
|
- !ruby/object:Gem::Version
|
42
46
|
version: '0'
|
43
|
-
none: false
|
44
|
-
prerelease: false
|
45
|
-
type: :development
|
46
47
|
- !ruby/object:Gem::Dependency
|
47
48
|
name: yard
|
48
|
-
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
49
51
|
requirements:
|
50
52
|
- - ! '>='
|
51
53
|
- !ruby/object:Gem::Version
|
52
54
|
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
58
|
none: false
|
54
|
-
requirement: !ruby/object:Gem::Requirement
|
55
59
|
requirements:
|
56
60
|
- - ! '>='
|
57
61
|
- !ruby/object:Gem::Version
|
58
62
|
version: '0'
|
59
|
-
none: false
|
60
|
-
prerelease: false
|
61
|
-
type: :development
|
62
63
|
- !ruby/object:Gem::Dependency
|
63
64
|
name: kramdown
|
64
|
-
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
65
67
|
requirements:
|
66
68
|
- - ! '>='
|
67
69
|
- !ruby/object:Gem::Version
|
68
70
|
version: '0'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
74
|
none: false
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
71
75
|
requirements:
|
72
76
|
- - ! '>='
|
73
77
|
- !ruby/object:Gem::Version
|
74
78
|
version: '0'
|
75
|
-
|
76
|
-
prerelease: false
|
77
|
-
type: :development
|
78
|
-
description: A JRuby wrapper around codahale's metrics package
|
79
|
+
description: A simple JRuby wrapper around codahale's metrics package
|
79
80
|
email:
|
80
81
|
- dan@simple.com
|
81
82
|
executables: []
|
@@ -83,13 +84,11 @@ extensions: []
|
|
83
84
|
extra_rdoc_files: []
|
84
85
|
files:
|
85
86
|
- .gitignore
|
86
|
-
- .rbenv-version
|
87
87
|
- .rspec
|
88
88
|
- Gemfile
|
89
89
|
- LICENSE
|
90
90
|
- README.md
|
91
91
|
- Rakefile
|
92
|
-
- build
|
93
92
|
- doc/NurseRatched.html
|
94
93
|
- doc/Rdio.html
|
95
94
|
- doc/Samovar.html
|
@@ -140,28 +139,28 @@ files:
|
|
140
139
|
- spec/metrics/meter_spec.rb
|
141
140
|
- spec/metrics/timer_spec.rb
|
142
141
|
- spec/spec_helper.rb
|
143
|
-
homepage:
|
142
|
+
homepage: https://github.com/SimpleFinance/simple-metrics
|
144
143
|
licenses: []
|
145
|
-
post_install_message:
|
144
|
+
post_install_message:
|
146
145
|
rdoc_options: []
|
147
146
|
require_paths:
|
148
147
|
- lib
|
149
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
|
-
none: false
|
155
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
156
|
requirements:
|
157
157
|
- - ! '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
|
-
none: false
|
161
160
|
requirements: []
|
162
|
-
rubyforge_project:
|
163
|
-
rubygems_version: 1.8.
|
164
|
-
signing_key:
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 1.8.23
|
163
|
+
signing_key:
|
165
164
|
specification_version: 3
|
166
165
|
summary: MEASURE ALL THE THINGS!
|
167
166
|
test_files:
|
@@ -170,5 +169,4 @@ test_files:
|
|
170
169
|
- spec/metrics/meter_spec.rb
|
171
170
|
- spec/metrics/timer_spec.rb
|
172
171
|
- spec/spec_helper.rb
|
173
|
-
has_rdoc:
|
174
|
-
...
|
172
|
+
has_rdoc:
|
data/.rbenv-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
jruby-1.6.7.2
|