fluent-plugin-gcloud-pubsub-custom 0.4.5 → 0.4.6

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
2
  SHA1:
3
- metadata.gz: 629ea3f3f5f1f6be876e055dc8725630318002eb
4
- data.tar.gz: 86a7b557b7c2a209bf3cacebf3450034d34626a4
3
+ metadata.gz: 9db89e553b8ed2af172483421345f062fb457bdb
4
+ data.tar.gz: 6a48713f2def51581fcd5745b513a8b5d2f17970
5
5
  SHA512:
6
- metadata.gz: d145243e20fd085994ca66f77b904290d11b489ccda739db2d4355659d833e6f3a78420c6f2dafa44f558946d38a9e49cc551ce1ebefc77457d10d038e349425
7
- data.tar.gz: 18338d5d011d45db17ced62e9e9f168dd68cef67dcd4c153922107750725112343ff1986207c5f099b01102c800906c2c36ff3a13bbeac2c5d88b904d06a6d83
6
+ metadata.gz: d57966e03358dd7d660f3448ac9106a36496643f9f7109fa75f87f0294bd596775c4ccb7703f689e03de844d7826dc0376858c910b9fa4d02d86af7b4a58f645
7
+ data.tar.gz: 757ee54ba5d8ccb9872535819cb27242642541cb0b2cb18f7802b8e2f95037ee191cfbaf10616ec7e7a22913c1ba7fb9fa7afb442b92d09c42e9ebced80ac1e8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## ChangeLog
2
2
 
3
+ ### Release 0.4.6 - 2017/05/14
4
+
5
+ - Output plugin
6
+ - Make messages exceeding configured size not be published because Pub/Sub clients cannot receive it
7
+
3
8
  ### Release 0.4.5 - 2017/04/02
4
9
 
5
10
  - Bump up google-cloud-pubsub to v0.24.x
data/README.md CHANGED
@@ -48,6 +48,7 @@ Use `gcloud_pubsub` output plugin.
48
48
  autocreate_topic false
49
49
  max_messages 1000
50
50
  max_total_size 9800000
51
+ max_message_size 4000000
51
52
  buffer_type file
52
53
  buffer_path /path/to/your/buffer
53
54
  flush_interval 1s
@@ -74,6 +75,8 @@ Use `gcloud_pubsub` output plugin.
74
75
  - `max_total_size` (optional, default: `9800000` = `9.8MB`)
75
76
  - Publishing messages bytesize per request to Cloud Pub/Sub. This parameter affects only message size. You should specify a little smaller value than quota.
76
77
  - See https://cloud.google.com/pubsub/quotas#other_limits
78
+ - `max_message_size` (optional, default: `4000000` = `4MB`)
79
+ - Messages exceeding `max_message_size` are not published because Pub/Sub clients cannot receive it.
77
80
  - `buffer_type`, `buffer_path`, `flush_interval`, `try_flush_interval`
78
81
  - These are fluentd buffer configuration. See http://docs.fluentd.org/articles/buffer-plugin-overview
79
82
  - `format` (optional, default: `json`)
@@ -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.4.5"
10
+ gem.version = "0.4.6"
11
11
  gem.authors = ["Yoshihiro MIYAI"]
12
12
  gem.email = "msparrow17@gmail.com"
13
13
  gem.has_rdoc = false
@@ -25,6 +25,8 @@ module Fluent
25
25
  config_param :max_messages, :integer, :default => 1000
26
26
  desc 'Publishing messages bytesize per request to Cloud Pub/Sub.'
27
27
  config_param :max_total_size, :integer, :default => 9800000 # 9.8MB
28
+ desc 'Limit bytesize per message.'
29
+ config_param :max_message_size, :integer, :default => 4000000 # 4MB
28
30
  desc 'Set output format.'
29
31
  config_param :format, :string, :default => 'json'
30
32
 
@@ -57,6 +59,10 @@ module Fluent
57
59
  size = 0
58
60
 
59
61
  chunk.msgpack_each do |msg|
62
+ if msg.bytesize > @max_message_size
63
+ log.warn 'Drop a message because its size exceeds `max_message_size`', size: msg.bytesize
64
+ next
65
+ end
60
66
  if messages.length + 1 > @max_messages || size + msg.bytesize > @max_total_size
61
67
  publish messages
62
68
  messages = []
@@ -31,6 +31,7 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
31
31
  assert_equal(false, d.instance.autocreate_topic)
32
32
  assert_equal(1000, d.instance.max_messages)
33
33
  assert_equal(9800000, d.instance.max_total_size)
34
+ assert_equal(4000000, d.instance.max_message_size)
34
35
  end
35
36
 
36
37
  test '"topic" must be specified' do
@@ -146,6 +147,19 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
146
147
  d.run
147
148
  end
148
149
 
150
+ test 'messages exceeding "max_message_size" are not published' do
151
+ d = create_driver(%[
152
+ project project-test
153
+ topic topic-test
154
+ key key-test
155
+ max_message_size 1000
156
+ ])
157
+
158
+ @publisher.publish.times(0)
159
+ d.emit({"a" => "a" * 1000}, @time)
160
+ d.run
161
+ end
162
+
149
163
  test 'accept "ASCII-8BIT" encoded multibyte strings' do
150
164
  # on fluentd v0.14, all strings treated as "ASCII-8BIT" except specified encoding.
151
165
  d = create_driver
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.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshihiro MIYAI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-02 00:00:00.000000000 Z
11
+ date: 2017-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd