Skip to content

Instantly share code, notes, and snippets.

@sonots
Last active December 29, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonots/7646378 to your computer and use it in GitHub Desktop.
Save sonots/7646378 to your computer and use it in GitHub Desktop.
--- /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.39/lib/fluent/plugin/out_forward.rb.orig 2013-11-26 03:03:36.701048600 +0900
+++ /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.39/lib/fluent/plugin/out_forward.rb 2013-11-27 02:54:48.584935460 +0900
@@ -109,6 +109,16 @@
@loop.attach(@timer)
@thread = Thread.new(&method(:run))
+ @watcher = Thread.new(&method(:watch))
+ end
+
+ def watch
+ @watch_msgsize = 0
+ while true do
+ $log.info "plugin:out_forward\tsize:#{@watch_msgsize}\ttiming:second" if @watch_msgsize > 0
+ @watch_msgsize = 0
+ sleep 1
+ end
end
def shutdown
@@ -218,6 +228,7 @@
end
def send_data(node, tag, chunk)
+ $log.info "plugin:out_forward\tsize:#{chunk.size}\ttiming:try"
sock = connect(node)
begin
opt = [1, @send_timeout.to_i].pack('I!I!') # { int l_onoff; int l_linger; }
@@ -249,6 +260,9 @@
chunk.write_to(sock)
node.heartbeat(false)
+
+ $log.info "plugin:out_forward\tsize:#{sz}\ttiming:sent"
+ @watch_msgsize += sz
ensure
sock.close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment