rt-watchman 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6805c96f578f83f237b0baa56e79106d21aa63e
4
- data.tar.gz: 1ad80784f7c6357ea7fa884db8da722ca05c9478
3
+ metadata.gz: 911f5e3a23afc42f9e7f39ae8ea0d54181206700
4
+ data.tar.gz: 7656f3dbf1618cfe810fca2630a4228ebdbcf73b
5
5
  SHA512:
6
- metadata.gz: 0b1f4fe293cd18d174b6e059a66ebdf78da9c98f7f9bcd542268296f0908b27dc38d5e40c4564316da7f0843f8fbf07653023fd79ed359eeab1dd27e41cf2fe1
7
- data.tar.gz: ef2e58f5e102d15a963c1e9f29b5802b510f277194dd2ec1cf20a5b83b19c558f596c383d9e2aafa6176de6116066b4a45203bebee9d169b39dae40f254b49ff
6
+ metadata.gz: 06b45c9cd9d3d6c87a7682bd2822281c46aa09f91612eba7e67472939d7ddfb3588200490571b9419057e96a1aee79944969cc07acda6263d4f741b97faf80cc
7
+ data.tar.gz: 8fade8bba5f753bc430c5e7089531ec3f12ccb87a87023aa989911c9705e5aaf264937cee0cf58c0aab6d1099a01f8174e327456142e4e109151d7ff57496fa7
data/README.md CHANGED
@@ -5,7 +5,7 @@ Watchman is your friend who monitors your processes so you don't have to.
5
5
  ## Installation
6
6
 
7
7
  ``` ruby
8
- gem 'watchman'
8
+ gem "rt-watchman", :require => "watchman"
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -1,3 +1,3 @@
1
- module Watchman
2
- VERSION = "0.3.0"
1
+ class Watchman
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/watchman.rb CHANGED
@@ -2,38 +2,40 @@ require "watchman/version"
2
2
  require "benchmark"
3
3
  require "statsd"
4
4
 
5
- module Watchman
6
- extend self
7
-
8
- attr_accessor :prefix
9
- attr_accessor :host
10
- attr_accessor :port
5
+ class Watchman
6
+ class << self
7
+ attr_accessor :prefix
8
+ attr_accessor :host
9
+ attr_accessor :port
10
+
11
+ def submit(name, value)
12
+ statsd_client.gauge(metric_name_with_prefix(name), value)
13
+ end
11
14
 
12
- def statsd_client
13
- @client ||= Statsd.new(@host, @port)
14
- end
15
+ def benchmark(name)
16
+ result = nil
15
17
 
16
- def submit(name, value)
17
- statsd_client.gauge(metric_name_with_prefix(name), value)
18
- end
18
+ time = Benchmark.measure do
19
+ result = yield
20
+ end
19
21
 
20
- def benchmark(name)
21
- result = nil
22
+ statsd_client.timing(metric_name_with_prefix(name), (time.real * 1000).floor)
22
23
 
23
- time = Benchmark.measure do
24
- result = yield
24
+ result
25
25
  end
26
26
 
27
- statsd_client.timing(metric_name_with_prefix(name), (time.real * 1000).floor)
27
+ private
28
28
 
29
- result
30
- end
29
+ def statsd_client
30
+ @client ||= Statsd.new(@host, @port)
31
+ end
31
32
 
32
- def metric_name_with_prefix(name)
33
- if @prefix
34
- "#{@prefix}.#{name}"
35
- else
36
- name
33
+ def metric_name_with_prefix(name)
34
+ if @prefix
35
+ "#{@prefix}.#{name}"
36
+ else
37
+ name
38
+ end
37
39
  end
38
40
  end
39
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rt-watchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rendered Text
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-05 00:00:00.000000000 Z
11
+ date: 2016-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: statsd-ruby