class Fluent::Plugin::NotifierOutput::State
Attributes
counter[RW]
level: :warn, :crit stage: 0(1st)/1(2nd)/2(3rd)
first_notified[RW]
level: :warn, :crit stage: 0(1st)/1(2nd)/2(3rd)
last_notified[RW]
level: :warn, :crit stage: 0(1st)/1(2nd)/2(3rd)
level[RW]
level: :warn, :crit stage: 0(1st)/1(2nd)/2(3rd)
pattern[RW]
level: :warn, :crit stage: 0(1st)/1(2nd)/2(3rd)
stage[RW]
level: :warn, :crit stage: 0(1st)/1(2nd)/2(3rd)
target_key[RW]
level: :warn, :crit stage: 0(1st)/1(2nd)/2(3rd)
target_tag[RW]
level: :warn, :crit stage: 0(1st)/1(2nd)/2(3rd)
Public Class Methods
new(notification)
click to toggle source
# File lib/fluent/plugin/out_notifier.rb, line 477 def initialize(notification) @pattern = notification[:pattern] @target_tag = notification[:target_tag] @target_key = notification[:target_key] @level = notification['level'] @stage = 0 @counter = 1 t = Fluent::Engine.now @first_notified = t @last_notified = t end
Public Instance Methods
suppress?(definition, notification)
click to toggle source
# File lib/fluent/plugin/out_notifier.rb, line 489 def suppress?(definition, notification) if @level == notification['level'] (Fluent::Engine.now - @last_notified) <= definition.intervals[@stage] else true end end
update_notified(definition, notification)
click to toggle source
# File lib/fluent/plugin/out_notifier.rb, line 497 def update_notified(definition, notification) t = Fluent::Engine.now if @level == notification['level'] rep = definition.repetitions[@stage] if rep and rep > 0 @counter += 1 if @counter > rep @stage += 1 @counter = 0 end end else @level = notification['level'] @stage = 0 @counter = 1 @first_notified = t end @last_notified = t end