fluent-plugin-wodby 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-wodby.gemspec +1 -1
- data/lib/fluent/plugin/filter_wodby.rb +11 -8
- data/test/plugin/test_filter_wodby.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 492f5e148c2250501ee81ee6f08bfa08c41f09a66929dacef07004bdf4b28acf
|
4
|
+
data.tar.gz: ac9462d3082ec76baf70c0d37f638cd1239a412998b6b1d646fb3bbcb15fe59b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d049cdb926cb164f9e22154ede1ede14984376e181064e1eece3d160ff4ce52753b1196f45865715514dd5a5af869461026ca644b81d791c67500cb36779e485
|
7
|
+
data.tar.gz: 20015f81fe49ae01d9e48d5236486c8222114a8ec979c58f322e4bfe0c83a4e604f39804a39afcef254c80821ac44b1099fd75f8fcffa0957e69de12ecdb0701
|
data/fluent-plugin-wodby.gemspec
CHANGED
@@ -28,23 +28,26 @@ module Fluent
|
|
28
28
|
super
|
29
29
|
|
30
30
|
@instance_map = {}
|
31
|
-
|
31
|
+
log.info "Initialized wodby plugin"
|
32
32
|
end
|
33
33
|
|
34
34
|
def filter(tag, time, record)
|
35
|
-
puts "Wodby filter"
|
36
35
|
record['wodby.filter'] = true
|
37
36
|
|
38
|
-
if record.has_key?('kubernetes.namespace_name')
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
if record.has_key?('kubernetes') && record['kubernetes'].has_key?('namespace_name')
|
38
|
+
namespace = record['kubernetes']['namespace_name']
|
39
|
+
unless @instance_map.has_key?(namespace)
|
40
|
+
record['wodby.instance_query'] = namespace
|
41
|
+
instance = get_instance(namespace)
|
42
42
|
app = get_app(instance['app_id'])
|
43
43
|
|
44
|
-
@instance_map[
|
44
|
+
@instance_map[namespace] = "#{app['title']}-#{instance['name']}"
|
45
45
|
end
|
46
46
|
|
47
|
-
record['wodby.instance'] = @instance_map[
|
47
|
+
record['wodby.instance'] = @instance_map[namespace]
|
48
|
+
else
|
49
|
+
log.info "No namespace found"
|
50
|
+
log.info record
|
48
51
|
end
|
49
52
|
|
50
53
|
record
|
@@ -16,9 +16,9 @@ class WodbyFilterTest < Test::Unit::TestCase
|
|
16
16
|
d = create_driver("api_key #{ENV['WODBY_API_KEY']}")
|
17
17
|
time = event_time
|
18
18
|
d.run do
|
19
|
-
d.feed('filter.test', time, { 'kubernetes
|
20
|
-
d.feed('filter.test', time, { 'kubernetes
|
21
|
-
d.feed('filter.test', time, { 'kubernetes
|
19
|
+
d.feed('filter.test', time, { 'kubernetes' => {'namespace_name' => '650241f4-7303-4668-91c7-b8cd1821d81a'}, 'message' => 'hullo' })
|
20
|
+
d.feed('filter.test', time, { 'kubernetes' => {'namespace_name' => 'a3d67f12-8341-4245-87db-ed7a6c856e70'}, 'message' => 'hullo' })
|
21
|
+
d.feed('filter.test', time, { 'kubernetes' => {'namespace_name' => '650241f4-7303-4668-91c7-b8cd1821d81a'}, 'message' => 'hullo' })
|
22
22
|
end
|
23
23
|
|
24
24
|
assert_equal(3, d.filtered_records.size)
|