statue 0.2.4 → 0.2.5

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: 0ad0429120fff2abf1bb3905406e37e61e347c2d
4
- data.tar.gz: 09e9f50b30ea98cbe1ffec86650b9a4754d09b0f
3
+ metadata.gz: 3939f3f562f8c4fbae0db48ca49ab86a1889dda6
4
+ data.tar.gz: e409acf9ce5bb0bff8c5c4d08f361deff6eae1f0
5
5
  SHA512:
6
- metadata.gz: 3197c65521a5e76df0260ffdc70234d4778d9d94502e7476f646dadae7c8aef09a83572050b2272ae4864e393a5ceb7a3898e86dcd23ac858b60409277e47fce
7
- data.tar.gz: 51fbec4b07c67484e52b1493da416f73d2ea913f236510e7e8e93d237f867fbe3c2d6d920e36883537286c57aa784b50ba2e595a246275b44756cb016077129c
6
+ metadata.gz: 910afd03f5063cad4470ef38d3b8e999c4db9399280473b285153ede6fc79cda18e847ddb915ab6aaf39cb3ae56e6f80d3d7a353e833828a776d7a23400c1103
7
+ data.tar.gz: 0bed726638b82669e41e13ad503e9518fa5483073f96809b7354f64a1b073dfbac6c1a1a44f84ef6a6884a67fd7f02b6ed750e63abf0094051ffabb12e3efcea
data/README.md CHANGED
@@ -39,7 +39,9 @@ Statue.backend = Statue::LoggerBackend.new(Rails.logger)
39
39
 
40
40
  ### Common meassurments
41
41
 
42
- `Statue.report_increment('metric.name')` -> send to Statsd an increment for the counter `metric.name`
42
+ `Statue.report_increment('metric.name')` -> send to Statsd an increment to the counter `metric.name`
43
+
44
+ `Statue.report_gauge('metric.name', value)` -> send to Statsd the gauge value for `metric.name`
43
45
 
44
46
  `Statue.report_duration('metric.name') { some_operation } # => some_operation_result` -> send to Statsd the
45
47
  measure for the block duration in `metric.name`
@@ -19,8 +19,8 @@ module Statue
19
19
  result
20
20
  end
21
21
 
22
- def report_increment(metric_name, **options)
23
- backend << Metric.counter(metric_name, **options)
22
+ def report_increment(metric_name, value = 1, **options)
23
+ backend << Metric.counter(metric_name, value, **options)
24
24
  end
25
25
 
26
26
  def report_gauge(metric_name, value, **options)
@@ -1,3 +1,3 @@
1
1
  module Statue
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
@@ -12,6 +12,13 @@ describe Statue do
12
12
  assert_equal 1, Statue.backend.captures.size
13
13
  assert_equal "some.counter:1|c", Statue.backend.captures.first.to_s
14
14
  end
15
+
16
+ it "Allows to increment by a custom value" do
17
+ Statue.report_increment("some.counter", 5)
18
+
19
+ assert_equal 1, Statue.backend.captures.size
20
+ assert_equal "some.counter:5|c", Statue.backend.captures.first.to_s
21
+ end
15
22
  end
16
23
 
17
24
  describe ".report_duration" do
@@ -49,6 +56,17 @@ describe Statue do
49
56
 
50
57
  end
51
58
 
59
+ describe ".report_gauge" do
60
+
61
+ it "adds a gauge metric to the backend using the fixed value" do
62
+ result = Statue.report_gauge("some.gauge", 23)
63
+
64
+ assert_equal 1, Statue.backend.captures.size
65
+ assert_equal "some.gauge:23|g", Statue.backend.captures.first.to_s
66
+ end
67
+
68
+ end
69
+
52
70
  describe ".report_success_or_failure" do
53
71
 
54
72
  it "Adds a counter metric to the backend with .success suffix with a truthy result" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Barreneche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-11 00:00:00.000000000 Z
11
+ date: 2016-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler