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 +4 -4
- data/fluent-plugin-wodby.gemspec +1 -1
- data/lib/fluent/plugin/filter_wodby.rb +27 -2
- data/test/plugin/test_filter_wodby.rb +5 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23ae85cc153a514e34cca03046b10a61ad3147fef2e2116fd94dead6d14e0fbb
|
4
|
+
data.tar.gz: 9e98ed0e992289f9b3d6fa0143c27d72377d460bed2bce9343b80b863723a70a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59116055801189e0e2a14af1783d9c3d32eeb3796c7f15ca6d78e0299bfe37e86d11b5fd18ee63db5ff47d623359bcbfcf2e54e1d6c6249aa0f4fbf5681afa50
|
7
|
+
data.tar.gz: 8ab9b95f8843fed694541bc4e1489fba6338b0870f16a161a6fa736f059273902252b4b4a194a39396e759bfa8df8dd22bc8850ccf6df4726cdfd626220ac68f
|
data/fluent-plugin-wodby.gemspec
CHANGED
@@ -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] =
|
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('
|
26
|
-
assert_equal('
|
27
|
-
assert_equal('
|
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.
|
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:
|
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.
|
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
|