added output_tcp queue stats

This commit is contained in:
Joseph Lawson
2014-04-23 16:06:29 -04:00
parent 4720070996
commit 41fe11c12f
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -13,6 +13,7 @@ type TCPOutput struct {
address string
limit int
buf chan []byte
bufStats *GorStat
}
func NewTCPOutput(options string) io.Writer {
@@ -22,6 +23,7 @@ func NewTCPOutput(options string) io.Writer {
o.address = optionsArr[0]
o.buf = make(chan []byte, 100)
o.bufStats = NewGorStat("output_tcp")
if len(optionsArr) > 1 {
o.limit, _ = strconv.Atoi(optionsArr[1])
@@ -52,6 +54,7 @@ func (o *TCPOutput) Write(data []byte) (n int, err error) {
data = append(data,[]byte("¶")...)
copy(new_buf, data)
o.buf <- new_buf
o.bufStats.Write(len(o.buf))
return len(data), nil
}