statue 0.2.4 → 0.2.5
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 +3 -1
- data/lib/statue.rb +2 -2
- data/lib/statue/version.rb +1 -1
- data/test/statue_test.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3939f3f562f8c4fbae0db48ca49ab86a1889dda6
|
4
|
+
data.tar.gz: e409acf9ce5bb0bff8c5c4d08f361deff6eae1f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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`
|
data/lib/statue.rb
CHANGED
@@ -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)
|
data/lib/statue/version.rb
CHANGED
data/test/statue_test.rb
CHANGED
@@ -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
|
+
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
|
+
date: 2016-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|