nightfury 0.2.1 → 0.3.0
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.
- data/Gemfile +2 -2
- data/lib/nightfury/metric/time_series.rb +7 -4
- data/lib/nightfury/version.rb +1 -1
- metadata +2 -2
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ module Nightfury
|
|
3
3
|
class TimeSeries < Base
|
4
4
|
|
5
5
|
def initialize(name, options={})
|
6
|
-
super(name, options
|
6
|
+
super(name, options)
|
7
7
|
init_time_series unless redis.exists(redis_key)
|
8
8
|
end
|
9
9
|
|
@@ -21,13 +21,15 @@ module Nightfury
|
|
21
21
|
data_point = ''
|
22
22
|
if timestamp
|
23
23
|
timestamp = timestamp.to_i
|
24
|
-
data_point = redis.zrangebyscore(redis_key, timestamp, timestamp, withscores: true)
|
24
|
+
data_point = redis.zrangebyscore(redis_key, timestamp, timestamp, withscores: true)
|
25
|
+
data_point = data_point.each_slice(2).map {|pair| pair }.last
|
25
26
|
else
|
26
|
-
data_point = redis.zrevrange(redis_key, 0, 0, withscores: true)
|
27
|
+
data_point = redis.zrevrange(redis_key, 0, 0, withscores: true)
|
28
|
+
data_point = data_point.each_slice(2).map {|pair| pair }.last
|
27
29
|
end
|
28
30
|
|
29
31
|
return nil if data_point.nil?
|
30
|
-
return nil if data_point[1] == 0
|
32
|
+
return nil if data_point[1] == "0"
|
31
33
|
|
32
34
|
time, data = decode_data_point(data_point)
|
33
35
|
{time => data}
|
@@ -74,6 +76,7 @@ module Nightfury
|
|
74
76
|
end
|
75
77
|
|
76
78
|
def decode_many_data_points(data_points)
|
79
|
+
data_points = data_points.each_slice(2).map {|pair| pair }
|
77
80
|
result = {}
|
78
81
|
data_points.each do |data_point|
|
79
82
|
time, data = decode_data_point(data_point)
|
data/lib/nightfury/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nightfury
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-12-
|
13
|
+
date: 2012-12-22 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Nightfury is a reporting/analytics backend written on Redis
|
16
16
|
email:
|