fluent-plugin-wodby 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +2 -2
- data/Makefile +2 -2
- data/README.md +4 -3
- data/fluent-plugin-wodby.gemspec +2 -2
- data/lib/fluent/plugin/filter_wodby.rb +10 -8
- data/test/plugin/test_filter_wodby.rb +10 -10
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 469eb72bb742f469ad5971d49d596713edbb271956a732c4621098cea1865a96
|
4
|
+
data.tar.gz: 1bbea99af50452655e065d8e6ef752ba4a682e5198b675aa1abeaeba01455b91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6659e889809b6f8d613c782425adf2974917a0ffb3915e701975693bf6cb89cfe719ab2b386ce06f778dc203cc82e5c0b5169feb30ce154081d976ef3d41e69a
|
7
|
+
data.tar.gz: f5ac87623a93140f2486527f93510f83414f1260775b599292e5928fa43a455e54cacde609bf9fceb67e77305b96078efd1ea2e984c8739e00e08116949d3151
|
data/Makefile
CHANGED
@@ -2,8 +2,8 @@ PWD=$(shell pwd)
|
|
2
2
|
|
3
3
|
.PHONY: docker-test
|
4
4
|
docker-test:
|
5
|
-
docker run --rm -it -v $(PWD):/build -e WODBY_API_KEY=${WODBY_API_KEY} ruby /bin/bash -c "cd build && bundle install && bundle exec rake test"
|
5
|
+
docker run --rm -it -v $(PWD):/build -e WODBY_API_KEY=${WODBY_API_KEY} ruby:3.3 /bin/bash -c "cd build && bundle install && bundle exec rake test"
|
6
6
|
|
7
7
|
.PHONY: docker-tester
|
8
8
|
docker-tester:
|
9
|
-
docker run --rm -it -v $(PWD):/build -e WODBY_API_KEY=${WODBY_API_KEY} ruby /bin/bash
|
9
|
+
docker run --rm -it -v $(PWD):/build -e WODBY_API_KEY=${WODBY_API_KEY} ruby:3.3 /bin/bash
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# fluent-plugin-wodby
|
2
2
|
|
3
|
-
[Fluentd](https://fluentd.org/) filter plugin to
|
3
|
+
[Fluentd](https://fluentd.org/) filter plugin to enrich logging data with Wodby instance information.
|
4
4
|
|
5
|
-
|
5
|
+
This plugin will query the [Wodby](https://wodby.com) API to retrieve information about the
|
6
|
+
Wodby instance producing the logs.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -38,6 +39,6 @@ You can copy and paste generated documents here.
|
|
38
39
|
|
39
40
|
## Copyright
|
40
41
|
|
41
|
-
* Copyright(c) 2022-
|
42
|
+
* Copyright(c) 2022-2024: Ramsalt Lab
|
42
43
|
* License
|
43
44
|
* Apache License, Version 2.0
|
data/fluent-plugin-wodby.gemspec
CHANGED
@@ -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.
|
6
|
+
spec.version = "0.3.0"
|
7
7
|
spec.authors = ["Robert Wunderer"]
|
8
8
|
spec.email = ["robert@ramsalt.com"]
|
9
9
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = test_files
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_development_dependency "bundler", "~> 2.
|
22
|
+
spec.add_development_dependency "bundler", "~> 2.5.0"
|
23
23
|
spec.add_development_dependency "rake", "~> 13.0.6"
|
24
24
|
spec.add_development_dependency "test-unit", "~> 3.5.3"
|
25
25
|
spec.add_runtime_dependency "fluentd", [">= 0.14.10", "< 2"]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2022-
|
2
|
+
# Copyright 2022-2024: Ramsalt Lab
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -32,12 +32,14 @@ module Fluent
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def filter(tag, time, record)
|
35
|
-
record['wodby
|
35
|
+
record['wodby'] = {
|
36
|
+
'filter' => true
|
37
|
+
}
|
36
38
|
|
37
39
|
if record.has_key?('kubernetes') && record['kubernetes'].has_key?('namespace_name')
|
38
40
|
namespace = record['kubernetes']['namespace_name']
|
39
41
|
unless @instance_map.has_key?(namespace)
|
40
|
-
record['wodby
|
42
|
+
record['wodby']['instance_query'] = namespace
|
41
43
|
instance = get_instance(namespace)
|
42
44
|
app = get_app(instance['app_id'])
|
43
45
|
org = get_org(app['org_id'])
|
@@ -51,11 +53,11 @@ module Fluent
|
|
51
53
|
}
|
52
54
|
end
|
53
55
|
|
54
|
-
record['wodby
|
55
|
-
record['wodby
|
56
|
-
record['wodby
|
57
|
-
record['wodby
|
58
|
-
record['wodby
|
56
|
+
record['wodby']['instance'] = @instance_map[namespace]['name']
|
57
|
+
record['wodby']['instance_title'] = @instance_map[namespace]['title']
|
58
|
+
record['wodby']['instance_type'] = @instance_map[namespace]['type']
|
59
|
+
record['wodby']['organization'] = @instance_map[namespace]['organization']
|
60
|
+
record['wodby']['organization_title'] = @instance_map[namespace]['organization_title']
|
59
61
|
else
|
60
62
|
log.info "No namespace found"
|
61
63
|
log.info record
|
@@ -17,19 +17,19 @@ class WodbyFilterTest < Test::Unit::TestCase
|
|
17
17
|
time = event_time
|
18
18
|
d.run do
|
19
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' => '
|
20
|
+
d.feed('filter.test', time, { 'kubernetes' => {'namespace_name' => '7ee5d15f-7c3c-4ce8-873e-34b75154f0f4'}, 'message' => 'hullo' })
|
21
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('dfono.staging', d.filtered_records[0]['wodby
|
26
|
-
assert_equal('dfono.prod', d.filtered_records[1]['wodby
|
27
|
-
assert_equal('dfono.staging', d.filtered_records[2]['wodby
|
28
|
-
assert_equal('dfo.no - Staging', d.filtered_records[0]['wodby
|
29
|
-
assert_equal('dfo.no - Prod', d.filtered_records[1]['wodby
|
30
|
-
assert_nil(d.filtered_records[2]['wodby
|
31
|
-
assert_true(d.filtered_records[0]['wodby
|
32
|
-
assert_true(d.filtered_records[1]['wodby
|
33
|
-
assert_true(d.filtered_records[2]['wodby
|
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'])
|
30
|
+
assert_nil(d.filtered_records[2]['wodby']['instance_query'])
|
31
|
+
assert_true(d.filtered_records[0]['wodby']['filter'])
|
32
|
+
assert_true(d.filtered_records[1]['wodby']['filter'])
|
33
|
+
assert_true(d.filtered_records[2]['wodby']['filter'])
|
34
34
|
end
|
35
35
|
end
|
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.3.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: 2024-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.5.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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.
|
140
|
+
rubygems_version: 3.5.22
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Tranlates Wodbys instance UUIDs into instance names
|