fluent-plugin-zulip 0.2.0 → 0.3.0
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 +5 -5
- data/README.md +1 -1
- data/fluent-plugin-zulip.gemspec +1 -1
- data/lib/fluent/plugin/out_zulip.rb +34 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4c5550a900e952282b33adf8dbcf3bc83c952edfdd23dc384fb5455eac5d9d5f
|
4
|
+
data.tar.gz: 89efb548af4c58dfd5fe811866cf9192eaeb4e2d8db164745ea46e993c73bad9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaa30b5fef8588d29771ce57ac95019e49f82b5a480c7bf0407f7022943aeedab44e70943b309bb500d6e356a0b5c800d9767337940df020d08a426d07c766e3
|
7
|
+
data.tar.gz: b0556c0e86c1463806aa8eb0a72a741e797dc831eb86f5e9194ed5a4f4912c214f0c2707fea1e9be370ca912d11cfe1dc4a96411d336262ccc9bf3d6bde046fd
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ $ bundle
|
|
56
56
|
|
57
57
|
## Fluent::Plugin::ZulipOutput
|
58
58
|
|
59
|
-
* **
|
59
|
+
* **site** (string) (required): Site URI
|
60
60
|
* **bot_email_address** (string) (required): Bot email address
|
61
61
|
* **bot_api_key** (string) (required): Bot API key
|
62
62
|
* **message_type** (enum) (optional): Send message type
|
data/fluent-plugin-zulip.gemspec
CHANGED
@@ -24,7 +24,7 @@ module Fluent
|
|
24
24
|
ZULIP_SUBJECT_MAX_SIZE = 60
|
25
25
|
ZULIP_CONTENT_MAX_SIZE = 10000
|
26
26
|
|
27
|
-
desc "
|
27
|
+
desc "Site URI. ex: https://zulip.exmaple.com/"
|
28
28
|
config_param :site, :string
|
29
29
|
desc "Bot email address"
|
30
30
|
config_param :bot_email_address, :string
|
@@ -42,6 +42,15 @@ module Fluent
|
|
42
42
|
config_param :subject_key, :string, default: nil
|
43
43
|
desc "Content from record"
|
44
44
|
config_param :content_key, :string, default: "message"
|
45
|
+
config_param :verify_ssl, :bool, default: true
|
46
|
+
|
47
|
+
config_section :buffer do
|
48
|
+
config_set_default :chunk_keys, ["tag"]
|
49
|
+
end
|
50
|
+
|
51
|
+
def multi_workers_ready?
|
52
|
+
true
|
53
|
+
end
|
45
54
|
|
46
55
|
def configure(conf)
|
47
56
|
super
|
@@ -63,20 +72,41 @@ module Fluent
|
|
63
72
|
|
64
73
|
@client = Zulip::Client.new(site: @site,
|
65
74
|
username: @bot_email_address,
|
66
|
-
api_key: @bot_api_key
|
75
|
+
api_key: @bot_api_key,
|
76
|
+
ssl: { verify: @verify_ssl })
|
67
77
|
end
|
68
78
|
|
69
79
|
def process(tag, es)
|
70
80
|
es.each do |time, record|
|
81
|
+
process_record(tag, time, record)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def write(chunk)
|
86
|
+
tag = chunk.metadata.tag
|
87
|
+
chunk.each do |time, record|
|
88
|
+
process_record(tag, time, record)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def process_record(tag, time, record)
|
93
|
+
loop do
|
71
94
|
response = send_message(tag, time, record)
|
72
|
-
|
73
|
-
|
95
|
+
case
|
96
|
+
when response.success?
|
97
|
+
log.trace(response.body)
|
98
|
+
when response.status == 429
|
99
|
+
interval = response.headers["X-RateLimit-Reset"].to_i - Time.now.to_i
|
100
|
+
log.info("Sleeping: #{interval} sec")
|
101
|
+
sleep(interval)
|
102
|
+
next
|
74
103
|
else
|
75
104
|
log.error(status: response.status,
|
76
105
|
message: response.reason_phrase,
|
77
106
|
body: response.body)
|
78
107
|
end
|
79
108
|
log.debug(response)
|
109
|
+
break
|
80
110
|
end
|
81
111
|
end
|
82
112
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-zulip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Okimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.7.3
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Fluentd output plugin for Zulip powerful open source group chat.
|