fluent-plugin-gcloud-pubsub-custom 0.3.0 → 0.3.1
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/CHANGELOG.md +42 -24
- data/README.md +3 -0
- data/fluent-plugin-gcloud-pubsub-custom.gemspec +1 -1
- data/lib/fluent/plugin/gcloud_pubsub/client.rb +8 -3
- data/lib/fluent/plugin/out_gcloud_pubsub.rb +8 -6
- data/test/plugin/test_out_gcloud_pubsub.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fca9651c5d6e9f497579b5ee6ba6a42f2bb4e69a
|
4
|
+
data.tar.gz: d3a2a04f0e645a04a9828188715a4fab827cd4c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14806e97d5234bf531850e890b53066e65deb222e9eb602d509102f09496d38a8082568ae228a9ff74cfb544323327529422de22a39d1ac5c5977ea6208e27ea
|
7
|
+
data.tar.gz: e874e411b67cfaac3e0f13635661206fd50a812104d2ac0bb2cf68eb3d17f3c74d9b05797af1a4b14d9bd4f646602823631f96641640e61f6a2e1ce053a42698
|
data/CHANGELOG.md
CHANGED
@@ -1,26 +1,44 @@
|
|
1
1
|
## ChangeLog
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
|
25
|
-
|
26
|
-
|
3
|
+
### Release 0.3.1 - 2016/11/03
|
4
|
+
|
5
|
+
- Output plugin
|
6
|
+
- Improve error handling
|
7
|
+
|
8
|
+
### Release 0.3.0 - 2016/10/30
|
9
|
+
|
10
|
+
- Bump up google-cloud-pubsub to v0.21
|
11
|
+
- Input plugin
|
12
|
+
- Add multithreaded pulling feature
|
13
|
+
|
14
|
+
### Release 0.2.0 - 2016/10/15
|
15
|
+
|
16
|
+
- Input plugin
|
17
|
+
- Add HTTP RPC feature
|
18
|
+
|
19
|
+
### Release 0.1.4 - 2016/09/19
|
20
|
+
|
21
|
+
- Input plugin
|
22
|
+
- `pull_interval` can be specified float value
|
23
|
+
- `topic` must be specified
|
24
|
+
|
25
|
+
### Release 0.1.3 - 2016/09/17
|
26
|
+
|
27
|
+
- Input plugin
|
28
|
+
- Fix error handling and add debug logging
|
29
|
+
|
30
|
+
### Release 0.1.2 - 2016/09/11
|
31
|
+
|
32
|
+
- Output plugin
|
33
|
+
- Change default max message size and add debug message
|
34
|
+
|
35
|
+
### Release 0.1.1 - 2016/08/27
|
36
|
+
|
37
|
+
- Bump up google-cloud-pubsub (gcloud-ruby) to 0.20
|
38
|
+
|
39
|
+
### Release 0.1.0 - 2016/08/22
|
40
|
+
|
41
|
+
- Use formatter / parser plugin and add format configuration
|
42
|
+
- Bump up gcloud-ruby to 0.12
|
43
|
+
- Remove dependency on lightening buffer
|
44
|
+
- Fix error caused by Pub/Sub quotas
|
data/README.md
CHANGED
@@ -88,6 +88,7 @@ Use `gcloud_pubsub` input plugin.
|
|
88
88
|
max_messages 1000
|
89
89
|
return_immediately true
|
90
90
|
pull_interval 0.5
|
91
|
+
pull_threads 2
|
91
92
|
format json
|
92
93
|
enable_rpc true
|
93
94
|
rpc_bind 0.0.0.0
|
@@ -116,6 +117,8 @@ Use `gcloud_pubsub` input plugin.
|
|
116
117
|
- If `return_immediately` is `true` and pulling message is stopped by HTTP RPC, this plugin wait `pull_interval` each pull.
|
117
118
|
- `pull_interval` (optional, default: `5.0`)
|
118
119
|
- Pulling messages by intervals of specified seconds.
|
120
|
+
- `pull_threads` (optional, default: `1`)
|
121
|
+
- Set number of threads to pull messages.
|
119
122
|
- `format` (optional, default: `json`)
|
120
123
|
- Set input format. See format section in http://docs.fluentd.org/articles/in_tail
|
121
124
|
- `enable_rpc` (optional, default: `false`)
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.license = "MIT"
|
8
8
|
gem.homepage = "https://github.com/mia-0032/fluent-plugin-gcloud-pubsub-custom"
|
9
9
|
gem.summary = gem.description
|
10
|
-
gem.version = "0.3.
|
10
|
+
gem.version = "0.3.1"
|
11
11
|
gem.authors = ["Yoshihiro MIYAI"]
|
12
12
|
gem.email = "msparrow17@gmail.com"
|
13
13
|
gem.has_rdoc = false
|
@@ -2,14 +2,17 @@ require 'google/cloud/pubsub'
|
|
2
2
|
|
3
3
|
module Fluent
|
4
4
|
module GcloudPubSub
|
5
|
-
class Error < StandardError
|
5
|
+
class Error < StandardError
|
6
|
+
end
|
7
|
+
class RetryableError < Error
|
8
|
+
end
|
6
9
|
|
7
10
|
class Publisher
|
8
11
|
def initialize(project, key, topic, autocreate_topic)
|
9
12
|
pubsub = Google::Cloud::Pubsub.new project: project, keyfile: key
|
10
13
|
|
11
14
|
@client = pubsub.topic topic, autocreate: autocreate_topic
|
12
|
-
raise
|
15
|
+
raise Error.new "topic:#{topic} does not exist." if @client.nil?
|
13
16
|
end
|
14
17
|
|
15
18
|
def publish(messages)
|
@@ -18,6 +21,8 @@ module Fluent
|
|
18
21
|
batch.publish m
|
19
22
|
end
|
20
23
|
end
|
24
|
+
rescue Google::Cloud::UnavailableError, Google::Cloud::DeadlineExceededError => ex
|
25
|
+
raise RetryableError.new "Google api returns error:#{ex.class.to_s} message:#{ex.to_s}"
|
21
26
|
end
|
22
27
|
end
|
23
28
|
|
@@ -26,7 +31,7 @@ module Fluent
|
|
26
31
|
pubsub = Google::Cloud::Pubsub.new project: project, keyfile: key
|
27
32
|
topic = pubsub.topic topic
|
28
33
|
@client = topic.subscription subscription
|
29
|
-
raise
|
34
|
+
raise Error.new "subscription:#{subscription} does not exist." if @client.nil?
|
30
35
|
end
|
31
36
|
|
32
37
|
def pull(immediate, max)
|
@@ -35,15 +35,14 @@ module Fluent
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def format(tag, time, record)
|
38
|
-
|
38
|
+
@formatter.format(tag, time, record).to_msgpack
|
39
39
|
end
|
40
40
|
|
41
41
|
def write(chunk)
|
42
42
|
messages = []
|
43
43
|
size = 0
|
44
44
|
|
45
|
-
chunk.msgpack_each do |
|
46
|
-
msg = @formatter.format(tag, time, record)
|
45
|
+
chunk.msgpack_each do |msg|
|
47
46
|
if messages.length + 1 > @max_messages || size + msg.bytesize > @max_total_size
|
48
47
|
publish messages
|
49
48
|
messages = []
|
@@ -56,10 +55,13 @@ module Fluent
|
|
56
55
|
if messages.length > 0
|
57
56
|
publish messages
|
58
57
|
end
|
59
|
-
rescue =>
|
60
|
-
log.
|
58
|
+
rescue Fluent::GcloudPubSub::RetryableError => ex
|
59
|
+
log.warn "Retryable error occurs. Fluentd will retry.", error_message: ex.to_s, error_class: ex.class.to_s
|
60
|
+
raise ex
|
61
|
+
rescue => ex
|
62
|
+
log.error "unexpected error", error_message: ex.to_s, error_class: ex.class.to_s
|
61
63
|
log.error_backtrace
|
62
|
-
raise
|
64
|
+
raise ex
|
63
65
|
end
|
64
66
|
|
65
67
|
private
|
@@ -120,7 +120,7 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
|
|
120
120
|
d.run
|
121
121
|
end
|
122
122
|
|
123
|
-
test 'reraise errors' do
|
123
|
+
test 'reraise unexpected errors' do
|
124
124
|
d = create_driver
|
125
125
|
@publisher.publish.once { raise ReRaisedError }
|
126
126
|
assert_raises ReRaisedError do
|
@@ -128,5 +128,14 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
|
|
128
128
|
d.run
|
129
129
|
end
|
130
130
|
end
|
131
|
+
|
132
|
+
test 'reraise RetryableError' do
|
133
|
+
d = create_driver
|
134
|
+
@publisher.publish.once { raise Google::Cloud::UnavailableError.new('TEST') }
|
135
|
+
assert_raises Fluent::GcloudPubSub::RetryableError do
|
136
|
+
d.emit([{'a' => 1, 'b' => 2}])
|
137
|
+
d.run
|
138
|
+
end
|
139
|
+
end
|
131
140
|
end
|
132
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-gcloud-pubsub-custom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshihiro MIYAI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|