rt-watchman 0.2.1 → 0.3.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: 88bb77b06c44e1102fb710df63250ae6f22f4e3e
4
- data.tar.gz: e0fc15204138fc0d09048dbacd815fd6df2d8c71
3
+ metadata.gz: e6805c96f578f83f237b0baa56e79106d21aa63e
4
+ data.tar.gz: 1ad80784f7c6357ea7fa884db8da722ca05c9478
5
5
  SHA512:
6
- metadata.gz: c45606318147f76702d2f3d2c6426063066215248d77902c92e39dbc2b9645bfaa1eb8133a9b1e6eceeec9430ee0e227fcd5e535bedb4ed8c2dffd9a28b95a2a
7
- data.tar.gz: 0a6ce7072878da5125589c598fa4dd2d3a9339159341e88ac2dc67fd0edd6dbf12fd857841faa58bb425ef0bb19adebbe544e9902fd8c35ee44008e9e95c75ea
6
+ metadata.gz: 0b1f4fe293cd18d174b6e059a66ebdf78da9c98f7f9bcd542268296f0908b27dc38d5e40c4564316da7f0843f8fbf07653023fd79ed359eeab1dd27e41cf2fe1
7
+ data.tar.gz: ef2e58f5e102d15a963c1e9f29b5802b510f277194dd2ec1cf20a5b83b19c558f596c383d9e2aafa6176de6116066b4a45203bebee9d169b39dae40f254b49ff
@@ -1,3 +1,3 @@
1
1
  module Watchman
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/watchman.rb CHANGED
@@ -1,34 +1,20 @@
1
1
  require "watchman/version"
2
2
  require "benchmark"
3
- require "socket"
3
+ require "statsd"
4
4
 
5
5
  module Watchman
6
- module_function
6
+ extend self
7
7
 
8
- require_relative "watchman/store"
8
+ attr_accessor :prefix
9
+ attr_accessor :host
10
+ attr_accessor :port
9
11
 
10
- def prefix=(value)
11
- @prefix = value
12
- end
13
-
14
- def host=(host)
15
- @host = host
16
- end
17
-
18
- def host
19
- @host
20
- end
21
-
22
- def port=(port)
23
- @port = port
24
- end
25
-
26
- def port
27
- @port
12
+ def statsd_client
13
+ @client ||= Statsd.new(@host, @port)
28
14
  end
29
15
 
30
16
  def submit(name, value)
31
- Watchman::Store.save(metric_name_with_prefix(name), value)
17
+ statsd_client.gauge(metric_name_with_prefix(name), value)
32
18
  end
33
19
 
34
20
  def benchmark(name)
@@ -38,7 +24,7 @@ module Watchman
38
24
  result = yield
39
25
  end
40
26
 
41
- submit(name, (time.real * 1000).floor)
27
+ statsd_client.timing(metric_name_with_prefix(name), (time.real * 1000).floor)
42
28
 
43
29
  result
44
30
  end
data/watchman.gemspec CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
+ spec.add_dependency "statsd-ruby", "~> 1.3.0"
21
+
20
22
  spec.add_development_dependency "bundler", "~> 1.10"
21
23
  spec.add_development_dependency "rake", "~> 10.0"
22
24
  spec.add_development_dependency "rspec"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rt-watchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rendered Text
@@ -10,6 +10,20 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: statsd-ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -69,7 +83,6 @@ files:
69
83
  - bin/console
70
84
  - bin/setup
71
85
  - lib/watchman.rb
72
- - lib/watchman/store.rb
73
86
  - lib/watchman/version.rb
74
87
  - watchman.gemspec
75
88
  homepage:
@@ -1,11 +0,0 @@
1
- module Watchman::Store
2
- module_function
3
-
4
- def save(name, value)
5
- message = "#{name}:#{value}|g"
6
-
7
- puts "Sending [#{Watchman.host}:#{Watchman.port}] '#{message}'"
8
-
9
- UDPSocket.new.send(message, 0, Watchman.host, Watchman.port)
10
- end
11
- end