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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16477ce0296ad40319f56ba74622e19816b6739ef15f8ec1b173f560e6966020
4
- data.tar.gz: 878d7209216e9bed1b565ed607a4cb882b795efdf879cee33956377b8ddd4928
3
+ metadata.gz: e2c45958f94f534cf0041b70ce6505c70fb6ae69c285f36c50582857edaebfee
4
+ data.tar.gz: 67a0009a25108781eb10810ca6b8e326957f4e5ad4ac63f8e9ee241372d10a68
5
5
  SHA512:
6
- metadata.gz: 260b8d730198d05ae379e5b97c8135bc06d62b4ad69dc67e37b6af7a65a0c9ff8f13f3d4669e45280b7d7f4b14496d8ef62c35a0f57b5523b91d41bd8b3f46d2
7
- data.tar.gz: 3ab2ec330930620a7b20f911d5279e7cdab8c56fcf73472c8daae4d77630c315f355437c819beeae0b82038cf5f8ab5ba14df0234fed76e72a21b2e0b138c1ae
6
+ metadata.gz: dbfc27f5e79443424f864e143d4af9221622fa6abc60dfe2cb7601ec73c5ed930b0ead283228b938e46fed2058a17b7c00cae2b5bfefb162e6c3bf71a6102d32
7
+ data.tar.gz: d7308ff3214fbb43fa3415a9d3af01aaf677a915cacc17229fa93760cb216bafbd5716abe82bd4734454aa14000318db2e7f555fc796e13b68b0cfd070b8299b
data/Appraisals CHANGED
@@ -5,3 +5,7 @@ end
5
5
  appraise 'redis 4' do
6
6
  gem 'redis', '~> 4.0'
7
7
  end
8
+
9
+ appraise 'redis 5' do
10
+ gem 'redis', '~> 5.0'
11
+ end
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.current
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.current.flushall
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.current+
45
+ # @return [Redis] the current Redis client. Defaults to +Redis.new+
46
46
  def redis
47
- @redis ||= Redis.current
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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  class Redis
3
3
  class TimeSeries
4
- VERSION = '0.7.1'
4
+ VERSION = '0.8.0'
5
5
  end
6
6
  end
@@ -108,7 +108,7 @@ class Redis
108
108
  #
109
109
  def madd(data)
110
110
  data.reduce([]) do |memo, (key, value)|
111
- memo << parse_madd_values(key, value)
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.7.1
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: 2022-07-21 00:00:00.000000000 Z
11
+ date: 2023-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis