fluent-plugin-redis-enrichment 1.0.1 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbe41ffb0ac660f88be2190bae2dd7f20242cf9a
4
- data.tar.gz: f249188de2a8d13bdc1ac5ce433d9f1f84aa98e7
3
+ metadata.gz: 1dce02b1a565f23110f893fba038783b7232983d
4
+ data.tar.gz: a4c841da7abd957e0d3f55a5646ea77f1fcc4b17
5
5
  SHA512:
6
- metadata.gz: 40370cf844b5e006b3abf777bd56625318f878245fe4268fff0d8384ae7d77ecb25c2ab4da0f86a4446425214c5bb4df088be67c96715aaa6bbf1121bf329ecc
7
- data.tar.gz: 7a58bcb1d7aa4b38acef8a769ab600b30f7e0ce38381a5c47a56be5562aa70964922669280735191915806d67288078ea30fcf65a6d0dda8b9037834cb8985a5
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.1'
8
+ spec.version = '1.0.2'
9
9
  spec.authors = ['Thomas Tych']
10
10
  spec.email = ['thomas.tych@gmail.com']
11
11
 
@@ -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.1
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