fluent-plugin-redis-enrichment 1.0.0 → 1.0.2

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
  SHA1:
3
- metadata.gz: 45307061640b5a30edb19b7c887a8c274af40a34
4
- data.tar.gz: b49ca7811c2a56daf80632ef3403cd1779563587
3
+ metadata.gz: 1dce02b1a565f23110f893fba038783b7232983d
4
+ data.tar.gz: a4c841da7abd957e0d3f55a5646ea77f1fcc4b17
5
5
  SHA512:
6
- metadata.gz: 4c6e5e96df8f784e66952f32f5775c4b64c3cf37f68a89c1870376f43370c5fd9ac24c185cba0dc96d1050be38391269fdc251bd6e2a1b672c4090dfcb58dc3e
7
- data.tar.gz: 2e026a2943fc12200edb1d1d80a1cac06035892996abb22f86de37b9702869191478febc27ffa53fc1241331a81924f96939ecf8f19ce0cd608d87d955fd16d5
6
+ metadata.gz: ca960d09e87abc9ed82b36626afe1f2b707f7c6458f3d8d43e51c4e63bb881b65bcd87ba4539462905a05125b084e08b8ef5521ff856f120250c354c67dd641f
7
+ data.tar.gz: c9dcac0989a3f3d440ee6fb1cf50c4056e8393c9a08d356e0771064ab9ffa0b8f663f1b34fb8f17a426aff7793a9b7f59257a026ac1da9bb22d45a91dcc424e8
data/README.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Filter plugin that allow to update record with data fetch from redis.
4
4
 
5
+ ## Behaviour
6
+
7
+ - try to do record enrichment using redis content,
8
+ - fetch redis data based on a key that can be hardcoded or in the record
9
+ - enrich record with redis fetched data
10
+ - in case of failure in the processing, skip enrichment and let processing
11
+ continue on record
12
+
5
13
  ## Installation
6
14
 
7
15
 
@@ -15,9 +23,19 @@ Add to Gemfile with:
15
23
 
16
24
  ## Compatibility
17
25
 
26
+ ### 1.x.x
27
+
28
+ plugin in 1.x.x will work with:
18
29
  - ruby >= 2.4.10
19
30
  - td-agent >= 3.8.1-0
20
31
 
32
+ and so use:
33
+ - redis > 4, < 5
34
+
35
+ ### 2.x.x
36
+
37
+ will come next !
38
+
21
39
  ## Configuration
22
40
 
23
41
  ### template
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'fluent-plugin-redis-enrichment'
8
- spec.version = '1.0.0'
8
+ spec.version = '1.0.2'
9
9
  spec.authors = ['Thomas Tych']
10
10
  spec.email = ['thomas.tych@gmail.com']
11
11
 
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency 'rubocop-rake', '~> 0.5.1' # < 0.6.x to work with ruby 2.4.10
37
37
  spec.add_development_dependency 'test-unit', '~> 3.5.3'
38
38
 
39
- spec.add_runtime_dependency 'connection_pool', '~> 2.2' # < 2.3.x to work with ruby 2.4.10
39
+ spec.add_runtime_dependency 'connection_pool', '~> 2.2.5' # < 2.3.x to work with ruby 2.4.10
40
40
  spec.add_runtime_dependency 'fluentd', ['>= 0.14.10', '< 2']
41
41
  spec.add_runtime_dependency 'lru_redux', '~> 1.1'
42
42
  spec.add_runtime_dependency 'redis', '~> 4.8' # < 5.x to work with ruby 2.4.10
@@ -29,7 +29,9 @@ module Fluent
29
29
  # filter plugin
30
30
  # enrich record based on redis fetched content
31
31
  class RedisEnrichmentFilter < Fluent::Plugin::Filter
32
- Fluent::Plugin.register_filter('redis_enrichment', self)
32
+ NAME = 'redis_enrichment'
33
+
34
+ Fluent::Plugin.register_filter(NAME, self)
33
35
 
34
36
  DEFAULT_REDIS_HOST = '127.0.0.1'
35
37
  DEFAULT_REDIS_PORT = 6379
@@ -117,7 +119,7 @@ module Fluent
117
119
  expanded_key = @placeholder_expander.expand(@key, { tag: tag,
118
120
  time: time,
119
121
  record: new_record })
120
- log.debug("filter_redis_enrichment: on tag:#{tag}, search #{expanded_key}")
122
+ log.debug("filter #{NAME}: on tag:#{tag}, search #{expanded_key}")
121
123
  redis = @cache.get(expanded_key)
122
124
  new_record_record_enrichment = @placeholder_expander.expand(@record_enrichment,
123
125
  { tag: tag,
@@ -125,6 +127,9 @@ module Fluent
125
127
  record: new_record,
126
128
  redis: redis })
127
129
  new_record.merge(new_record_record_enrichment)
130
+ rescue StandardError => e
131
+ log.error("filter #{NAME}: skip enrichment due to error: #{e}")
132
+ record
128
133
  end
129
134
 
130
135
  def cache_options
@@ -319,7 +324,7 @@ module Fluent
319
324
  @redis ||= ConnectionPool::Wrapper.new(size: @pool_size, timeout: @timeout) do
320
325
  if @sentinels
321
326
  Redis.new(sentinels: @sentinels, name: @name, role: @role, db: @db, password: @password,
322
- timeout: @timeout)
327
+ timeout: @timeout, host: @name)
323
328
  else
324
329
  Redis.new(host: @host, port: @port, db: @db, password: @password, timeout: @timeout)
325
330
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-redis-enrichment
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Tych
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-03 00:00:00.000000000 Z
11
+ date: 2023-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bump
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '2.2'
137
+ version: 2.2.5
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '2.2'
144
+ version: 2.2.5
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: fluentd
147
147
  requirement: !ruby/object:Gem::Requirement