fluent-plugin-kubernetes_metadata_filter 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/fluent-plugin-kubernetes_metadata_filter.gemspec +1 -1
- data/lib/fluent/plugin/filter_kubernetes_metadata.rb +6 -6
- data/lib/fluent/plugin/kubernetes_metadata_cache_strategy.rb +0 -1
- data/test/plugin/test_filter_kubernetes_metadata.rb +27 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 149bef65a13bf7ef7fc0a3964b4f8ba0696489f8
|
4
|
+
data.tar.gz: 99f30525e67d6d92593a1e6bbd5160b19889dab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d06e30879346ca2cca50a377357860e353263e9887f00de254d9906632080d6ec61eca74657a68debd60bcb594df5afdaeca8d54596ee57690cd0c40851261ae
|
7
|
+
data.tar.gz: 57c74b482aed9cece0895b9959929c16fc8fa55c705d93b889270171be55c5150682fb03d7c2a60fbbbfa91089998481a126d73aa3534951cc5772ebd1b6c055
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ when true (default: `true`)
|
|
53
53
|
* `orphaned_namespace_name` - The namespace to associate with records where the namespace can not be determined (default: `.orphaned`)
|
54
54
|
* `orphaned_namespace_id` - The namespace id to associate with records where the namespace can not be determined (default: `orphaned`)
|
55
55
|
|
56
|
-
**NOTE:** As of the release
|
56
|
+
**NOTE:** As of the release 2.1.x of this plugin, it no longer supports parsing the source message into JSON and attaching it to the
|
57
57
|
payload. The following configuration options are removed:
|
58
58
|
|
59
59
|
* `merge_json_log`
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "fluent-plugin-kubernetes_metadata_filter"
|
7
|
-
gem.version = "2.1.
|
7
|
+
gem.version = "2.1.1"
|
8
8
|
gem.authors = ["Jimmi Dyson"]
|
9
9
|
gem.email = ["jimmidyson@gmail.com"]
|
10
10
|
gem.description = %q{Filter plugin to add Kubernetes metadata}
|
@@ -90,12 +90,12 @@ module Fluent::Plugin
|
|
90
90
|
rescue Exception=>e
|
91
91
|
log.debug(e)
|
92
92
|
@stats.bump(:pod_cache_api_nil_bad_resp_payload)
|
93
|
-
log.trace("returning empty metadata for #{namespace_name}/#{pod_name} due to error") if log.trace?
|
93
|
+
log.trace("returning empty metadata for #{namespace_name}/#{pod_name} due to error '#{e}'") if log.trace?
|
94
94
|
end
|
95
95
|
end
|
96
|
-
rescue
|
96
|
+
rescue Exception=>e
|
97
97
|
@stats.bump(:pod_cache_api_nil_error)
|
98
|
-
log.debug "Exception encountered fetching pod metadata from Kubernetes API #{@apiVersion} endpoint #{@kubernetes_url}
|
98
|
+
log.debug "Exception '#{e}' encountered fetching pod metadata from Kubernetes API #{@apiVersion} endpoint #{@kubernetes_url}"
|
99
99
|
end
|
100
100
|
{}
|
101
101
|
end
|
@@ -132,12 +132,12 @@ module Fluent::Plugin
|
|
132
132
|
rescue Exception => e
|
133
133
|
log.debug(e)
|
134
134
|
@stats.bump(:namespace_cache_api_nil_bad_resp_payload)
|
135
|
-
log.trace("returning empty metadata for #{namespace_name} due to error") if log.trace?
|
135
|
+
log.trace("returning empty metadata for #{namespace_name} due to error '#{e}'") if log.trace?
|
136
136
|
end
|
137
137
|
end
|
138
|
-
rescue
|
138
|
+
rescue Exception => kube_error
|
139
139
|
@stats.bump(:namespace_cache_api_nil_error)
|
140
|
-
log.debug "Exception encountered fetching namespace metadata from Kubernetes API #{@apiVersion} endpoint #{@kubernetes_url}
|
140
|
+
log.debug "Exception '#{kube_error}' encountered fetching namespace metadata from Kubernetes API #{@apiVersion} endpoint #{@kubernetes_url}"
|
141
141
|
end
|
142
142
|
{}
|
143
143
|
end
|
@@ -140,12 +140,6 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
|
|
140
140
|
cache_size 1
|
141
141
|
', d: nil)
|
142
142
|
d = create_driver(config) if d.nil?
|
143
|
-
if ENV['LOGLEVEL']
|
144
|
-
logger = Logger.new(STDOUT)
|
145
|
-
logger.level = eval("Logger::#{ENV['LOGLEVEL'].upcase}")
|
146
|
-
instance = d.instance
|
147
|
-
instance.instance_variable_set(:@log,logger)
|
148
|
-
end
|
149
143
|
d.run(default_tag: DEFAULT_TAG) {
|
150
144
|
d.feed(@time, msg)
|
151
145
|
}
|
@@ -164,6 +158,33 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
|
|
164
158
|
d.filtered.map{|e| e.last}
|
165
159
|
end
|
166
160
|
|
161
|
+
test 'inability to connect to the api server handles exception and doensnt block pipeline' do
|
162
|
+
VCR.use_cassette('kubernetes_docker_metadata') do
|
163
|
+
driver = create_driver('
|
164
|
+
kubernetes_url https://localhost:8443
|
165
|
+
watch false
|
166
|
+
cache_size 1
|
167
|
+
')
|
168
|
+
stub_request(:any, 'https://localhost:8443/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc').to_raise(SocketError.new('error from pod fetch'))
|
169
|
+
stub_request(:any, 'https://localhost:8443/api/v1/namespaces/default').to_raise(SocketError.new('socket error from namespace fetch'))
|
170
|
+
filtered = emit({'time'=>'2015-05-08T09:22:01Z'}, '', :d => driver)
|
171
|
+
expected_kube_metadata = {
|
172
|
+
'time'=>'2015-05-08T09:22:01Z',
|
173
|
+
'docker' => {
|
174
|
+
'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
|
175
|
+
},
|
176
|
+
'kubernetes' => {
|
177
|
+
'pod_name' => 'fabric8-console-controller-98rqc',
|
178
|
+
'container_name' => 'fabric8-console-container',
|
179
|
+
"namespace_id"=>"orphaned",
|
180
|
+
'namespace_name' => '.orphaned',
|
181
|
+
"orphaned_namespace"=>"default"
|
182
|
+
}
|
183
|
+
}
|
184
|
+
assert_equal(expected_kube_metadata, filtered[0])
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
167
188
|
test 'with docker & kubernetes metadata where id cache hit and metadata miss' do
|
168
189
|
VCR.use_cassette('kubernetes_docker_metadata') do
|
169
190
|
driver = create_driver('
|