fluent-plugin-wodby 0.1.7 → 0.2.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: 492f5e148c2250501ee81ee6f08bfa08c41f09a66929dacef07004bdf4b28acf
4
- data.tar.gz: ac9462d3082ec76baf70c0d37f638cd1239a412998b6b1d646fb3bbcb15fe59b
3
+ metadata.gz: 23ae85cc153a514e34cca03046b10a61ad3147fef2e2116fd94dead6d14e0fbb
4
+ data.tar.gz: 9e98ed0e992289f9b3d6fa0143c27d72377d460bed2bce9343b80b863723a70a
5
5
  SHA512:
6
- metadata.gz: d049cdb926cb164f9e22154ede1ede14984376e181064e1eece3d160ff4ce52753b1196f45865715514dd5a5af869461026ca644b81d791c67500cb36779e485
7
- data.tar.gz: 20015f81fe49ae01d9e48d5236486c8222114a8ec979c58f322e4bfe0c83a4e604f39804a39afcef254c80821ac44b1099fd75f8fcffa0957e69de12ecdb0701
6
+ metadata.gz: 59116055801189e0e2a14af1783d9c3d32eeb3796c7f15ca6d78e0299bfe37e86d11b5fd18ee63db5ff47d623359bcbfcf2e54e1d6c6249aa0f4fbf5681afa50
7
+ data.tar.gz: 8ab9b95f8843fed694541bc4e1489fba6338b0870f16a161a6fa736f059273902252b4b4a194a39396e759bfa8df8dd22bc8850ccf6df4726cdfd626220ac68f
@@ -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.7"
6
+ spec.version = "0.2.0"
7
7
  spec.authors = ["Robert Wunderer"]
8
8
  spec.email = ["robert@ramsalt.com"]
9
9
 
@@ -40,11 +40,22 @@ module Fluent
40
40
  record['wodby.instance_query'] = namespace
41
41
  instance = get_instance(namespace)
42
42
  app = get_app(instance['app_id'])
43
+ org = get_org(app['org_id'])
43
44
 
44
- @instance_map[namespace] = "#{app['title']}-#{instance['name']}"
45
+ @instance_map[namespace] = {
46
+ 'name' => "#{app['name']}.#{instance['name']}",
47
+ 'title' => "#{app['title']} - #{instance['title']}",
48
+ 'type' => instance['type'],
49
+ 'organization' => org['title'],
50
+ 'organization_name' => org['name'],
51
+ }
45
52
  end
46
53
 
47
- record['wodby.instance'] = @instance_map[namespace]
54
+ record['wodby.instance'] = @instance_map[namespace]['name']
55
+ record['wodby.instance_title'] = @instance_map[namespace]['title']
56
+ record['wodby.instance_type'] = @instance_map[namespace]['type']
57
+ record['wodby.organization'] = @instance_map[namespace]['organization']
58
+ record['wodby.organization_name'] = @instance_map[namespace]['organization_name']
48
59
  else
49
60
  log.info "No namespace found"
50
61
  log.info record
@@ -82,6 +93,20 @@ module Fluent
82
93
 
83
94
  app
84
95
  end
96
+
97
+ def get_org(org_id)
98
+ begin
99
+ response = RestClient.get(
100
+ "https://api.wodby.com/api/v3/orgs/#{org_id}",
101
+ headers={'X-API-KEY': @api_key}
102
+ )
103
+ org = JSON.parse(response)
104
+ rescue RestClient::ExceptionWithResponse
105
+ org = {}
106
+ end
107
+
108
+ org
109
+ end
85
110
  end
86
111
  end
87
112
  end
@@ -22,9 +22,11 @@ class WodbyFilterTest < Test::Unit::TestCase
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-wodby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Wunderer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2023-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
- rubygems_version: 3.3.7
140
+ rubygems_version: 3.3.26
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Tranlates Wodbys instance UUIDs into instance names