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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45c8c562d96d1ccf43a9ec81aa7771ac8fd05ed071282119c62581ae4d45f5db
4
- data.tar.gz: 43e377e23fe30e3af5df48ee6f3c144278339b3c5c18d662705e09ee9e50ce2c
3
+ metadata.gz: e2c0a42ae8e68d022cea68274dec675e8e22b181e1b1ab0a257ece331166eca0
4
+ data.tar.gz: 4b740c774e644e04201abab355f79312a9f5a25652c6026c7fe55547c65e50d1
5
5
  SHA512:
6
- metadata.gz: c1f702cfa38258a6a4cacafbe33d94e4fd9dc3bac2334b8ca7eff3ce5f7e1a9622a76533019f1f69b5da8b2abba8a7e33c2912a9963c8eb399467217dc367eee
7
- data.tar.gz: 2b42ea373f5daebc31f7fac557d6d45f9939bc93ceb0dd8c3e0e50e127aa17431345a80639d9b07719d1f88c59045fa01d1958f7a8649f63d18b206ff50ce98e
6
+ metadata.gz: e36b6cde7a8ca346a9e2343ceeeb32a0b6b1ceb028e9b2481c797d17352fe3eeb6336bd96e94649a27fb1410210c8f07e3d3be10f2217af50a9450bc32142970
7
+ data.tar.gz: c17560e1f313d485a5dd79048dc4deeea97aa6f1045d0ad8b0715c5972ed84ab41ecf4b8985841983f75a22410680a47fe469099aa85226e085e4f4928805805
@@ -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-wodby"
6
- spec.version = "0.3.1"
6
+ spec.version = "0.4.0"
7
7
  spec.authors = ["Robert Wunderer"]
8
8
  spec.email = ["robert@ramsalt.com"]
9
9
 
@@ -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
- app = get_app(instance['app_id'])
50
- org = get_org(app['org_id'])
51
-
52
- @instance_map[namespace] = {
53
- 'name' => "#{app['name']}.#{instance['name']}",
54
- 'title' => "#{app['title']} - #{instance['title']}",
55
- 'type' => instance['type'],
56
- 'organization' => org['name'],
57
- 'organization_title' => org['title'],
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']['instance'] = @instance_map[namespace]['name']
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(3, d.filtered_records.size)
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'])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-wodby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Wunderer