franz 1.4.26 → 1.4.27
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/VERSION +1 -1
- data/lib/franz/agg.rb +0 -11
- data/lib/franz/tail.rb +41 -24
- data/lib/franz/watch.rb +1 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8020965f21e589c9a82a1c9467a7c8b404603b86
|
4
|
+
data.tar.gz: 5185f14e0811997c82f6c5445baacc0458e4357f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fa690fd0725c4525537da30964cab5151511b1e33ca48bbcca24e592e844548e98512401e47073e0248de76740134d77800a06db62b3aa0db79e4d27e547005
|
7
|
+
data.tar.gz: ae0fd575ede813e61101e33f87e06e5dd381ef0ad139c749c803da0425ae1e4b0583cb6518ee7219281b76822b44e69e60cbbc4bcfdece520e0a3ca7dc61fb53
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.27
|
data/lib/franz/agg.rb
CHANGED
@@ -51,9 +51,6 @@ module Franz
|
|
51
51
|
capture until @stop
|
52
52
|
end
|
53
53
|
|
54
|
-
@last_checkin = Time.new 0
|
55
|
-
@checkin_interval = 60
|
56
|
-
|
57
54
|
log.debug \
|
58
55
|
event: 'agg started',
|
59
56
|
configs: @configs,
|
@@ -83,13 +80,6 @@ module Franz
|
|
83
80
|
|
84
81
|
def log ; @logger end
|
85
82
|
|
86
|
-
def checkin now=Time.now
|
87
|
-
if @last_checkin < now - @checkin_interval
|
88
|
-
log.warn event: 'checkin', buffer_size: @buffer.length
|
89
|
-
@last_checkin = now
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
83
|
def type path
|
94
84
|
begin
|
95
85
|
@types.fetch path
|
@@ -168,7 +158,6 @@ module Franz
|
|
168
158
|
log.trace \
|
169
159
|
event: 'capture',
|
170
160
|
raw: event
|
171
|
-
checkin
|
172
161
|
multiline = config(event[:path])[:multiline] rescue nil
|
173
162
|
if multiline.nil?
|
174
163
|
enqueue event[:path], event[:line] unless event[:line].empty?
|
data/lib/franz/tail.rb
CHANGED
@@ -30,9 +30,6 @@ module Franz
|
|
30
30
|
handle(watch_events.shift) until @stop
|
31
31
|
end
|
32
32
|
|
33
|
-
@last_checkin = Time.new 0
|
34
|
-
@checkin_interval = 60
|
35
|
-
|
36
33
|
log.debug \
|
37
34
|
event: 'tail started',
|
38
35
|
watch_events: watch_events,
|
@@ -62,13 +59,6 @@ module Franz
|
|
62
59
|
|
63
60
|
def log ; @logger end
|
64
61
|
|
65
|
-
def checkin now=Time.now
|
66
|
-
if @last_checkin < now - @checkin_interval
|
67
|
-
log.warn event: 'checkin', cursors_size: @cursors.length
|
68
|
-
@last_checkin = now
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
62
|
def read path, size
|
73
63
|
log.trace \
|
74
64
|
event: 'read',
|
@@ -76,29 +66,58 @@ module Franz
|
|
76
66
|
size: size
|
77
67
|
@cursors[path] ||= 0
|
78
68
|
spread = size - @cursors[path]
|
69
|
+
|
79
70
|
if spread > @read_limit
|
80
|
-
log.
|
71
|
+
log.trace \
|
72
|
+
event: 'large read',
|
73
|
+
path: path,
|
74
|
+
size: size,
|
75
|
+
cursor: @cursors[path],
|
76
|
+
spread: spread
|
81
77
|
end
|
78
|
+
|
82
79
|
loop do
|
83
80
|
break if @cursors[path] >= size
|
84
81
|
|
85
82
|
begin
|
86
83
|
data = IO::read path, @block_size, @cursors[path]
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
84
|
+
rescue EOFError
|
85
|
+
log.warn event: 'read EOF', path: path
|
86
|
+
next
|
87
|
+
rescue Errno::ENOENT
|
88
|
+
log.warn event: 'read ENOENT', path: path
|
89
|
+
next
|
90
|
+
end
|
91
|
+
|
92
|
+
if data.nil?
|
93
|
+
log.fatal event: 'nil read', path: path
|
94
|
+
exit 2
|
95
|
+
raise 'nil read'
|
96
|
+
end
|
97
|
+
size = data.bytesize
|
98
|
+
|
99
|
+
begin
|
92
100
|
buffer[path].extract(data).each do |line|
|
93
101
|
tail_events.push path: path, line: line
|
94
102
|
end
|
95
|
-
@cursors[path] += size
|
96
103
|
rescue RuntimeError
|
97
104
|
log.fatal event: 'buffer full', path: path
|
98
|
-
|
99
|
-
|
100
|
-
# we're done here
|
105
|
+
exit 2
|
106
|
+
raise 'buffer full'
|
101
107
|
end
|
108
|
+
|
109
|
+
@cursors[path] += size
|
110
|
+
end
|
111
|
+
|
112
|
+
if @cursors[path] < size
|
113
|
+
log.fatal \
|
114
|
+
event: 'incomplete read',
|
115
|
+
path: path,
|
116
|
+
size: size,
|
117
|
+
cursor: @cursors[path],
|
118
|
+
spread: (size - @cursors[path])
|
119
|
+
exit 2
|
120
|
+
raise 'incomplete read'
|
102
121
|
end
|
103
122
|
end
|
104
123
|
|
@@ -112,10 +131,7 @@ module Franz
|
|
112
131
|
log.trace \
|
113
132
|
event: 'handle',
|
114
133
|
raw: event
|
115
|
-
checkin
|
116
134
|
case event[:name]
|
117
|
-
when :created
|
118
|
-
# nop
|
119
135
|
when :replaced
|
120
136
|
log.warn event: 'replaced', raw: event
|
121
137
|
close event[:path]
|
@@ -130,8 +146,9 @@ module Franz
|
|
130
146
|
log.warn event: 'deleted', raw: event
|
131
147
|
close event[:path]
|
132
148
|
else
|
133
|
-
log.
|
149
|
+
log.fatal event: 'invalid event', raw: event
|
134
150
|
exit 2
|
151
|
+
raise 'invalid event'
|
135
152
|
end
|
136
153
|
return event[:path]
|
137
154
|
end
|
data/lib/franz/watch.rb
CHANGED
@@ -105,21 +105,16 @@ module Franz
|
|
105
105
|
stat = stat_for path
|
106
106
|
stats[path] = stat
|
107
107
|
|
108
|
-
if
|
109
|
-
# enqueue :created, path
|
110
|
-
elsif file_deleted? old_stat, stat
|
111
|
-
log.warn event: 'deleted!', path: path
|
108
|
+
if file_deleted? old_stat, stat
|
112
109
|
enqueue :deleted, path
|
113
110
|
deleted << path
|
114
111
|
end
|
115
112
|
|
116
113
|
if file_replaced? old_stat, stat
|
117
|
-
log.warn event: 'replaced!', path: path
|
118
114
|
enqueue :replaced, path, stat[:size]
|
119
115
|
elsif file_appended? old_stat, stat
|
120
116
|
enqueue :appended, path, stat[:size]
|
121
117
|
elsif file_truncated? old_stat, stat
|
122
|
-
log.warn event: 'truncated!', path: path
|
123
118
|
enqueue :truncated, path, stat[:size]
|
124
119
|
end
|
125
120
|
end
|