fluent-plugin-barito 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bed716866d230da6c6be384b855d783803a7bef2
4
- data.tar.gz: 60463ec82d959f37aa733fd572572fa60c5e0634
2
+ SHA256:
3
+ metadata.gz: 380a4d3f92566e9da10ce617114c07aca43f7313530efb1c905dec6771ab7e3f
4
+ data.tar.gz: 7f7db5fc7f2125649d3365154392dd10b2f7af445cb86bdd487cf5e6a730ad47
5
5
  SHA512:
6
- metadata.gz: 76ca397a0037497a536d9193f9933cbc6d078c8e2731ca43bdd1682d83f50bd0c055074ba066d4e86c5b3a678cedf5073b6212bee79e7a8bb9d4e964bbf2d251
7
- data.tar.gz: f35eb8952499925b14c1d4c94277ce411e9fcd04ab2f87983330d8f6f4052b39064c577e002c7618a6fcde7ed0c7d5e716d5045ac7cd7d9aac72aebd3506ca06
6
+ metadata.gz: f14b53f8afb43f140be186f20d1c175e8ab3c914219b6cb11146c0578bd2123ef9ebe13c17360d8de0a76aca1e87362d69428853db357393973cc91c00f66c5e
7
+ data.tar.gz: 937d8010b022fcd4fe88bdb625649009f03af708bc1ec593d1a103ef84a038b03a5f59c9a08e3d0b45de006dad9c7d35d336915891566aaa16b4bd5af18d5326
@@ -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-barito"
6
- spec.version = "0.1.10"
6
+ spec.version = "0.1.11"
7
7
  spec.authors = ["BaritoLog"]
8
8
  spec.email = ["pushm0v.development@gmail.com", "iman.tung@gmail.com"]
9
9
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'simplecov'
28
28
  spec.add_development_dependency 'coveralls', '~> 0.8.21'
29
29
  spec.add_development_dependency 'test-unit', '~> 3.2'
30
-
30
+
31
31
  spec.add_runtime_dependency "fluentd", "~> 0.12", ">= 0.12.0"
32
32
  spec.add_runtime_dependency "rest-client", "~> 2"
33
33
  end
@@ -7,17 +7,10 @@ module Fluent
7
7
  class BaritoK8sOutput < BufferedOutput
8
8
 
9
9
  PLUGIN_NAME = 'barito_k8s'
10
-
11
- LABEL_APP_SECRET = 'baritoApplicationSecret'
12
- LABEL_PRODUCE_HOST = 'baritoProduceHost'
13
- LABEL_PRODUCE_PORT = 'baritoProducePort'
14
- LABEL_PRODUCE_TOPIC = 'baritoProduceTopic'
15
-
10
+ LABEL_APP_SECRET = 'barito.applicationSecret'
11
+ LABEL_PRODUCE_URL = 'barito.produceUrl'
16
12
 
17
13
  Fluent::Plugin.register_output(PLUGIN_NAME, self)
18
-
19
- config_param :use_https, :bool, :default => false
20
-
21
14
 
22
15
  # Overide from BufferedOutput
23
16
  def start
@@ -31,38 +24,28 @@ module Fluent
31
24
 
32
25
  # Overide from BufferedOutput
33
26
  def write(chunk)
34
-
35
27
  chunk.msgpack_each do |tag, time, record|
36
- labels = record['kubernetes']['labels']
37
- url = produce_url(labels)
38
- secret = application_secret(labels)
39
-
40
- trail = Fluent::Plugin::ClientTrail.new(true)
41
-
28
+ params = record['kubernetes']['annotations']
29
+
30
+ next if params.nil?
31
+ url = produce_url(params)
32
+ secret = application_secret(params)
33
+
34
+ next if url.nil? or secret.nil?
35
+ trail = Fluent::Plugin::ClientTrail.new(false)
42
36
  timber = Fluent::Plugin::TimberFactory::create_timber(tag, time, record, trail)
43
37
  header = {content_type: :json, 'X-App-Secret' => secret}
44
-
38
+
45
39
  RestClient.post url, timber.to_json, header
46
40
  end
47
41
  end
48
-
49
- def produce_url(labels)
50
- produce_host = labels[LABEL_PRODUCE_HOST]
51
- produce_port = labels[LABEL_PRODUCE_PORT]
52
- produce_topic = labels[LABEL_PRODUCE_TOPIC]
53
-
54
- protocol = @use_https? 'https' : 'http'
55
-
56
- produce_url = "#{protocol}://#{produce_host}:#{produce_port}/produce/#{produce_topic}"
57
- produce_url
42
+
43
+ def produce_url(params)
44
+ params[LABEL_PRODUCE_URL]
58
45
  end
59
-
60
- def application_secret(labels)
61
- labels[LABEL_APP_SECRET]
46
+
47
+ def application_secret(params)
48
+ params[LABEL_APP_SECRET]
62
49
  end
63
-
64
-
65
50
  end
66
-
67
-
68
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-barito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - BaritoLog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-24 00:00:00.000000000 Z
11
+ date: 2018-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  requirements: []
188
188
  rubyforge_project:
189
- rubygems_version: 2.6.14
189
+ rubygems_version: 2.7.6
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: Fluentd output plugin for BaritoLog