fluent-plugin-wodby 0.3.1 → 0.4.0
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 +20 -15
- data/test/plugin/test_filter_wodby.rb +11 -1
- 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: e2c0a42ae8e68d022cea68274dec675e8e22b181e1b1ab0a257ece331166eca0
|
4
|
+
data.tar.gz: 4b740c774e644e04201abab355f79312a9f5a25652c6026c7fe55547c65e50d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e36b6cde7a8ca346a9e2343ceeeb32a0b6b1ceb028e9b2481c797d17352fe3eeb6336bd96e94649a27fb1410210c8f07e3d3be10f2217af50a9450bc32142970
|
7
|
+
data.tar.gz: c17560e1f313d485a5dd79048dc4deeea97aa6f1045d0ad8b0715c5972ed84ab41ecf4b8985841983f75a22410680a47fe469099aa85226e085e4f4928805805
|
data/fluent-plugin-wodby.gemspec
CHANGED
@@ -46,23 +46,28 @@ module Fluent
|
|
46
46
|
unless @instance_map.has_key?(namespace)
|
47
47
|
record['wodby']['instance_query'] = namespace
|
48
48
|
instance = get_instance(namespace)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
49
|
+
|
50
|
+
if instance.empty?
|
51
|
+
@instance_map[namespace] = {
|
52
|
+
'found' => false
|
53
|
+
}
|
54
|
+
|
55
|
+
else
|
56
|
+
app = get_app(instance['app_id'])
|
57
|
+
org = get_org(app['org_id'])
|
58
|
+
|
59
|
+
@instance_map[namespace] = {
|
60
|
+
'found' => true,
|
61
|
+
'instance' => "#{app['name']}.#{instance['name']}",
|
62
|
+
'instance_title' => "#{app['title']} - #{instance['title']}",
|
63
|
+
'instance_type' => instance['type'],
|
64
|
+
'organization' => org['name'],
|
65
|
+
'organization_title' => org['title'],
|
66
|
+
}
|
67
|
+
end
|
59
68
|
end
|
60
69
|
|
61
|
-
record['wodby']
|
62
|
-
record['wodby']['instance_title'] = @instance_map[namespace]['title']
|
63
|
-
record['wodby']['instance_type'] = @instance_map[namespace]['type']
|
64
|
-
record['wodby']['organization'] = @instance_map[namespace]['organization']
|
65
|
-
record['wodby']['organization_title'] = @instance_map[namespace]['organization_title']
|
70
|
+
record['wodby'].merge!(@instance_map[namespace])
|
66
71
|
else
|
67
72
|
log.info "No namespace found"
|
68
73
|
log.info record
|
@@ -19,9 +19,15 @@ class WodbyFilterTest < Test::Unit::TestCase
|
|
19
19
|
d.feed('filter.test', time, { 'kubernetes' => {'namespace_name' => '650241f4-7303-4668-91c7-b8cd1821d81a'}, 'message' => 'hullo', 'wodby.node_name' => 'node' })
|
20
20
|
d.feed('filter.test', time, { 'kubernetes' => {'namespace_name' => '7ee5d15f-7c3c-4ce8-873e-34b75154f0f4'}, 'message' => 'hullo', 'wodby.node_name' => 'node' })
|
21
21
|
d.feed('filter.test', time, { 'kubernetes' => {'namespace_name' => '650241f4-7303-4668-91c7-b8cd1821d81a'}, 'message' => 'hullo', 'wodby.node_name' => 'node' })
|
22
|
+
d.feed('filter.test', time, { 'kubernetes' => {'namespace_name' => 'renovate'}, 'message' => 'hullo', 'wodby.node_name' => 'node' })
|
22
23
|
end
|
23
24
|
|
24
|
-
assert_equal(
|
25
|
+
assert_equal(4, d.filtered_records.size)
|
26
|
+
assert_true(d.filtered_records[0]['wodby']['found'])
|
27
|
+
assert_true(d.filtered_records[1]['wodby']['found'])
|
28
|
+
assert_true(d.filtered_records[2]['wodby']['found'])
|
29
|
+
assert_false(d.filtered_records[3]['wodby']['found'])
|
30
|
+
|
25
31
|
assert_equal('dfono.staging', d.filtered_records[0]['wodby']['instance'])
|
26
32
|
assert_equal('dfono.prod', d.filtered_records[1]['wodby']['instance'])
|
27
33
|
assert_equal('dfono.staging', d.filtered_records[2]['wodby']['instance'])
|
@@ -29,8 +35,12 @@ class WodbyFilterTest < Test::Unit::TestCase
|
|
29
35
|
assert_equal('dfo.no - Prod', d.filtered_records[1]['wodby']['instance_title'])
|
30
36
|
assert_equal('node', d.filtered_records[0]['wodby']['node_name'])
|
31
37
|
assert_equal('node', d.filtered_records[1]['wodby']['node_name'])
|
38
|
+
assert_equal('dfo', d.filtered_records[0]['wodby']['organization'])
|
39
|
+
assert_equal('DFØ', d.filtered_records[1]['wodby']['organization_title'])
|
40
|
+
|
32
41
|
assert_nil(d.filtered_records[2]['wodby']['instance_query'])
|
33
42
|
assert_nil(d.filtered_records[2]['wodby.node_name'])
|
43
|
+
|
34
44
|
assert_true(d.filtered_records[0]['wodby']['filter'])
|
35
45
|
assert_true(d.filtered_records[1]['wodby']['filter'])
|
36
46
|
assert_true(d.filtered_records[2]['wodby']['filter'])
|