Permalink
Browse files

add flush method for flushing all pending metrics out

  • Loading branch information...
1 parent 024e20e commit 291729460052eec27315cdc1361a772b6c581902 Chris committed Feb 7, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/instrumental/agent.rb
View
@@ -158,6 +158,20 @@ def notice(note, time = Time.now, duration = 0)
nil
end
+ # Synchronously flush all pending metrics out to the server
+ # By default will not try to reconnect to the server if a
+ # connection failure happens during the flush, though you
+ # may optionally override this behavior by passing false
+ # as an argument.
+ #
+ # agent.flush
+ def flush(allow_reconnect = false)
+ queue_message('flush', {
+ :synchronous => true,
+ :allow_reconnect => allow_reconnect
+ })
+ end
+
def enabled?
@enabled
end

0 comments on commit 2917294

Please sign in to comment.