mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
added output_tcp queue stats
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user