fluent-plugin-reemit 0.3.0 → 0.3.1

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: 4694b1e10321c8954b685c7d010244e78e7e953d
4
- data.tar.gz: 5a1905a04b7fa654df1397cccc19671f0ded31b2
3
+ metadata.gz: de2b0c078c5715c5079548c99f2efbbc838fc881
4
+ data.tar.gz: 640bf1b9a340eb7fe09af815f65ba145b5dd8318
5
5
  SHA512:
6
- metadata.gz: 5af41dc4e9b4608dedd759c8f2110797c94500b3b9487d31f4921a2b868c0f11fe24c9df54dbc36904fc902ddda4a5db9e9470da3c6803b8fc457921a326802c
7
- data.tar.gz: 5a7de06331278710042bfb6379000ba84f2079849c7d4691473edd98ca81a50f84f01137ed9ef5244e4156fa866a940735780fddf47e05f87d12f3837e361c02
6
+ metadata.gz: 5cfb6bdd0b00d62162754deb1d1480450389755e57d5f6f6696d59890361578b66c759cc45a04be2414d97154f5c7553f6789b12269f0c970531c672535b9c39
7
+ data.tar.gz: 9b8b6fdab2004582082c62881064feb5d5cef4517b47534a844c7f8d92bbf56545cbd169d3d05ae60aac0d278ff7ba4ca6a6c11dab168e5bcdeb09ed85b953f3
@@ -1,3 +1,9 @@
1
+ ## 0.3.1 (2017/09/15)
2
+
3
+ Fixes:
4
+
5
+ * Fix to work with Fluentd v0.14
6
+
1
7
  ## 0.3.0 (2017/09/13)
2
8
 
3
9
  Enhancements:
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = "fluent-plugin-reemit"
6
- gem.version = "0.3.0"
6
+ gem.version = "0.3.1"
7
7
  gem.authors = ["Naotoshi Seo"]
8
8
  gem.email = "sonots@gmail.com"
9
9
  gem.homepage = "https://github.com/sonots/fluent-plugin-reemit"
@@ -14,21 +14,19 @@ module Fluent
14
14
 
15
15
  def configure(conf)
16
16
  super
17
+
18
+ major, minor, patch = Fluent::VERSION.split('.').map(&:to_i)
19
+ if major > 0 || (major == 0 && minor >= 14)
20
+ @router = V14EventRouter.new(self)
21
+ elsif major == 0 && minor >= 12
22
+ @router = V12EventRouter.new(self)
23
+ else
24
+ @router = V10EventRouter.new(self)
25
+ end
17
26
  end
18
27
 
19
28
  def start
20
29
  super
21
- event_router = Engine.instance_variable_get(:@event_router)
22
- @router =
23
- if event_router
24
- if v14?(event_router)
25
- V14EventRouter.new(self)
26
- else
27
- V12EventRouter.new(self)
28
- end
29
- else
30
- V10Engine.new(self)
31
- end
32
30
  end
33
31
 
34
32
  def emit(tag, es, chain)
@@ -38,11 +36,6 @@ module Fluent
38
36
  log.warn "reemit: #{e.class} #{e.message} #{e.backtrace.first}"
39
37
  end
40
38
 
41
- def v14?(event_router)
42
- default_collector = event_router.instance_variable_get(:@default_collector)
43
- default_collector.respond_to?(:emit_events)
44
- end
45
-
46
39
  def included?(collector)
47
40
  return false if collector.nil?
48
41
  if collector == self
@@ -60,23 +53,23 @@ module Fluent
60
53
  class V12EventRouter
61
54
  def initialize(reemit)
62
55
  @reemit = reemit
63
- @event_router = Engine.instance_variable_get(:@event_router)
64
- @chain = @event_router.instance_variable_get(:@chain)
65
- @emit_error_handler = @event_router.instance_variable_get(:@emit_error_handler)
56
+ @event_router = Engine.root_agent.event_router
57
+ @chain = @event_router.instance_variable_get(:@chain) # only v0.12
58
+ @emit_error_handler = @event_router.emit_error_handler
66
59
  @match_rules = @event_router.instance_variable_get(:@match_rules)
67
- @default_collector = @event_router.instance_variable_get(:@default_collector)
68
- # @match_cache = @event_router.instance_variable_get(:@match_cache)
60
+ @default_collector = @event_router.default_collector
61
+ # @match_cache = @event_router.match_cache
69
62
  @match_cache = EventRouter::MatchCache.new # need to use a different cache
70
63
  end
71
64
 
72
- # same
65
+ # copy from fluentd
73
66
  def emit_stream(tag, es)
74
67
  match(tag).emit(tag, es, @chain)
75
68
  rescue => e
76
69
  @emit_error_handler.handle_emits_error(tag, es, e)
77
70
  end
78
71
 
79
- # same
72
+ # copy from fluentd
80
73
  def match(tag)
81
74
  collector = @match_cache.get(tag) {
82
75
  c = find(tag) || @default_collector
@@ -85,8 +78,7 @@ module Fluent
85
78
  end
86
79
 
87
80
  def find(tag)
88
- # We want to reemit messages to the next `<match>` below this `type reemit`
89
- # to avoid reemiting back to an above or current `<match>`
81
+ # We want to reemit messages to the **next** `<match>`
90
82
  pipeline = nil
91
83
  found_reemit = false
92
84
  @match_rules.each_with_index { |rule, i|
@@ -123,7 +115,7 @@ module Fluent
123
115
 
124
116
  # Almost same as V12EventRouter but it must call #emit_events instead of #emit.
125
117
  class V14EventRouter < V12EventRouter
126
- # same
118
+ # copy from fluentd
127
119
  def emit_stream(tag, es)
128
120
  match(tag).emit_events(tag, es)
129
121
  rescue => e
@@ -131,7 +123,7 @@ module Fluent
131
123
  end
132
124
  end
133
125
 
134
- class V10Engine
126
+ class V10EventRouter
135
127
  def initialize(reemit)
136
128
  @reemit = reemit
137
129
  @matches = Engine.matches
@@ -148,8 +140,7 @@ module Fluent
148
140
  end
149
141
 
150
142
  def match(tag)
151
- # We want to reemit messages to the next `<match>` below this `type reemit`
152
- # to avoid reemiting back to an above or current `<match>`
143
+ # We want to reemit messages to the **next** `<match>`
153
144
  found_reemit = false
154
145
  @matches.find do |m|
155
146
  if m.match(tag)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-reemit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.5.1
139
+ rubygems_version: 2.6.13
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Fluentd plugin to re-emit messages avoiding infinity match loop