fluent-plugin-out-kivera 1.0.3 → 1.0.4
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 +4 -4
- data/.github/workflows/test.yml +43 -0
- data/CHANGELOG.md +4 -0
- data/Makefile +2 -2
- data/README.md +8 -0
- data/fluent-plugin-out-kivera.gemspec +1 -1
- data/lib/fluent/plugin/out_kivera.rb +14 -9
- data/run_test.rb +4 -0
- metadata +5 -8
- data/.github/workflows/linux.yml +0 -26
- data/.github/workflows/macos.yml +0 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 721bfd6a1f2d3a7fd4c1b0f32f4c0b9c719f893efceb5e4efc85d120a584cfd0
|
|
4
|
+
data.tar.gz: 4e5570fb109cc3a10611943feb6d5a969e1bb622e465f265fb64a7f690446199
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c12450c146eac19c5a4ad93c981d65b7a37380079a0be5b76f8e26ee80536efaf423d7ac25d79c77cce10151a6da38e7b3595e7ff7801b0fe4bc8e5e66e2129a
|
|
7
|
+
data.tar.gz: 1b739bbcc134e71c865c0c431b169717e8a287d43f93ef4434e17f9eeb2495e120a9490e0c3d609542ed1beb797ba92816bf7bd8d4224ec698ca4ce0cb457a01
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# name: Test
|
|
2
|
+
# on:
|
|
3
|
+
# - push
|
|
4
|
+
# - pull_request
|
|
5
|
+
# jobs:
|
|
6
|
+
# build:
|
|
7
|
+
# runs-on: ${{ matrix.os }}
|
|
8
|
+
# strategy:
|
|
9
|
+
# fail-fast: false
|
|
10
|
+
# matrix:
|
|
11
|
+
# ruby: [ '2.7', '3.0', '3.1' ]
|
|
12
|
+
# os:
|
|
13
|
+
# - ubuntu-latest
|
|
14
|
+
# - macOS-latest
|
|
15
|
+
# name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
|
16
|
+
# steps:
|
|
17
|
+
# - uses: actions/checkout@v3
|
|
18
|
+
# - uses: ruby/setup-ruby@v1
|
|
19
|
+
# with:
|
|
20
|
+
# ruby-version: ${{ matrix.ruby }}
|
|
21
|
+
# bundler-cache: true
|
|
22
|
+
# - name: unit testing
|
|
23
|
+
# run: |
|
|
24
|
+
# bundle exec rake test
|
|
25
|
+
|
|
26
|
+
# gem:
|
|
27
|
+
# name: Gem test
|
|
28
|
+
# runs-on: ubuntu-latest
|
|
29
|
+
# steps:
|
|
30
|
+
# - uses: actions/checkout@v3
|
|
31
|
+
# - uses: ruby/setup-ruby@v1
|
|
32
|
+
# with:
|
|
33
|
+
# ruby-version: 3.1
|
|
34
|
+
# - name: Install
|
|
35
|
+
# run: |
|
|
36
|
+
# rake install
|
|
37
|
+
# gem install test-unit webrick
|
|
38
|
+
# - name: Test
|
|
39
|
+
# run: |
|
|
40
|
+
# mkdir -p tmp
|
|
41
|
+
# cd tmp
|
|
42
|
+
# cp -a ../test/ ./
|
|
43
|
+
# ../run_test.rb
|
data/CHANGELOG.md
CHANGED
data/Makefile
CHANGED
|
@@ -4,9 +4,9 @@ SHELL=/bin/bash
|
|
|
4
4
|
|
|
5
5
|
build:
|
|
6
6
|
@if [ "${VER}" = "" ]; then echo "VER not set"; exit 1; else echo "VER=${VER}"; fi
|
|
7
|
-
sed -i 's/ gem.version.*/ gem.version = "${VER}"/g' fluent-plugin-out-kivera.gemspec
|
|
7
|
+
sed -i '' 's/ gem.version.*/ gem.version = "${VER}"/g' fluent-plugin-out-kivera.gemspec
|
|
8
8
|
gem build fluent-plugin-out-kivera
|
|
9
9
|
|
|
10
10
|
push:
|
|
11
11
|
@if [ "${VER}" = "" ]; then echo "VER not set"; exit 1; else echo "VER=${VER}"; fi
|
|
12
|
-
gem push fluent-plugin-out-kivera-${VER}.gem
|
|
12
|
+
gem push fluent-plugin-out-kivera-${VER}.gem
|
data/README.md
CHANGED
|
@@ -60,3 +60,11 @@ Heavily based on [fluent-plugin-out-http][2]
|
|
|
60
60
|
[1]: http://fluentd.org/
|
|
61
61
|
[2]: https://github.com/fluent-plugins-nursery/fluent-plugin-out-http
|
|
62
62
|
[3]: https://github.com/sabottenda/fluent-plugin-bufferize
|
|
63
|
+
|
|
64
|
+
## How to release
|
|
65
|
+
|
|
66
|
+
1. Update `gem.version` of the `gemspec` file.
|
|
67
|
+
1. Update `CHANGELOG.md`.
|
|
68
|
+
1. Commit them.
|
|
69
|
+
1. `$ bundle exec rake release`
|
|
70
|
+
* It will add and push the tag, and publish the gem.
|
|
@@ -48,6 +48,9 @@ class Fluent::Plugin::HTTPOutput < Fluent::Plugin::Output
|
|
|
48
48
|
# kivera proxy client secret
|
|
49
49
|
config_param :client_secret, :string, default: ""
|
|
50
50
|
|
|
51
|
+
# Kivera proxy entity secret
|
|
52
|
+
config_param :entity_secret, :string, default: ""
|
|
53
|
+
|
|
51
54
|
# kivera audience api
|
|
52
55
|
config_param :audience, :string, default: ""
|
|
53
56
|
|
|
@@ -112,11 +115,12 @@ class Fluent::Plugin::HTTPOutput < Fluent::Plugin::Output
|
|
|
112
115
|
config = conf.elements(name: 'storage').first
|
|
113
116
|
@storage = storage_create(usage: 'jwt_token', conf: config, default_type: 'local')
|
|
114
117
|
|
|
115
|
-
|
|
118
|
+
unless @config_file.empty?
|
|
116
119
|
creds = File.read(@config_file)
|
|
117
120
|
parsed = Yajl::Parser.new.parse(StringIO.new(creds))
|
|
118
121
|
@client_id = parsed.fetch("client_id", @client_id)
|
|
119
122
|
@client_secret = parsed.fetch("client_secret", @client_secret)
|
|
123
|
+
@entity_secret = parsed.fetch("entity_secret", @entity_secret)
|
|
120
124
|
@audience = parsed.fetch("audience", @audience)
|
|
121
125
|
@auth0_cert = parsed.fetch("auth0_cert", @auth0_cert)
|
|
122
126
|
@auth0_cert_file = parsed.fetch("auth0_cert", @auth0_cert_file)
|
|
@@ -127,10 +131,10 @@ class Fluent::Plugin::HTTPOutput < Fluent::Plugin::Output
|
|
|
127
131
|
@auth0_cert = File.read(@auth0_cert_file)
|
|
128
132
|
end
|
|
129
133
|
|
|
130
|
-
if @client_id.empty? &&
|
|
131
|
-
@client_secret.empty? &&
|
|
132
|
-
@audience.empty? &&
|
|
133
|
-
@auth0_cert.empty? &&
|
|
134
|
+
if @client_id.empty? &&
|
|
135
|
+
@client_secret.empty? &&
|
|
136
|
+
@audience.empty? &&
|
|
137
|
+
@auth0_cert.empty? &&
|
|
134
138
|
@auth0_domain.empty?
|
|
135
139
|
params = "client_id, client_secret, audience, auth0_cert and auth0_domain"
|
|
136
140
|
raise Fluent::ConfigError, "Missing configuration. Either specify a config_file or set the #{params} parameters"
|
|
@@ -207,12 +211,13 @@ class Fluent::Plugin::HTTPOutput < Fluent::Plugin::Output
|
|
|
207
211
|
url = "https://" + @auth0_domain + "/oauth/token"
|
|
208
212
|
uri = URI.parse(url)
|
|
209
213
|
req = Net::HTTP::Post.new(uri.to_s)
|
|
210
|
-
payload = {
|
|
214
|
+
payload = {
|
|
211
215
|
"client_id" => @client_id,
|
|
212
216
|
"client_secret" => @client_secret,
|
|
213
217
|
"audience" => @audience,
|
|
214
218
|
"grant_type" => "client_credentials"
|
|
215
219
|
}
|
|
220
|
+
payload["entity_secret"] = @entity_secret if @entity_secret
|
|
216
221
|
set_json_body(req, payload)
|
|
217
222
|
res = https(uri).request(req)
|
|
218
223
|
case res
|
|
@@ -281,8 +286,8 @@ class Fluent::Plugin::HTTPOutput < Fluent::Plugin::Output
|
|
|
281
286
|
end
|
|
282
287
|
|
|
283
288
|
def send_request(req, uri)
|
|
284
|
-
is_rate_limited = (@rate_limit_msec != 0
|
|
285
|
-
if is_rate_limited
|
|
289
|
+
is_rate_limited = (@rate_limit_msec != 0 && ! @last_request_time.nil?)
|
|
290
|
+
if is_rate_limited && ((Time.now.to_f - @last_request_time) * 1000.0 < @rate_limit_msec)
|
|
286
291
|
log.info('Dropped request due to rate limiting')
|
|
287
292
|
return
|
|
288
293
|
end
|
|
@@ -308,7 +313,7 @@ class Fluent::Plugin::HTTPOutput < Fluent::Plugin::Output
|
|
|
308
313
|
log.warn "Net::HTTP.#{req.method.capitalize} raises exception: #{e.class}, '#{e.message}'"
|
|
309
314
|
raise e if @raise_on_error
|
|
310
315
|
else
|
|
311
|
-
unless res
|
|
316
|
+
unless res && res.is_a?(Net::HTTPSuccess)
|
|
312
317
|
res_summary = if res
|
|
313
318
|
"#{res.code} #{res.message} #{res.body}"
|
|
314
319
|
else
|
data/run_test.rb
ADDED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-out-kivera
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Matheson
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: yajl-ruby
|
|
@@ -108,8 +107,7 @@ executables: []
|
|
|
108
107
|
extensions: []
|
|
109
108
|
extra_rdoc_files: []
|
|
110
109
|
files:
|
|
111
|
-
- ".github/workflows/
|
|
112
|
-
- ".github/workflows/macos.yml"
|
|
110
|
+
- ".github/workflows/test.yml"
|
|
113
111
|
- ".gitignore"
|
|
114
112
|
- CHANGELOG.md
|
|
115
113
|
- Gemfile
|
|
@@ -121,13 +119,13 @@ files:
|
|
|
121
119
|
- fluent-plugin-out-kivera.gemspec
|
|
122
120
|
- lib/fluent/plugin/out_kivera.rb
|
|
123
121
|
- lib/fluent/test/http_output_test.rb
|
|
122
|
+
- run_test.rb
|
|
124
123
|
- test/plugin/script/plugin/formatter_test.rb
|
|
125
124
|
- test/plugin/test_out_kivera.rb
|
|
126
125
|
homepage: https://github.com/kivera-io/fluent-plugin-out-kivera
|
|
127
126
|
licenses:
|
|
128
127
|
- Apache-2.0
|
|
129
128
|
metadata: {}
|
|
130
|
-
post_install_message:
|
|
131
129
|
rdoc_options: []
|
|
132
130
|
require_paths:
|
|
133
131
|
- lib
|
|
@@ -142,8 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
142
140
|
- !ruby/object:Gem::Version
|
|
143
141
|
version: '0'
|
|
144
142
|
requirements: []
|
|
145
|
-
rubygems_version:
|
|
146
|
-
signing_key:
|
|
143
|
+
rubygems_version: 4.0.3
|
|
147
144
|
specification_version: 4
|
|
148
145
|
summary: Fluentd plugin for Kivera
|
|
149
146
|
test_files:
|
data/.github/workflows/linux.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: Testing on Ubuntu
|
|
2
|
-
on:
|
|
3
|
-
- push
|
|
4
|
-
- pull_request
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
runs-on: ${{ matrix.os }}
|
|
8
|
-
strategy:
|
|
9
|
-
fail-fast: false
|
|
10
|
-
matrix:
|
|
11
|
-
ruby: [ '2.4', '2.5', '2.6', '2.7' ]
|
|
12
|
-
os:
|
|
13
|
-
- ubuntu-latest
|
|
14
|
-
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v2
|
|
17
|
-
- uses: ruby/setup-ruby@v1
|
|
18
|
-
with:
|
|
19
|
-
ruby-version: ${{ matrix.ruby }}
|
|
20
|
-
- name: unit testing
|
|
21
|
-
env:
|
|
22
|
-
CI: true
|
|
23
|
-
run: |
|
|
24
|
-
gem install bundler rake
|
|
25
|
-
bundle install --jobs 4 --retry 3
|
|
26
|
-
bundle exec rake test
|
data/.github/workflows/macos.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: Testing on macOS
|
|
2
|
-
on:
|
|
3
|
-
- push
|
|
4
|
-
- pull_request
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
runs-on: ${{ matrix.os }}
|
|
8
|
-
strategy:
|
|
9
|
-
fail-fast: false
|
|
10
|
-
matrix:
|
|
11
|
-
ruby: [ '2.4', '2.5', '2.6', '2.7' ]
|
|
12
|
-
os:
|
|
13
|
-
- macOS-latest
|
|
14
|
-
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v2
|
|
17
|
-
- uses: ruby/setup-ruby@v1
|
|
18
|
-
with:
|
|
19
|
-
ruby-version: ${{ matrix.ruby }}
|
|
20
|
-
- name: unit testing
|
|
21
|
-
env:
|
|
22
|
-
CI: true
|
|
23
|
-
run: |
|
|
24
|
-
gem install bundler rake
|
|
25
|
-
bundle install --jobs 4 --retry 3
|
|
26
|
-
bundle exec rake test
|