fluent-plugin-ddl-redis-store 0.3.0 → 0.3.2
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/.github/CODEOWNERS +1 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +25 -0
- data/.github/workflows/test.yml +44 -0
- data/.gitignore +7 -0
- data/README.md +46 -5
- data/Rakefile +8 -1
- data/domino.yml +7 -0
- data/fluent-plugin-ddl-redis-store.gemspec +3 -2
- data/lib/fluent/plugin/out_redis_store.rb +31 -30
- data/renovate.json +20 -0
- data/test/integration/test_out_redis_store_integration.rb +151 -0
- metadata +32 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88744c7b86deb03ab629da9f4cf4ffbb771e915ed4e92f6d135d92d2ca4e857f
|
|
4
|
+
data.tar.gz: 63a52311c27e78ded58f72a048966cc48d451652da1b06f0a9b025532f27b4d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c911933d1521381f057b5ab875d4bf7a14b238c05336ec7c6f2c14a3f92e3419a1a0340ea5954a495037f53b6f2c68a1d16be2e1897b5f1e6df3be9ef5036b4e
|
|
7
|
+
data.tar.gz: 55462b877d5cd62505d5bff524de7487b24e4c50a56ee6a33f1607c55211e870d2948b26d9ca9fe4ed5f83e4b00215e0864b94471a6c736ce75f3542c4eb69cf
|
data/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @cerebrotech/eng-distributions
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
## PR Type
|
|
2
|
+
What kind of change does this PR introduce?
|
|
3
|
+
|
|
4
|
+
<!-- Please check the one that applies to this PR using "x". -->
|
|
5
|
+
- [ ] Bugfix
|
|
6
|
+
- [ ] Feature
|
|
7
|
+
- [ ] Code style update (formatting)
|
|
8
|
+
- [ ] Refactoring (no functional changes)
|
|
9
|
+
- [ ] CI-related changes
|
|
10
|
+
- [ ] Other... Please describe:
|
|
11
|
+
|
|
12
|
+
## What is the current behavior?
|
|
13
|
+
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
|
|
14
|
+
|
|
15
|
+
Issue Number: https://dominodatalab.atlassian.net/browse/PLAT-XYZ
|
|
16
|
+
|
|
17
|
+
## What is the new behavior?
|
|
18
|
+
|
|
19
|
+
## Does this PR introduce a breaking change?
|
|
20
|
+
- [ ] Yes
|
|
21
|
+
- [ ] No
|
|
22
|
+
|
|
23
|
+
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
|
|
24
|
+
|
|
25
|
+
## Other information
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [master]
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
unit:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
ruby: ["3.2", "3.3", "3.4"]
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: ruby/setup-ruby@v1
|
|
16
|
+
with:
|
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
|
18
|
+
bundler-cache: true
|
|
19
|
+
- run: bundle exec rake test
|
|
20
|
+
|
|
21
|
+
integration:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
services:
|
|
24
|
+
redis:
|
|
25
|
+
image: redis:7-alpine
|
|
26
|
+
ports: ["6379:6379"]
|
|
27
|
+
options: >-
|
|
28
|
+
--health-cmd "redis-cli ping"
|
|
29
|
+
--health-interval 5s
|
|
30
|
+
--health-timeout 3s
|
|
31
|
+
--health-retries 5
|
|
32
|
+
strategy:
|
|
33
|
+
matrix:
|
|
34
|
+
ruby: ["3.2", "3.3", "3.4"]
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: ruby/setup-ruby@v1
|
|
38
|
+
with:
|
|
39
|
+
ruby-version: ${{ matrix.ruby }}
|
|
40
|
+
bundler-cache: true
|
|
41
|
+
- run: bundle exec rake test:integration
|
|
42
|
+
env:
|
|
43
|
+
REDIS_HOST: 127.0.0.1
|
|
44
|
+
REDIS_PORT: 6379
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -10,15 +10,31 @@ Requirements
|
|
|
10
10
|
|
|
11
11
|
| fluent-plugin-redis-store | fluentd | ruby |
|
|
12
12
|
|------------------------|---------|------|
|
|
13
|
-
| >= 0.
|
|
13
|
+
| >= 0.3.0 | >= v0.14.15 | >= 3.2 |
|
|
14
|
+
| >= 0.2.0, < 0.3.0 | >= v0.14.15 | >= 2.1 |
|
|
14
15
|
| < 0.2.0 | >= v0.12.0 | >= 1.9 |
|
|
15
16
|
|
|
16
17
|
Background
|
|
17
18
|
----------
|
|
18
19
|
|
|
19
|
-
This is
|
|
20
|
+
This is a forked project from [fluent-plugin-redis-store][].
|
|
21
|
+
|
|
22
|
+
[fluent-plugin-redis-store]: https://github.com/pokehanai/fluent-plugin-redis-store/
|
|
23
|
+
|
|
24
|
+
Release Process
|
|
25
|
+
---------------
|
|
26
|
+
1. Bump `version` in `fluent-plugin-ddl-redis-store.gemspec`
|
|
27
|
+
2. Bump `version` in `domino.yml` to match. It is **not** kept in sync automatically —
|
|
28
|
+
unlike sibling `domino.yml`s that track an external base image via Renovate, this one
|
|
29
|
+
tracks the gem's own release number, which nothing here polls or rewrites for you.
|
|
30
|
+
3. `gem build fluent-plugin-ddl-redis-store.gemspec`
|
|
31
|
+
4. `gem push <.gem file>` (with the gem file generated in the previous step)
|
|
32
|
+
Ex: `gem push fluent-plugin-ddl-redis-store-0.3.1.gem`
|
|
33
|
+
|
|
34
|
+
The `push` command needs to be authenticated with [RubyGems.org](https://rubygems.org/).
|
|
35
|
+
|
|
36
|
+
Latest release: https://rubygems.org/gems/fluent-plugin-ddl-redis-store
|
|
20
37
|
|
|
21
|
-
[fluent-plugin-redisstore]: https://github.com/moaikids/fluent-plugin-redisstore
|
|
22
38
|
|
|
23
39
|
Features
|
|
24
40
|
--------
|
|
@@ -92,10 +108,10 @@ Installation
|
|
|
92
108
|
------------
|
|
93
109
|
|
|
94
110
|
```bash
|
|
95
|
-
fluent-gem install fluent-plugin-redis-store
|
|
111
|
+
fluent-gem install fluent-plugin-ddl-redis-store
|
|
96
112
|
|
|
97
113
|
# or if you are using td-agent:
|
|
98
|
-
td-agent-gem install fluent-plugin-redis-store
|
|
114
|
+
td-agent-gem install fluent-plugin-ddl-redis-store
|
|
99
115
|
```
|
|
100
116
|
|
|
101
117
|
Configuration
|
|
@@ -161,6 +177,31 @@ based on *timestamp* and it deletes expired _members_ every after new event data
|
|
|
161
177
|
No more options than common options.
|
|
162
178
|
|
|
163
179
|
|
|
180
|
+
Testing
|
|
181
|
+
-------
|
|
182
|
+
|
|
183
|
+
Unit tests (`test/plugin/`) stub out the `Redis` class entirely and only exercise
|
|
184
|
+
config parsing and key/value traversal -- they cannot detect a redis-rb client API
|
|
185
|
+
break.
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
bundle exec rake test
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Integration tests (`test/integration/`) run against a real Redis server and assert
|
|
192
|
+
on actual `ZCARD`/`LLEN`/`GET`/etc. Start one first:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
docker run -d --rm -p 6379:6379 redis:7-alpine
|
|
196
|
+
bundle exec rake test:integration
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
They read `REDIS_HOST`/`REDIS_PORT` from the environment (default `127.0.0.1:6379`)
|
|
200
|
+
and are skipped with a message if no Redis is reachable.
|
|
201
|
+
|
|
202
|
+
Note: redis-rb 6.x requires Ruby 3.2+; if your local Ruby is older, run both tasks
|
|
203
|
+
inside a container that matches the target fluentd image's Ruby/redis-rb version.
|
|
204
|
+
|
|
164
205
|
Contributors
|
|
165
206
|
------------
|
|
166
207
|
|
data/Rakefile
CHANGED
|
@@ -4,7 +4,14 @@ require "bundler/gem_tasks"
|
|
|
4
4
|
require 'rake/testtask'
|
|
5
5
|
Rake::TestTask.new(:test) do |test|
|
|
6
6
|
test.libs << 'lib' << 'test'
|
|
7
|
-
test.pattern = 'test/**/test_*.rb'
|
|
7
|
+
test.pattern = 'test/plugin/**/test_*.rb'
|
|
8
|
+
test.verbose = true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
desc "Integration tests against a real Redis server (see test/integration for setup)"
|
|
12
|
+
Rake::TestTask.new('test:integration') do |test|
|
|
13
|
+
test.libs << 'lib' << 'test'
|
|
14
|
+
test.pattern = 'test/integration/**/test_*.rb'
|
|
8
15
|
test.verbose = true
|
|
9
16
|
end
|
|
10
17
|
|
data/domino.yml
ADDED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Gem::Specification.new do |gem|
|
|
3
3
|
gem.name = "fluent-plugin-ddl-redis-store"
|
|
4
4
|
gem.email = "builds@dominodatalab.com"
|
|
5
|
-
gem.version = "0.3.
|
|
5
|
+
gem.version = "0.3.2"
|
|
6
6
|
gem.authors = ["moaikids", "HANAI Tohru aka pokehanai"]
|
|
7
7
|
gem.licenses = ["Apache License Version 2.0"]
|
|
8
8
|
gem.summary = %q{Redis(zset/set/list/string/publish) output plugin for Fluentd}
|
|
@@ -17,5 +17,6 @@ Gem::Specification.new do |gem|
|
|
|
17
17
|
gem.add_development_dependency "rake"
|
|
18
18
|
gem.add_development_dependency "test-unit"
|
|
19
19
|
gem.add_runtime_dependency "fluentd", [">= 0.14.15", "< 2"]
|
|
20
|
-
gem.add_runtime_dependency "redis"
|
|
20
|
+
gem.add_runtime_dependency "redis", [">= 5.0", "< 7"]
|
|
21
|
+
gem.add_runtime_dependency "yajl-ruby", "~> 1.4"
|
|
21
22
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'fluent/plugin/output'
|
|
2
|
+
require 'yajl'
|
|
2
3
|
|
|
3
4
|
module Fluent::Plugin
|
|
4
5
|
class RedisStoreOutput < Output
|
|
@@ -55,10 +56,10 @@ module Fluent::Plugin
|
|
|
55
56
|
super
|
|
56
57
|
if @path
|
|
57
58
|
@redis = Redis.new(:path => @path, :password => @password,
|
|
58
|
-
:timeout => @timeout, :
|
|
59
|
+
:timeout => @timeout, :db => @db)
|
|
59
60
|
else
|
|
60
61
|
@redis = Redis.new(:host => @host, :port => @port, :password => @password,
|
|
61
|
-
:timeout => @timeout, :
|
|
62
|
+
:timeout => @timeout, :db => @db)
|
|
62
63
|
end
|
|
63
64
|
end
|
|
64
65
|
|
|
@@ -80,7 +81,7 @@ module Fluent::Plugin
|
|
|
80
81
|
end
|
|
81
82
|
|
|
82
83
|
def write(chunk)
|
|
83
|
-
@redis.pipelined {
|
|
84
|
+
@redis.pipelined { |pipeline|
|
|
84
85
|
chunk.open { |io|
|
|
85
86
|
begin
|
|
86
87
|
MessagePack::Unpacker.new(io).each { |message|
|
|
@@ -88,15 +89,15 @@ module Fluent::Plugin
|
|
|
88
89
|
(_, time, record) = message
|
|
89
90
|
case @store_type
|
|
90
91
|
when 'zset'
|
|
91
|
-
operation_for_zset(record, time)
|
|
92
|
+
operation_for_zset(pipeline, record, time)
|
|
92
93
|
when 'set'
|
|
93
|
-
operation_for_set(record)
|
|
94
|
+
operation_for_set(pipeline, record)
|
|
94
95
|
when 'list'
|
|
95
|
-
operation_for_list(record)
|
|
96
|
+
operation_for_list(pipeline, record)
|
|
96
97
|
when 'string'
|
|
97
|
-
operation_for_string(record)
|
|
98
|
+
operation_for_string(pipeline, record)
|
|
98
99
|
when 'publish'
|
|
99
|
-
operation_for_publish(record)
|
|
100
|
+
operation_for_publish(pipeline, record)
|
|
100
101
|
end
|
|
101
102
|
rescue NoMethodError => e
|
|
102
103
|
puts e
|
|
@@ -113,66 +114,66 @@ module Fluent::Plugin
|
|
|
113
114
|
}
|
|
114
115
|
end
|
|
115
116
|
|
|
116
|
-
def operation_for_zset(record, time)
|
|
117
|
+
def operation_for_zset(pipeline, record, time)
|
|
117
118
|
key = get_key_from(record)
|
|
118
119
|
value = get_value_from(record)
|
|
119
120
|
score = get_score_from(record, time)
|
|
120
121
|
if @collision_policy
|
|
121
122
|
if @collision_policy == 'NX'
|
|
122
|
-
|
|
123
|
+
pipeline.zadd(key, score, value, :nx => true)
|
|
123
124
|
elsif @collision_policy == 'XX'
|
|
124
|
-
|
|
125
|
+
pipeline.zadd(key, score, value, :xx => true)
|
|
125
126
|
end
|
|
126
127
|
else
|
|
127
|
-
|
|
128
|
+
pipeline.zadd(key, score, value)
|
|
128
129
|
end
|
|
129
130
|
|
|
130
|
-
set_key_expire key
|
|
131
|
+
set_key_expire pipeline, key
|
|
131
132
|
if 0 < @value_expire
|
|
132
133
|
now = Time.now.to_i
|
|
133
|
-
|
|
134
|
+
pipeline.zremrangebyscore key , '-inf' , (now - @value_expire)
|
|
134
135
|
end
|
|
135
136
|
if 0 < @value_length
|
|
136
137
|
script = generate_zremrangebyrank_script(key, @value_length, @order)
|
|
137
|
-
|
|
138
|
+
pipeline.eval script
|
|
138
139
|
end
|
|
139
140
|
end
|
|
140
141
|
|
|
141
|
-
def operation_for_set(record)
|
|
142
|
+
def operation_for_set(pipeline, record)
|
|
142
143
|
key = get_key_from(record)
|
|
143
144
|
value = get_value_from(record)
|
|
144
|
-
|
|
145
|
-
set_key_expire key
|
|
145
|
+
pipeline.sadd key, value
|
|
146
|
+
set_key_expire pipeline, key
|
|
146
147
|
end
|
|
147
148
|
|
|
148
|
-
def operation_for_list(record)
|
|
149
|
+
def operation_for_list(pipeline, record)
|
|
149
150
|
key = get_key_from(record)
|
|
150
151
|
value = get_value_from(record)
|
|
151
152
|
|
|
152
153
|
if @order == 'asc'
|
|
153
|
-
|
|
154
|
+
pipeline.rpush key, value
|
|
154
155
|
else
|
|
155
|
-
|
|
156
|
+
pipeline.lpush key, value
|
|
156
157
|
end
|
|
157
|
-
set_key_expire key
|
|
158
|
+
set_key_expire pipeline, key
|
|
158
159
|
if 0 < @value_length
|
|
159
160
|
script = generate_ltrim_script(key, @value_length, @order)
|
|
160
|
-
|
|
161
|
+
pipeline.eval script
|
|
161
162
|
end
|
|
162
163
|
end
|
|
163
164
|
|
|
164
|
-
def operation_for_string(record)
|
|
165
|
+
def operation_for_string(pipeline, record)
|
|
165
166
|
key = get_key_from(record)
|
|
166
167
|
value = get_value_from(record)
|
|
167
|
-
|
|
168
|
+
pipeline.set key, value
|
|
168
169
|
|
|
169
|
-
set_key_expire key
|
|
170
|
+
set_key_expire pipeline, key
|
|
170
171
|
end
|
|
171
172
|
|
|
172
|
-
def operation_for_publish(record)
|
|
173
|
+
def operation_for_publish(pipeline, record)
|
|
173
174
|
key = get_key_from(record)
|
|
174
175
|
value = get_value_from(record)
|
|
175
|
-
|
|
176
|
+
pipeline.publish key, value
|
|
176
177
|
end
|
|
177
178
|
|
|
178
179
|
def generate_zremrangebyrank_script(key, maxlen, order)
|
|
@@ -253,9 +254,9 @@ module Fluent::Plugin
|
|
|
253
254
|
end
|
|
254
255
|
end
|
|
255
256
|
|
|
256
|
-
def set_key_expire(key)
|
|
257
|
+
def set_key_expire(pipeline, key)
|
|
257
258
|
if 0 < @key_expire
|
|
258
|
-
|
|
259
|
+
pipeline.expire key, @key_expire
|
|
259
260
|
end
|
|
260
261
|
end
|
|
261
262
|
|
data/renovate.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"description": "Renovate config",
|
|
4
|
+
"extends": [
|
|
5
|
+
"github>cerebrotech/renovate-config"
|
|
6
|
+
],
|
|
7
|
+
"packageRules": [
|
|
8
|
+
{
|
|
9
|
+
"description": "Require manual review for major bumps of the redis gem; a two-major-version unattended jump (redis-rb 4.8 -> 6.0) previously broke fluentd at boot (Redis.new ArgumentError) and silently stopped batching in write() -- see the matching rule in the sibling operations-fluentd-docker renovate config",
|
|
10
|
+
"matchManagers": ["bundler"],
|
|
11
|
+
"matchPackageNames": ["redis"],
|
|
12
|
+
"matchUpdateTypes": ["major"],
|
|
13
|
+
"enabled": false
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"vulnerabilityAlerts": {
|
|
17
|
+
"enabled": true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
require 'helpers'
|
|
2
|
+
require 'redis'
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
|
|
5
|
+
# These tests exercise the plugin against a real Redis server, unlike
|
|
6
|
+
# test/plugin/test_out_redis_publish.rb which stubs out the entire Redis
|
|
7
|
+
# class and therefore cannot detect a redis-rb client API break (e.g. the
|
|
8
|
+
# `pipelined` block-argument change between redis-rb 4.x and 5.x/6.x).
|
|
9
|
+
#
|
|
10
|
+
# Run a real Redis first:
|
|
11
|
+
# docker run -d --rm -p 6379:6379 redis:7-alpine
|
|
12
|
+
# then:
|
|
13
|
+
# bundle exec rake test:integration
|
|
14
|
+
class RedisStoreOutputIntegrationTest < Test::Unit::TestCase
|
|
15
|
+
REDIS_HOST = ENV['REDIS_HOST'] || '127.0.0.1'
|
|
16
|
+
REDIS_PORT = (ENV['REDIS_PORT'] || 6379).to_i
|
|
17
|
+
|
|
18
|
+
def setup
|
|
19
|
+
Fluent::Test.setup
|
|
20
|
+
@redis = Redis.new(host: REDIS_HOST, port: REDIS_PORT, timeout: 2.0)
|
|
21
|
+
begin
|
|
22
|
+
@redis.ping
|
|
23
|
+
rescue StandardError => e
|
|
24
|
+
omit "no Redis reachable at #{REDIS_HOST}:#{REDIS_PORT} (#{e.class}: #{e.message});" \
|
|
25
|
+
" start one with `docker run -d --rm -p 6379:6379 redis:7-alpine` to run integration tests"
|
|
26
|
+
end
|
|
27
|
+
@key = "fluent-plugin-redis-store-test:#{SecureRandom.hex(8)}"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def teardown
|
|
31
|
+
@redis.del(@key) if @redis
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def create_driver(conf)
|
|
35
|
+
Fluent::Test::Driver::Output.new(Fluent::Plugin::RedisStoreOutput).configure(conf)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def get_time
|
|
39
|
+
event_time("2011-01-02 13:14:15 UTC")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_zset_batches_many_records_through_one_pipeline
|
|
43
|
+
config = %[
|
|
44
|
+
host #{REDIS_HOST}
|
|
45
|
+
port #{REDIS_PORT}
|
|
46
|
+
store_type zset
|
|
47
|
+
key #{@key}
|
|
48
|
+
score_path result
|
|
49
|
+
]
|
|
50
|
+
d = create_driver(config)
|
|
51
|
+
d.run(default_tag: 'test') do
|
|
52
|
+
50.times { |i| d.feed(get_time, { 'result' => i }) }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
assert_equal 50, @redis.zcard(@key)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_zset_collision_policy_nx_does_not_overwrite
|
|
59
|
+
@redis.zadd(@key, 1, 'v')
|
|
60
|
+
config = %[
|
|
61
|
+
host #{REDIS_HOST}
|
|
62
|
+
port #{REDIS_PORT}
|
|
63
|
+
store_type zset
|
|
64
|
+
key #{@key}
|
|
65
|
+
score_path result
|
|
66
|
+
collision_policy NX
|
|
67
|
+
]
|
|
68
|
+
d = create_driver(config)
|
|
69
|
+
d.run(default_tag: 'test') do
|
|
70
|
+
d.feed(get_time, { 'result' => 99 })
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
assert_equal 1.0, @redis.zscore(@key, 'v')
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def test_zset_value_length_trims_via_lua_eval
|
|
77
|
+
config = %[
|
|
78
|
+
host #{REDIS_HOST}
|
|
79
|
+
port #{REDIS_PORT}
|
|
80
|
+
store_type zset
|
|
81
|
+
key #{@key}
|
|
82
|
+
score_path result
|
|
83
|
+
value_length 3
|
|
84
|
+
]
|
|
85
|
+
d = create_driver(config)
|
|
86
|
+
d.run(default_tag: 'test') do
|
|
87
|
+
10.times { |i| d.feed(get_time, { 'result' => i }) }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# generate_zremrangebyrank_script removes one more entry than value_length
|
|
91
|
+
# on the 'asc' path (a pre-existing off-by-one, not introduced by the
|
|
92
|
+
# pipeline fix) -- this asserts current behavior, not a spec.
|
|
93
|
+
assert_equal 2, @redis.zcard(@key)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_list_rpush_asc
|
|
97
|
+
config = %[
|
|
98
|
+
host #{REDIS_HOST}
|
|
99
|
+
port #{REDIS_PORT}
|
|
100
|
+
format_type plain
|
|
101
|
+
store_type list
|
|
102
|
+
key #{@key}
|
|
103
|
+
value_path v
|
|
104
|
+
]
|
|
105
|
+
d = create_driver(config)
|
|
106
|
+
d.run(default_tag: 'test') do
|
|
107
|
+
5.times { |i| d.feed(get_time, { 'v' => i.to_s }) }
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
assert_equal 5, @redis.llen(@key)
|
|
111
|
+
assert_equal %w[0 1 2 3 4], @redis.lrange(@key, 0, -1)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def test_set_sadd
|
|
115
|
+
config = %[
|
|
116
|
+
host #{REDIS_HOST}
|
|
117
|
+
port #{REDIS_PORT}
|
|
118
|
+
format_type plain
|
|
119
|
+
store_type set
|
|
120
|
+
key #{@key}
|
|
121
|
+
value_path v
|
|
122
|
+
]
|
|
123
|
+
d = create_driver(config)
|
|
124
|
+
d.run(default_tag: 'test') do
|
|
125
|
+
3.times { |i| d.feed(get_time, { 'v' => "member-#{i}" }) }
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
assert_equal 3, @redis.scard(@key)
|
|
129
|
+
assert_equal true, @redis.sismember(@key, 'member-1')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def test_string_set_and_key_expire
|
|
133
|
+
config = %[
|
|
134
|
+
host #{REDIS_HOST}
|
|
135
|
+
port #{REDIS_PORT}
|
|
136
|
+
format_type plain
|
|
137
|
+
store_type string
|
|
138
|
+
key #{@key}
|
|
139
|
+
value_path v
|
|
140
|
+
key_expire 30
|
|
141
|
+
]
|
|
142
|
+
d = create_driver(config)
|
|
143
|
+
d.run(default_tag: 'test') do
|
|
144
|
+
d.feed(get_time, { 'v' => 'hello' })
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
assert_equal 'hello', @redis.get(@key)
|
|
148
|
+
ttl = @redis.ttl(@key)
|
|
149
|
+
assert ttl > 0 && ttl <= 30, "expected 0 < ttl <= 30, got #{ttl}"
|
|
150
|
+
end
|
|
151
|
+
end
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-ddl-redis-store
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- moaikids
|
|
8
8
|
- HANAI Tohru aka pokehanai
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: rake
|
|
@@ -65,34 +64,59 @@ dependencies:
|
|
|
65
64
|
requirements:
|
|
66
65
|
- - ">="
|
|
67
66
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
67
|
+
version: '5.0'
|
|
68
|
+
- - "<"
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: '7'
|
|
69
71
|
type: :runtime
|
|
70
72
|
prerelease: false
|
|
71
73
|
version_requirements: !ruby/object:Gem::Requirement
|
|
72
74
|
requirements:
|
|
73
75
|
- - ">="
|
|
74
76
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
77
|
+
version: '5.0'
|
|
78
|
+
- - "<"
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '7'
|
|
81
|
+
- !ruby/object:Gem::Dependency
|
|
82
|
+
name: yajl-ruby
|
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - "~>"
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '1.4'
|
|
88
|
+
type: :runtime
|
|
89
|
+
prerelease: false
|
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
91
|
+
requirements:
|
|
92
|
+
- - "~>"
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '1.4'
|
|
76
95
|
description: Redis(zset/set/list/string/publish) output plugin for Fluentd...
|
|
77
96
|
email: builds@dominodatalab.com
|
|
78
97
|
executables: []
|
|
79
98
|
extensions: []
|
|
80
99
|
extra_rdoc_files: []
|
|
81
100
|
files:
|
|
101
|
+
- ".github/CODEOWNERS"
|
|
102
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
|
103
|
+
- ".github/workflows/test.yml"
|
|
82
104
|
- ".gitignore"
|
|
83
105
|
- AUTHORS
|
|
84
106
|
- Gemfile
|
|
85
107
|
- README.md
|
|
86
108
|
- Rakefile
|
|
109
|
+
- domino.yml
|
|
87
110
|
- fluent-plugin-ddl-redis-store.gemspec
|
|
88
111
|
- lib/fluent/plugin/out_redis_store.rb
|
|
112
|
+
- renovate.json
|
|
89
113
|
- test/helpers.rb
|
|
114
|
+
- test/integration/test_out_redis_store_integration.rb
|
|
90
115
|
- test/plugin/test_out_redis_publish.rb
|
|
91
116
|
homepage: https://github.com/dominodatalab/fluent-plugin-redis-store
|
|
92
117
|
licenses:
|
|
93
118
|
- Apache License Version 2.0
|
|
94
119
|
metadata: {}
|
|
95
|
-
post_install_message:
|
|
96
120
|
rdoc_options: []
|
|
97
121
|
require_paths:
|
|
98
122
|
- lib
|
|
@@ -107,10 +131,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
107
131
|
- !ruby/object:Gem::Version
|
|
108
132
|
version: '0'
|
|
109
133
|
requirements: []
|
|
110
|
-
rubygems_version: 3.
|
|
111
|
-
signing_key:
|
|
134
|
+
rubygems_version: 3.6.9
|
|
112
135
|
specification_version: 4
|
|
113
136
|
summary: Redis(zset/set/list/string/publish) output plugin for Fluentd
|
|
114
137
|
test_files:
|
|
115
138
|
- test/helpers.rb
|
|
139
|
+
- test/integration/test_out_redis_store_integration.rb
|
|
116
140
|
- test/plugin/test_out_redis_publish.rb
|