lib/logjam_agent/request.rb in logjam_agent-0.9.3 vs lib/logjam_agent/request.rb in logjam_agent-0.9.4
- old
+ new
@@ -14,12 +14,21 @@
@forwarder = Forwarders.get(app, env)
@lines = []
@uuid = LogjamAgent.generate_uuid
@fields = initial_fields.merge(:request_id => @uuid, :host => LogjamAgent.hostname, :process_id => Process.pid, :lines => @lines)
@mutex = Mutex.new
+ @ignored = false
end
+ def ignore!
+ @ignored = true
+ end
+
+ def ignored?
+ @ignored
+ end
+
def id
"#{@app}-#{@env}-#{@uuid}"
end
def action
@@ -45,9 +54,10 @@
((@fields[:exceptions] ||= []) << exception).uniq!
end
end
def forward
+ return if @ignored
engine = @fields.delete(:engine)
# puts @fields.inspect
@forwarder.forward(LogjamAgent.encode_payload(@fields), :engine => engine)
rescue Exception => e
handle_forwarding_error(e)