jruby-metrics 0.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use jruby@jruby-metrics --create
@@ -0,0 +1,2 @@
1
+ all:
2
+ @echo "makefile has not been implemented"
@@ -0,0 +1,6 @@
1
+ Jruby-Metrics
2
+ =============
3
+
4
+ Jruby wrapper for Yammer's Java Metrics library found [here](http://metrics.codahale.com/)
5
+
6
+
@@ -0,0 +1,12 @@
1
+
2
+ Gem::Specification.new do |s|
3
+ s.name = 'jruby-metrics'
4
+ s.version = '0.0.1'
5
+ s.platform = 'java'
6
+ s.author = 'Nick Ethier'
7
+ s.homepage = 'http://github.com/nickethier/jruby-metrics'
8
+ s.summary = %q{Ruby wrapper for Yammer's Java Metrics Library}
9
+ s.files = `git ls-files`.split("\n")
10
+
11
+ s.require_paths = %w(lib)
12
+ end
Binary file
Binary file
@@ -0,0 +1,49 @@
1
+ require 'java'
2
+ require 'ext/slf4j-api'
3
+ require 'ext/metrics-core'
4
+
5
+ module Metrics
6
+ import com.yammer.metrics.Metrics
7
+ import com.yammer.metrics.core.MetricName
8
+
9
+ module TimeUnit
10
+ import java.util.concurrent.TimeUnit
11
+
12
+ DAYS = TimeUnit::DAYS
13
+ HOURS = TimeUnit::HOURS
14
+ MICROSECONDS = TimeUnit::MICROSECONDS
15
+ MILLISECONDS = TimeUnit::MILLISECONDS
16
+ MINUTES = TimeUnit::MINUTES
17
+ NANOSECONDS = TimeUnit::NANOSECONDS
18
+ SECONDS = TimeUnit::SECONDS
19
+ end
20
+
21
+ def self.newCounter(opts)
22
+ Metrics.newCounter(get_name(opts))
23
+ end
24
+
25
+ def self.newGauge(opts)
26
+ raise "Not Yet Implemented"
27
+ end
28
+
29
+ def self.newHistogram(opts)
30
+ Metrics.newHistogram(get_name(opts))
31
+ end
32
+
33
+ def self.newMeter(opts)
34
+ Metrics.newMeter(get_name(opts), opts[:type], opts[:unit])
35
+ end
36
+
37
+ def self.newTimer(opts)
38
+ Metrics.newTimer(get_name(opts), opts[:durationUnit], opts[:rateUnit])
39
+ end
40
+
41
+ def self.shutdown()
42
+ Metrics.shutdown()
43
+ end
44
+ private
45
+ def self.get_name(opts)
46
+ MetricName.new(opts[:group], opts[:type], opts[:name], opts[:scope])
47
+ end
48
+ end
49
+
@@ -0,0 +1,21 @@
1
+ require 'jruby-metrics'
2
+
3
+ describe Metrics do
4
+ context "before use" do
5
+ it "has no count" do
6
+ counter = Metrics.newCounter("test", "before_use", "no_count")
7
+ counter.count.should eq(0)
8
+ end
9
+ end
10
+
11
+ context "during use" do
12
+ it "should show correct count" do
13
+ counter = Metrics.newCounter("test", "during_use", "count")
14
+ inc = 5
15
+ dec = 3
16
+ inc.times { counter.inc }
17
+ dec.times { counter.dec }
18
+ counter.count.should eq(inc-dec)
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jruby-metrics
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: java
7
+ authors:
8
+ - Nick Ethier
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-06-26 00:00:00 Z
14
+ dependencies: []
15
+
16
+ description:
17
+ email:
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - .gitignore
26
+ - .rvmrc
27
+ - Makefile
28
+ - README.md
29
+ - jruby-metrics.gemspec
30
+ - lib/ext/metrics-core.jar
31
+ - lib/ext/slf4j-api.jar
32
+ - lib/jruby-metrics.rb
33
+ - spec/metrics_spec.rb
34
+ homepage: http://github.com/nickethier/jruby-metrics
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.8.15
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: Ruby wrapper for Yammer's Java Metrics Library
61
+ test_files: []
62
+