rt-watchman 0.8.0 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6268d12059b4dcce2e1884056fb5e3f9a58ccc8
4
- data.tar.gz: fc3e6c4d5fedf0a396779871a93dcbbbbc875ead
3
+ metadata.gz: 2518ea25e48bd1335da7036b1f356abe99707b95
4
+ data.tar.gz: 8761422a4906f54a9a90a1cb0555d60173036e0f
5
5
  SHA512:
6
- metadata.gz: 681b25d34ff7c9d87f667c772f998f7484cdef2b6480865440773163e60ae4e7151de217433f58479856781d3558f2fb21ccc8e165f6d032575a7f865f483271
7
- data.tar.gz: c1647d66696b54332c9d7ebed2a1a86041120a88ceeb8c4e1aee40bbe1d824c5fae6a206473700a2e0430a16ca7874e01d0bb9ceb62742c8bf48c811170613b7
6
+ metadata.gz: 910ff071eebce01b84107f71db699907b4a4eb29f680a2f5749143b2320cf8ecd12d6aefde11f00b93be8445839240772e336e26c76529a50120d2a2d93fac3f
7
+ data.tar.gz: 26f3715758b471d21d25678a49bd9d9d2a680321abcaf2c02b73995876e8c3fbe2314fc8449b0c120675bcfb21a5da19d0cc3e0a3bc1194611435503e55fbc28
data/README.md CHANGED
@@ -36,26 +36,9 @@ end
36
36
  To submit a time value in miliseconds:
37
37
 
38
38
  ``` ruby
39
- Watchman.submit("number.of.kittens", 30, type: :timing)
39
+ Watchman.submit("number.of.kittens", 30, :timing)
40
40
  ```
41
41
 
42
- ## Tags
43
-
44
- If you want to use a variable that changes often, don't use this:
45
-
46
- ``` ruby
47
- Watchman.submit("user.#{id}", 30)
48
- ```
49
-
50
- Use tags. A list of tags is an optional last parameter of `:submit`, `:benchmark`,
51
- `:increment` and `:decrement` methods.
52
-
53
- ``` ruby
54
- Watchman.submit("user", 30, tags: ["#{id}"])
55
- ```
56
-
57
- Tags list is limited to 3 values.
58
-
59
42
  ## Global metric prefix
60
43
 
61
44
  If you want to prepend all the metric names with a prefix, do the following:
@@ -1,3 +1,3 @@
1
1
  class Watchman
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
data/lib/watchman.rb CHANGED
@@ -12,11 +12,8 @@ class Watchman
12
12
  attr_accessor :port
13
13
  attr_accessor :test_mode
14
14
 
15
- def submit(name, value, args = {})
16
- type = args[:type] || :gauge
17
- tags = args[:tags] || []
18
-
19
- metric = metric_name_with_prefix(name, tags)
15
+ def submit(name, value, type = :gauge)
16
+ metric = metric_name_with_prefix(name)
20
17
 
21
18
  case type
22
19
  when :gauge then statsd_client.gauge(metric, value)
@@ -26,30 +23,24 @@ class Watchman
26
23
  end
27
24
  end
28
25
 
29
- def benchmark(name, args = {})
30
- tags = args[:tags] || []
31
-
26
+ def benchmark(name)
32
27
  result = nil
33
28
 
34
29
  time = Benchmark.measure do
35
30
  result = yield
36
31
  end
37
32
 
38
- submit(name, (time.real * 1000).floor, type: :timing, tags: tags)
33
+ submit(name, (time.real * 1000).floor, :timing)
39
34
 
40
35
  result
41
36
  end
42
37
 
43
- def increment(name, args = {})
44
- tags = args[:tags] || []
45
-
46
- submit(name, 1, type: :count, tags: tags)
38
+ def increment(name)
39
+ submit(name, 1, :count)
47
40
  end
48
41
 
49
- def decrement(name, args = {})
50
- tags = args[:tags] || []
51
-
52
- submit(name, -1, type: :count, tags: tags)
42
+ def decrement(name)
43
+ submit(name, -1, :count)
53
44
  end
54
45
 
55
46
  private
@@ -62,20 +53,12 @@ class Watchman
62
53
  end
63
54
  end
64
55
 
65
- def metric_name_with_prefix(name, tags)
66
- full_name = []
67
- full_name << "tagged"
68
- full_name << @prefix if @prefix
69
- full_name << tags_string(tags)
70
- full_name << name
71
- full_name.join(".")
72
- end
73
-
74
- def tags_string(tags)
75
- tags
76
- .fill("no_tag", tags.length, [3 - tags.length, 0].max)
77
- .first(3)
78
- .join(".")
56
+ def metric_name_with_prefix(name)
57
+ if @prefix
58
+ "#{@prefix}.#{name}"
59
+ else
60
+ name
61
+ end
79
62
  end
80
63
  end
81
64
  end
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.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rendered Text