fluent-plugin-zookeeper 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-zookeeper.gemspec +1 -1
- data/lib/fluent/plugin/out_zookeeper.rb +46 -28
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ae092a2de92fad8b379a960104c0db3e407422a
|
4
|
+
data.tar.gz: 3a6b02377da167826d0f3a9663a39bf1d2141f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1d1208b37d537ce23ca660fbfdf2f1bff77733abab07b3cf92e391145b1533a9b3b51f75b74319843e59063ed164ce371f721d47c4308cfd4aafdad9403d24f
|
7
|
+
data.tar.gz: 2ce896b6aab4ec0979481df4e2e5fbcf62779e0b9a1affb11cd0cd53bc6b820131abd78c6d172ecd6d87eebcc57b84e4d8f813a649250473993714a13d0e190e
|
@@ -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-zookeeper"
|
6
|
-
spec.version = "0.1.
|
6
|
+
spec.version = "0.1.2"
|
7
7
|
spec.authors = ["Anton Tikhomirov"]
|
8
8
|
spec.email = ["anton.tikhomirov@cdnetworks.com"]
|
9
9
|
|
@@ -39,19 +39,29 @@ DESC
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def init_client(raise_exception = true)
|
42
|
+
log.info "Initializing connection to Zookeeper"
|
42
43
|
begin
|
43
|
-
@zk
|
44
|
+
if @zk.nil?
|
45
|
+
@zk = Zookeeper.new(@servers)
|
46
|
+
else
|
47
|
+
@zk.reopen
|
48
|
+
end
|
44
49
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
+
if @zk.connected?
|
51
|
+
case @type
|
52
|
+
when 'ephemeral'
|
53
|
+
@zk.create({path: @path, ephemeral: true})
|
54
|
+
when 'sequence'
|
55
|
+
@zk.create({path: @path, sequence: true})
|
56
|
+
else
|
57
|
+
# persistent (or anything else)
|
58
|
+
@zk.create({path: @path})
|
59
|
+
end
|
60
|
+
log.info "Connection to Zookeeper service [#@servers] has been initialized"
|
61
|
+
@con_lost_msg = "Connection to Zookeeper was lost"
|
50
62
|
else
|
51
|
-
|
52
|
-
@zk.create({path: @path})
|
63
|
+
log.warn "Cannot establish connection to Zookeeper"
|
53
64
|
end
|
54
|
-
log.info "Connection to Zookeeper service [#@servers] has been initialized"
|
55
65
|
rescue Exception => e
|
56
66
|
if raise_exception
|
57
67
|
raise e
|
@@ -91,27 +101,35 @@ DESC
|
|
91
101
|
end
|
92
102
|
|
93
103
|
def process(tag, es)
|
94
|
-
if
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
next
|
104
|
+
if @zk.connected?
|
105
|
+
begin
|
106
|
+
es.each do |time, record|
|
107
|
+
begin
|
108
|
+
data = @formatter_proc.call(record)
|
109
|
+
rescue StandardError => e
|
110
|
+
log.warn "Failed to format record:", :error => e.to_s, :record => record
|
111
|
+
next
|
112
|
+
end
|
113
|
+
if @ignore_empty_msg && data == "{}"
|
114
|
+
log.debug "Skipping empty record"
|
115
|
+
next
|
116
|
+
end
|
117
|
+
@zk.set({path: @path, data: data})
|
109
118
|
end
|
110
|
-
|
119
|
+
rescue Exception => e
|
120
|
+
log.error "Exception occurred while sending data: #{e}"
|
121
|
+
# Connection will be reinitialized on next call
|
122
|
+
@zk.close
|
123
|
+
end
|
124
|
+
elsif !@zk.connecting?
|
125
|
+
# We are not connected and not connecting; it's time to reinit the client
|
126
|
+
@zk.close if !@zk.closed?
|
127
|
+
init_client(false)
|
128
|
+
else
|
129
|
+
if !@con_lost_msg.nil?
|
130
|
+
log.warn "#@con_lost_msg"
|
131
|
+
@con_lost_msg = nil
|
111
132
|
end
|
112
|
-
rescue Exception => e
|
113
|
-
log.warn "Exception occurred while sending data: #{e}"
|
114
|
-
raise e
|
115
133
|
end
|
116
134
|
end
|
117
135
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-zookeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Tikhomirov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.5.1
|
138
|
+
rubygems_version: 2.5.2.1
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Fluentd plugin for Apache Zookeeper
|