librato-metrics 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -1,31 +1,25 @@
|
|
1
|
-
|
1
|
+
require 'multi_json'
|
2
|
+
|
2
3
|
module Librato
|
3
4
|
module Metrics
|
4
5
|
class SmartJSON
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
def write(data)
|
23
|
-
MultiJson.encode(data)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
6
|
+
JSON_HANDLER = MultiJson
|
7
|
+
extend SingleForwardable
|
8
|
+
|
9
|
+
# wrap MultiJSON's implementation so we can use any version
|
10
|
+
# prefer modern syntax if available; def once at startup
|
11
|
+
if JSON_HANDLER.respond_to?(:load)
|
12
|
+
def_delegator JSON_HANDLER, :load, :read
|
13
|
+
else
|
14
|
+
def_delegator JSON_HANDLER, :decode, :read
|
15
|
+
end
|
16
|
+
|
17
|
+
if JSON_HANDLER.respond_to?(:dump)
|
18
|
+
def_delegator JSON_HANDLER, :dump, :write
|
19
|
+
else
|
20
|
+
def_delegator JSON_HANDLER, :encode, :write
|
27
21
|
end
|
28
22
|
|
29
23
|
end
|
30
24
|
end
|
31
|
-
end
|
25
|
+
end
|
data/lib/librato/metrics.rb
CHANGED
@@ -211,7 +211,7 @@ module Librato
|
|
211
211
|
Metrics.submit :foo => 123
|
212
212
|
end
|
213
213
|
|
214
|
-
it "should
|
214
|
+
it "should update the metric" do
|
215
215
|
Metrics.update :foo, :display_name => "Foo Metric",
|
216
216
|
:period => 15,
|
217
217
|
:attributes => {
|
@@ -220,7 +220,7 @@ module Librato
|
|
220
220
|
foo = Metrics.fetch :foo
|
221
221
|
foo['display_name'].should == 'Foo Metric'
|
222
222
|
foo['period'].should == 15
|
223
|
-
foo['attributes'].should ==
|
223
|
+
foo['attributes']['display_max'].should == 1000
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
@@ -236,7 +236,7 @@ module Librato
|
|
236
236
|
foo = Metrics.fetch :foo
|
237
237
|
foo['display_name'].should == 'Foo Metric'
|
238
238
|
foo['period'].should == 15
|
239
|
-
foo['attributes'].should ==
|
239
|
+
foo['attributes']['display_max'].should == 1000
|
240
240
|
end
|
241
241
|
|
242
242
|
it "should raise error if no type specified" do
|
@@ -5,8 +5,8 @@ module Librato
|
|
5
5
|
describe Aggregator do
|
6
6
|
|
7
7
|
before(:all) do
|
8
|
-
@time = Time.now.to_i
|
9
|
-
Aggregator.stub(:epoch_time).and_return(@time)
|
8
|
+
@time = 1354720160 #Time.now.to_i
|
9
|
+
Aggregator.any_instance.stub(:epoch_time).and_return(@time)
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "initialization" do
|
@@ -6,8 +6,8 @@ module Librato
|
|
6
6
|
describe Queue do
|
7
7
|
|
8
8
|
before(:each) do
|
9
|
-
@time = Time.now.to_i
|
10
|
-
|
9
|
+
@time = 1354720160 #Time.now.to_i
|
10
|
+
Queue.any_instance.stub(:epoch_time).and_return(@time)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "initialization" 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: 1.0.
|
4
|
+
version: 1.0.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-12-
|
12
|
+
date: 2012-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -218,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
218
|
version: '0'
|
219
219
|
segments:
|
220
220
|
- 0
|
221
|
-
hash:
|
221
|
+
hash: 2478461788804600344
|
222
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
223
|
none: false
|
224
224
|
requirements:
|