ocular 0.1.23 → 0.1.24
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/lib/ocular/dsl/graphite.rb +10 -5
- data/lib/ocular/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 316022fd097e085fa6bfd91b6ce1baf46f12d458
|
4
|
+
data.tar.gz: e10b9dbc099127070f54681b9ea215acd8220466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c1f85f5447e80ec369749deee353020c57c156a4696e809300508d387bca78ce853ea1d3575e667f0b93c10e772f48e55de481be25cf7fde8a2a67fb94ff5f8
|
7
|
+
data.tar.gz: 9ce0461428b50be7e453caeb5c2df77c9099ef7ee2ffd061a983a824618e1fa3d02764fe5d973cec3172ad485c23bdcb1213f1f8f2f7058735e9ea77fa6c8ce9
|
data/lib/ocular/dsl/graphite.rb
CHANGED
@@ -52,12 +52,17 @@ class Ocular
|
|
52
52
|
values = {}
|
53
53
|
response = graphite(target, options)
|
54
54
|
response.each do |reply|
|
55
|
-
# Discard null replies
|
56
|
-
# sort in descending order
|
57
|
-
# pick latests datapoint
|
58
|
-
# from that pick the value
|
59
55
|
if reply and reply["datapoints"] and reply["datapoints"].length > 0
|
60
|
-
|
56
|
+
# Discard null replies
|
57
|
+
not_null = reply["datapoints"].select {|x| x and x[0] }
|
58
|
+
|
59
|
+
# sort in descending order
|
60
|
+
not_null.sort! {|a,b| b[1] <=> a[1]}
|
61
|
+
if not_null.length > 0
|
62
|
+
# pick latests datapoint
|
63
|
+
# from that pick the value
|
64
|
+
values[reply["target"]] = not_null.first[0]
|
65
|
+
end
|
61
66
|
end
|
62
67
|
end
|
63
68
|
|
data/lib/ocular/version.rb
CHANGED