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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 185c9d0f4afebbb5b3f12d91fafc1260d8fb88e8e192b45e71eab076a2472de2
4
- data.tar.gz: 8804bec7c00cb7e01d751580f4893f4780b1f1b30f93afadafc1cc62eb52629c
3
+ metadata.gz: 492f5e148c2250501ee81ee6f08bfa08c41f09a66929dacef07004bdf4b28acf
4
+ data.tar.gz: ac9462d3082ec76baf70c0d37f638cd1239a412998b6b1d646fb3bbcb15fe59b
5
5
  SHA512:
6
- metadata.gz: 5906eb8f3b6787ba331550941bf99a8dbd834a0f8b148e7d1c0ea381d75df52e967afe4c1e5671051ccf7688761afb3e8f2f42a48b9a21df56cf9185ec737a98
7
- data.tar.gz: b9dd94f2818483b7c2104224f023f42f3b78d1c7c388877e48f0da9e0a079fec053c193b0bff0478dcfc01b09f979ffa084914ed65699a8076cd467536a1face
6
+ metadata.gz: d049cdb926cb164f9e22154ede1ede14984376e181064e1eece3d160ff4ce52753b1196f45865715514dd5a5af869461026ca644b81d791c67500cb36779e485
7
+ data.tar.gz: 20015f81fe49ae01d9e48d5236486c8222114a8ec979c58f322e4bfe0c83a4e604f39804a39afcef254c80821ac44b1099fd75f8fcffa0957e69de12ecdb0701
@@ -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.4"
6
+ spec.version = "0.1.7"
7
7
  spec.authors = ["Robert Wunderer"]
8
8
  spec.email = ["robert@ramsalt.com"]
9
9
 
@@ -28,23 +28,26 @@ module Fluent
28
28
  super
29
29
 
30
30
  @instance_map = {}
31
- puts "Starting wodby"
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
- unless @instance_map.has_key?(record['kubernetes.namespace_name'])
40
- record['wodby.instance_query'] = record['kubernetes.namespace_name']
41
- 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)
42
42
  app = get_app(instance['app_id'])
43
43
 
44
- @instance_map[record['kubernetes.namespace_name']] = "#{app['title']}-#{instance['name']}"
44
+ @instance_map[namespace] = "#{app['title']}-#{instance['name']}"
45
45
  end
46
46
 
47
- record['wodby.instance'] = @instance_map[record['kubernetes.namespace_name']]
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.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)
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.4
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Wunderer