fluent-plugin-label-router 0.3.0 → 0.4.0
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/Gemfile +1 -1
- data/Gemfile.lock +18 -12
- data/fluent-plugin-label-router.gemspec +3 -2
- data/lib/fluent/plugin/out_label_router.rb +9 -11
- data/test/plugin/test_out_label_router.rb +3 -3
- metadata +24 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39bb31d6e0960885594803292fd8b7e6739191333aaa303d2db16809d2ddaf1c
|
4
|
+
data.tar.gz: 46d5658ae6ed1159e4d55c6068f945ce5bb4719e6c373602cf88581323f60c46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cae3b60f07ff8bd9b411b7ae5ae766c59c95737484eb497e77b219e8d6d43f31943e4702313097cf8dd331b029a213389c3911ea0c1d937797dd6f18e7f19669
|
7
|
+
data.tar.gz: bafd88bb200ca34795d206b7a4e24ab25e78de209c078282414f2de7b02de7e494e7835927c872f29c11e173ddd51056e8bea68a8642319a76519271d3ac524c
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,25 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluent-plugin-label-router (0.3.
|
5
|
-
|
4
|
+
fluent-plugin-label-router (0.3.2)
|
5
|
+
concurrent-ruby
|
6
|
+
fluentd (>= 1.17.1, < 1.18)
|
6
7
|
prometheus-client (>= 2.1.0)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
12
|
base64 (0.2.0)
|
12
|
-
concurrent-ruby (1.3.
|
13
|
-
cool.io (1.
|
13
|
+
concurrent-ruby (1.3.4)
|
14
|
+
cool.io (1.9.0)
|
14
15
|
csv (3.3.0)
|
15
16
|
drb (2.2.1)
|
16
|
-
fluentd (1.17.
|
17
|
+
fluentd (1.17.1)
|
17
18
|
base64 (~> 0.2)
|
18
19
|
bundler
|
19
20
|
cool.io (>= 1.4.5, < 2.0.0)
|
20
21
|
csv (~> 3.2)
|
21
22
|
drb (~> 2.2)
|
22
23
|
http_parser.rb (>= 0.5.1, < 0.9.0)
|
24
|
+
logger (~> 1.6)
|
23
25
|
msgpack (>= 1.3.1, < 2.0.0)
|
24
26
|
serverengine (>= 2.3.2, < 3.0.0)
|
25
27
|
sigdump (~> 0.2.5)
|
@@ -29,21 +31,25 @@ GEM
|
|
29
31
|
webrick (~> 1.4)
|
30
32
|
yajl-ruby (~> 1.0)
|
31
33
|
http_parser.rb (0.8.0)
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
logger (1.6.1)
|
35
|
+
msgpack (1.7.5)
|
36
|
+
power_assert (2.0.4)
|
37
|
+
prometheus-client (4.2.3)
|
38
|
+
base64
|
35
39
|
rake (12.3.3)
|
36
|
-
serverengine (2.
|
40
|
+
serverengine (2.4.0)
|
41
|
+
base64 (~> 0.1)
|
42
|
+
logger (~> 1.4)
|
37
43
|
sigdump (~> 0.2.2)
|
38
44
|
sigdump (0.2.5)
|
39
45
|
strptime (0.2.5)
|
40
|
-
test-unit (3.6.
|
46
|
+
test-unit (3.6.4)
|
41
47
|
power_assert
|
42
48
|
tzinfo (2.0.6)
|
43
49
|
concurrent-ruby (~> 1.0)
|
44
|
-
tzinfo-data (1.2024.
|
50
|
+
tzinfo-data (1.2024.2)
|
45
51
|
tzinfo (>= 1.0.0)
|
46
|
-
webrick (1.
|
52
|
+
webrick (1.9.0)
|
47
53
|
yajl-ruby (1.4.3)
|
48
54
|
|
49
55
|
PLATFORMS
|
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "fluent-plugin-label-router"
|
6
|
-
spec.version = "0.
|
6
|
+
spec.version = "0.4.0"
|
7
7
|
spec.authors = ["Banzai Cloud"]
|
8
8
|
spec.email = ["info@banzaicloud.com"]
|
9
9
|
|
@@ -23,5 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rake", "~> 12.0"
|
24
24
|
spec.add_development_dependency "test-unit", "~> 3.0"
|
25
25
|
spec.add_dependency "prometheus-client", ">= 2.1.0"
|
26
|
-
spec.
|
26
|
+
spec.add_dependency "concurrent-ruby"
|
27
|
+
spec.add_runtime_dependency "fluentd", [">= 1.17.1", "< 1.18"]
|
27
28
|
end
|
@@ -13,8 +13,9 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License
|
15
15
|
|
16
|
-
require "fluent/plugin/
|
16
|
+
require "fluent/plugin/bare_output"
|
17
17
|
require 'prometheus/client'
|
18
|
+
require 'concurrent'
|
18
19
|
|
19
20
|
|
20
21
|
module Fluent
|
@@ -95,11 +96,8 @@ module Fluent
|
|
95
96
|
# There is no match at all -> return false
|
96
97
|
def match?(metadata)
|
97
98
|
@matches.each do |match|
|
98
|
-
if filter_select(match, metadata)
|
99
|
-
return
|
100
|
-
end
|
101
|
-
if filter_select(match, metadata) and match.negate
|
102
|
-
return false
|
99
|
+
if filter_select(match, metadata)
|
100
|
+
return !match.negate
|
103
101
|
end
|
104
102
|
end
|
105
103
|
false
|
@@ -153,7 +151,7 @@ module Fluent
|
|
153
151
|
|
154
152
|
def process(tag, es)
|
155
153
|
if @sticky_tags
|
156
|
-
@
|
154
|
+
@rwlock.with_read_lock {
|
157
155
|
if @route_map.has_key?(tag)
|
158
156
|
# We already matched with this tag send events to the routers
|
159
157
|
@route_map[tag].each do |r|
|
@@ -175,7 +173,7 @@ module Fluent
|
|
175
173
|
if r.match?(input_metadata)
|
176
174
|
orphan_record = false
|
177
175
|
if @sticky_tags
|
178
|
-
@
|
176
|
+
@rwlock.with_write_lock {
|
179
177
|
@route_map[tag].add(r)
|
180
178
|
}
|
181
179
|
end
|
@@ -188,7 +186,7 @@ module Fluent
|
|
188
186
|
end
|
189
187
|
if !@default_router.nil? && orphan_record
|
190
188
|
if @sticky_tags
|
191
|
-
@
|
189
|
+
@rwlock.with_write_lock {
|
192
190
|
@route_map[tag].add(@default_router)
|
193
191
|
}
|
194
192
|
end
|
@@ -210,7 +208,7 @@ module Fluent
|
|
210
208
|
super
|
211
209
|
@registry = (::Prometheus::Client.registry if @metrics)
|
212
210
|
@route_map = Hash.new { |h, k| h[k] = Set.new }
|
213
|
-
@
|
211
|
+
@rwlock = Concurrent::ReadWriteLock.new
|
214
212
|
@routers = []
|
215
213
|
@default_router = nil
|
216
214
|
@routes.each do |rule|
|
@@ -224,7 +222,7 @@ module Fluent
|
|
224
222
|
end
|
225
223
|
|
226
224
|
@access_to_labels = record_accessor_create("$.kubernetes.labels")
|
227
|
-
@access_to_namespace_labels = record_accessor_create("$.
|
225
|
+
@access_to_namespace_labels = record_accessor_create("$.kubernetes_namespace.labels")
|
228
226
|
@access_to_namespace = record_accessor_create("$.kubernetes.namespace_name")
|
229
227
|
@access_to_host = record_accessor_create("$.kubernetes.host")
|
230
228
|
@access_to_container_name = record_accessor_create("$.kubernetes.container_name")
|
@@ -156,15 +156,15 @@ class LabelRouterOutputTest < Test::Unit::TestCase
|
|
156
156
|
event_time = event_time("2019-07-17 11:11:11 UTC")
|
157
157
|
d = create_driver(CONFIG)
|
158
158
|
d.run(default_tag: 'test') do
|
159
|
-
d.feed(event_time, {"
|
159
|
+
d.feed(event_time, {"kubernetes_namespace" => {"labels" => {"matching" => "no"} } } )
|
160
160
|
end
|
161
161
|
d.run(default_tag: 'test2') do
|
162
|
-
d.feed(event_time, {"
|
162
|
+
d.feed(event_time, {"kubernetes_namespace" => {"labels" => {"matching" => "yes"} } } )
|
163
163
|
end
|
164
164
|
events = d.events
|
165
165
|
|
166
166
|
assert_equal(1, events.size)
|
167
|
-
assert_equal ["matching", event_time, {"
|
167
|
+
assert_equal ["matching", event_time, {"kubernetes_namespace" => {"labels" => {"matching" => "yes"} } }], events[0]
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-label-router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Banzai Cloud
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -52,26 +52,40 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: concurrent-ruby
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: fluentd
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 1.17.1
|
62
76
|
- - "<"
|
63
77
|
- !ruby/object:Gem::Version
|
64
|
-
version: '
|
78
|
+
version: '1.18'
|
65
79
|
type: :runtime
|
66
80
|
prerelease: false
|
67
81
|
version_requirements: !ruby/object:Gem::Requirement
|
68
82
|
requirements:
|
69
83
|
- - ">="
|
70
84
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
85
|
+
version: 1.17.1
|
72
86
|
- - "<"
|
73
87
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
88
|
+
version: '1.18'
|
75
89
|
description: Label-Router helps routing log messages based on their labels and namespace
|
76
90
|
tag in a Kubernetes environment.
|
77
91
|
email:
|
@@ -94,7 +108,7 @@ homepage: https://github.com/banzaicloud/fluent-plugin-label-router
|
|
94
108
|
licenses:
|
95
109
|
- Apache-2.0
|
96
110
|
metadata: {}
|
97
|
-
post_install_message:
|
111
|
+
post_install_message:
|
98
112
|
rdoc_options: []
|
99
113
|
require_paths:
|
100
114
|
- lib
|
@@ -109,8 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
-
signing_key:
|
126
|
+
rubygems_version: 3.0.3.1
|
127
|
+
signing_key:
|
114
128
|
specification_version: 4
|
115
129
|
summary: Routing records based on Kubernetes labels.
|
116
130
|
test_files:
|