rt-watchman 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/watchman/mock_statsd.rb +11 -0
- data/lib/watchman/version.rb +1 -1
- data/lib/watchman.rb +8 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4357d1bedf41f88aaa7eb347953ca9dfbd4fd76d
|
4
|
+
data.tar.gz: c7fbe92bd341a5a2a5b001f32c28ecfeb2b2125e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8386887ab93b52f9ec3cfdbd14d6b5a4c207284cd39c7340aa4793ca7458d93b4bdb9c1e4fcbadf952607eac25bf40525d438fab0cf2609091ba7017899d9072
|
7
|
+
data.tar.gz: 210d9fb9a0a4396ab88ba366c3e9c2d4e80bc56320ee6f19377588441878f1da5c6c0d3c282be282b01fb06e2e1bca0eec3abcc50698973c8915bb6e697a983e
|
data/README.md
CHANGED
@@ -52,3 +52,14 @@ Then, all your metrics will be saved with that prefix. For example:
|
|
52
52
|
``` ruby
|
53
53
|
Watchman.submit("high.score", 100) # => production.server1.high.score = 100
|
54
54
|
```
|
55
|
+
|
56
|
+
## Test mode for Watchman
|
57
|
+
|
58
|
+
In tests you can set the following:
|
59
|
+
|
60
|
+
``` ruby
|
61
|
+
Watchman.test_mode = true
|
62
|
+
```
|
63
|
+
|
64
|
+
That way watchman will use a stubbed client, and won't send any data to the
|
65
|
+
metric server.
|
data/lib/watchman/version.rb
CHANGED
data/lib/watchman.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "watchman/version"
|
2
|
+
require "watchman/mock_statsd"
|
2
3
|
require "benchmark"
|
3
4
|
require "statsd"
|
4
5
|
|
@@ -9,6 +10,7 @@ class Watchman
|
|
9
10
|
attr_accessor :prefix
|
10
11
|
attr_accessor :host
|
11
12
|
attr_accessor :port
|
13
|
+
attr_accessor :test_mode
|
12
14
|
|
13
15
|
def submit(name, value, type = :gauge)
|
14
16
|
metric = metric_name_with_prefix(name)
|
@@ -44,10 +46,14 @@ class Watchman
|
|
44
46
|
private
|
45
47
|
|
46
48
|
def statsd_client
|
47
|
-
@
|
49
|
+
if @test_mode == true
|
50
|
+
Watchman::MockStatsd.new
|
51
|
+
else
|
52
|
+
@client ||= Statsd.new(@host, @port)
|
53
|
+
end
|
48
54
|
end
|
49
55
|
|
50
|
-
|
56
|
+
def metric_name_with_prefix(name)
|
51
57
|
if @prefix
|
52
58
|
"#{@prefix}.#{name}"
|
53
59
|
else
|
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.
|
4
|
+
version: 0.7.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-
|
11
|
+
date: 2016-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: statsd-ruby
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- bin/console
|
84
84
|
- bin/setup
|
85
85
|
- lib/watchman.rb
|
86
|
+
- lib/watchman/mock_statsd.rb
|
86
87
|
- lib/watchman/version.rb
|
87
88
|
- watchman.gemspec
|
88
89
|
homepage:
|