Skip to content

Commit 8d8188d

Browse files
authored
Merge pull request #23 from knqyf263/fix-load_from_file
Fix error with store_file option
2 parents 27f3169 + a5926af commit 8d8188d

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
before_install:
2+
- gem update bundler
13
rvm:
24
- 1.9.3
35
- 2.0.0

lib/fluent/plugin/change_finder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def next(x)
6969

7070
p = prob(xt, @sigma, x)
7171
s = score(p)
72-
log.debug "change_finder:#{Thread.current.object_id} x:#{x} xt:#{xt} p:#{p} s:#{s} term:#{@term} r:#{@r} data:#{@data} mu:#{@mu} sigma:#{@sigma} c:#{@c}"
72+
@log.debug "change_finder:#{Thread.current.object_id} x:#{x} xt:#{xt} p:#{p} s:#{s} term:#{@term} r:#{@r} data:#{@data} mu:#{@mu} sigma:#{@sigma} c:#{@c}"
7373
s
7474
end
7575

lib/fluent/plugin/out_anomalydetect.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,18 @@ def load_from_file
324324
@outliers = stored[:outliers]
325325
@outlier_bufs = stored[:outlier_bufs]
326326
@scores = stored[:scores]
327-
@outliers.each {|outlier| outlier.log = log } # @log is not dumped, so have to set at here
327+
328+
# @log is not dumped, so have to set to @outliers and @scores at here
329+
log_proc = Proc.new do |stored_value|
330+
if @targets
331+
@targets.each {|target| stored_value[target].log = log }
332+
elsif @target
333+
stored_value[@target].log = log
334+
end
335+
end
336+
@outliers.each_value {|outlier| log_proc.call(outlier) }
337+
@scores.each_value {|score| log_proc.call(score) }
338+
328339
else
329340
log.warn "anomalydetect: configuration param was changed. ignore stored data"
330341
end

0 commit comments

Comments
 (0)