librato-metrics 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -0
- data/lib/librato/metrics/aggregator.rb +3 -0
- data/lib/librato/metrics/version.rb +1 -1
- data/spec/unit/metrics/aggregator_spec.rb +18 -0
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -22,6 +22,9 @@ module Librato
|
|
22
22
|
# @return [Aggregator] returns self
|
23
23
|
def add(measurements)
|
24
24
|
measurements.each do |metric, data|
|
25
|
+
if @prefix
|
26
|
+
metric = "#{@prefix}.#{metric}"
|
27
|
+
end
|
25
28
|
if data.respond_to?(:each) # hash form
|
26
29
|
value = data[:value]
|
27
30
|
if data[:source]
|
@@ -90,6 +90,24 @@ module Librato
|
|
90
90
|
]}
|
91
91
|
subject.queued.should equal_unordered(expected)
|
92
92
|
end
|
93
|
+
|
94
|
+
context "with a prefix set" do
|
95
|
+
it "should auto-prepend names" do
|
96
|
+
subject = Aggregator.new(:prefix => 'foo')
|
97
|
+
subject.add :bar => 1
|
98
|
+
subject.add :bar => 12
|
99
|
+
expected = {:gauges => [
|
100
|
+
{ :name =>'foo.bar',
|
101
|
+
:count => 2,
|
102
|
+
:sum => 13.0,
|
103
|
+
:min => 1.0,
|
104
|
+
:max => 12.0
|
105
|
+
}
|
106
|
+
]
|
107
|
+
}
|
108
|
+
subject.queued.should equal_unordered(expected)
|
109
|
+
end
|
110
|
+
end
|
93
111
|
end
|
94
112
|
|
95
113
|
context "with multiple hash arguments" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librato-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -215,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
215
|
version: '0'
|
216
216
|
segments:
|
217
217
|
- 0
|
218
|
-
hash:
|
218
|
+
hash: 1969424366302856225
|
219
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
220
|
none: false
|
221
221
|
requirements:
|