fluent-plugin-wodby 0.1.5 → 0.1.8

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: ec5aac4ba42f1eb469da3610fe5451181c59db36115ab2b2234fce6df99e8091
4
- data.tar.gz: 298cde6628e7c10fb5ccaed095fb93847f9f713b6877b4a7a1b886c92e3821c3
3
+ metadata.gz: 57ac4a430d1c7d6f5ff0be056648e3a1cf139a7964a2e2ef7bc86350412f9b19
4
+ data.tar.gz: 9adf5941a2fa080534b3f878e329cc5e81501c2025c180ef2cf3b511f34adf51
5
5
  SHA512:
6
- metadata.gz: 8872f83349b861730ccbb648a27a2c296f05bdf21685699248286474b352d70749e211354980efbd4cbf781696c8aa0f8406bf2ba92d9235aef86d7a22516867
7
- data.tar.gz: 60577048aad3abcb8a3b51a80a481d865d279d41b35e8a2ce3e5475b8fb7e33d20c67c77f0709d89340ac26b2cb3f7016599a56fecea7d7f97168662b9fefa89
6
+ metadata.gz: 7490189d97937b66a21d8f6d391547d6d2aca6f010ac3861cfd825666c5db819c257186792057f54f32f8a26cf3647da321d91dd0b35177d5484a98de5a6d94b
7
+ data.tar.gz: acea16faaf6d820cb71394f47e6abc8e39a43d015d2fbf011a4c56ff0b7919c5b622465b14b2795090e5b05b9811f3e0819de37c876f28ece2498d80e17d7dd0
@@ -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.1.5"
6
+ spec.version = "0.1.8"
7
7
  spec.authors = ["Robert Wunderer"]
8
8
  spec.email = ["robert@ramsalt.com"]
9
9
 
@@ -34,16 +34,24 @@ module Fluent
34
34
  def filter(tag, time, record)
35
35
  record['wodby.filter'] = true
36
36
 
37
- if record.has_key?('kubernetes.namespace_name')
38
- unless @instance_map.has_key?(record['kubernetes.namespace_name'])
39
- record['wodby.instance_query'] = record['kubernetes.namespace_name']
40
- instance = get_instance(record['kubernetes.namespace_name'])
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)
41
42
  app = get_app(instance['app_id'])
42
43
 
43
- @instance_map[record['kubernetes.namespace_name']] = "#{app['title']}-#{instance['name']}"
44
+ @instance_map[namespace] = {
45
+ 'name' => "#{app['name']}.#{instance['name']}",
46
+ 'title' => "#{app['title']} - #{instance['title']}",
47
+ }
44
48
  end
45
49
 
46
- record['wodby.instance'] = @instance_map[record['kubernetes.namespace_name']]
50
+ record['wodby.instance'] = @instance_map[namespace]['name']
51
+ record['wodby.instance_title'] = @instance_map[namespace]['title']
52
+ else
53
+ log.info "No namespace found"
54
+ log.info record
47
55
  end
48
56
 
49
57
  record
@@ -16,15 +16,17 @@ 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.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' })
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)
25
- assert_equal('dfo.no-staging', d.filtered_records[0]['wodby.instance'])
26
- assert_equal('dfo.no-prod', d.filtered_records[1]['wodby.instance'])
27
- assert_equal('dfo.no-staging', d.filtered_records[2]['wodby.instance'])
25
+ assert_equal('dfono.staging', d.filtered_records[0]['wodby.instance'])
26
+ assert_equal('dfono.prod', d.filtered_records[1]['wodby.instance'])
27
+ assert_equal('dfono.staging', d.filtered_records[2]['wodby.instance'])
28
+ assert_equal('dfo.no - Staging', d.filtered_records[0]['wodby.instance_title'])
29
+ assert_equal('dfo.no - Prod', d.filtered_records[1]['wodby.instance_title'])
28
30
  assert_nil(d.filtered_records[2]['wodby.instance_query'])
29
31
  assert_true(d.filtered_records[0]['wodby.filter'])
30
32
  assert_true(d.filtered_records[1]['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.1.5
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Wunderer