redis-time-series 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +4 -0
- data/CHANGELOG.md +9 -0
- data/README.md +7 -1
- data/bin/setup +1 -1
- data/lib/redis/time_series/client.rb +3 -3
- data/lib/redis/time_series/version.rb +1 -1
- data/lib/redis/time_series.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2c45958f94f534cf0041b70ce6505c70fb6ae69c285f36c50582857edaebfee
|
4
|
+
data.tar.gz: 67a0009a25108781eb10810ca6b8e326957f4e5ad4ac63f8e9ee241372d10a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbfc27f5e79443424f864e143d4af9221622fa6abc60dfe2cb7601ec73c5ed930b0ead283228b938e46fed2058a17b7c00cae2b5bfefb162e6c3bf71a6102d32
|
7
|
+
data.tar.gz: d7308ff3214fbb43fa3415a9d3af01aaf677a915cacc17229fa93760cb216bafbd5716abe82bd4734454aa14000318db2e7f555fc796e13b68b0cfd070b8299b
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 0.8.0
|
6
|
+
* Remove usage of `Redis.current` (#78)
|
7
|
+
* Fix flaky aggregation spec (#80)
|
8
|
+
* Compatibility updates and spec fixes (#81)
|
9
|
+
* Add redis-rb 5.x to appraisals (#83)
|
10
|
+
|
11
|
+
## 0.7.2
|
12
|
+
* Fix sample building for TS.MADD with multiple series (#77)
|
13
|
+
|
5
14
|
## 0.7.1
|
6
15
|
* Handle ActiveSupport::TimeWithZone objects (#75)
|
7
16
|
|
data/README.md
CHANGED
@@ -50,6 +50,12 @@ Or install it yourself as:
|
|
50
50
|
|
51
51
|
Check out the Redis Time Series [command documentation](https://oss.redislabs.com/redistimeseries/master/commands/) first. Should be able to do most of that.
|
52
52
|
|
53
|
+
### Configuring
|
54
|
+
You can set the default Redis client for class-level calls operating on multiple series, as well as series created without specifying a client.
|
55
|
+
```ruby
|
56
|
+
Redis::TimeSeries.redis = Redis.new(url: ENV['REDIS_URL'], timeout: 1)
|
57
|
+
```
|
58
|
+
|
53
59
|
### Creating a Series
|
54
60
|
Create a series (issues `TS.CREATE` command) and return a Redis::TimeSeries object for further use. Key param is required, all other arguments are optional.
|
55
61
|
```ruby
|
@@ -58,7 +64,7 @@ ts = Redis::TimeSeries.create(
|
|
58
64
|
labels: { foo: 'bar' },
|
59
65
|
retention: 600,
|
60
66
|
uncompressed: false,
|
61
|
-
redis: Redis.new(url: ENV['REDIS_URL']) # defaults to Redis.
|
67
|
+
redis: Redis.new(url: ENV['REDIS_URL']) # defaults to Redis::TimeSeries.redis
|
62
68
|
)
|
63
69
|
```
|
64
70
|
You can also call `.new` instead of `.create` to skip the `TS.CREATE` command.
|
data/bin/setup
CHANGED
@@ -10,7 +10,7 @@ require 'active_support/core_ext/numeric/time'
|
|
10
10
|
require 'redis'
|
11
11
|
require 'redis-time-series'
|
12
12
|
|
13
|
-
Redis.
|
13
|
+
Redis.new.flushall
|
14
14
|
ts1 = Redis::TimeSeries.create('ts1')
|
15
15
|
ts2 = Redis::TimeSeries.create('ts2')
|
16
16
|
ts3 = Redis::TimeSeries.create('ts3')
|
@@ -42,9 +42,9 @@ class Redis
|
|
42
42
|
@debug = !!bool
|
43
43
|
end
|
44
44
|
|
45
|
-
# @return [Redis] the current Redis client. Defaults to +Redis.
|
45
|
+
# @return [Redis] the current Redis client. Defaults to +Redis.new+
|
46
46
|
def redis
|
47
|
-
@redis ||= Redis.
|
47
|
+
@redis ||= Redis.new
|
48
48
|
end
|
49
49
|
|
50
50
|
# Set the default Redis client for time series objects.
|
@@ -68,7 +68,7 @@ class Redis
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def cmd_with_redis(redis, name, *args)
|
71
|
-
args = args.flatten.compact.map { |arg| arg.is_a?(Time) ? arg.ts_msec : arg }
|
71
|
+
args = args.flatten.compact.map { |arg| arg.is_a?(Time) ? arg.ts_msec : arg.to_s }
|
72
72
|
puts "DEBUG: #{name} #{args.join(' ')}" if debug
|
73
73
|
redis.call name, args
|
74
74
|
end
|
data/lib/redis/time_series.rb
CHANGED
@@ -108,7 +108,7 @@ class Redis
|
|
108
108
|
#
|
109
109
|
def madd(data)
|
110
110
|
data.reduce([]) do |memo, (key, value)|
|
111
|
-
memo
|
111
|
+
memo += parse_madd_values(key, value)
|
112
112
|
memo
|
113
113
|
end.then do |args|
|
114
114
|
cmd('TS.MADD', args).each_with_index.map do |result, idx|
|
@@ -214,7 +214,7 @@ class Redis
|
|
214
214
|
end
|
215
215
|
else
|
216
216
|
# single value, no timestamp
|
217
|
-
[key, '*', raw]
|
217
|
+
[[key, '*', raw]]
|
218
218
|
end
|
219
219
|
end
|
220
220
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-time-series
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Duszynski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|