mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-25 16:51:00 +00:00
Merge pull request #510 from sumeshpremraj/spremraj/improve-network-debug-logging
Convert line payloads to string for debug logging
This commit is contained in:
commit
871e2d8df1
2 changed files with 4 additions and 4 deletions
|
@ -133,7 +133,7 @@ func (l *StatsDTCPListener) HandleConn(c *net.TCPConn) {
|
|||
}
|
||||
break
|
||||
}
|
||||
level.Debug(l.Logger).Log("msg", "Incoming line", "proto", "tcp", "line", line)
|
||||
level.Debug(l.Logger).Log("msg", "Incoming line", "proto", "tcp", "line", string(line))
|
||||
if isPrefix {
|
||||
l.TCPLineTooLong.Inc()
|
||||
level.Debug(l.Logger).Log("msg", "Read failed: line too long", "addr", c.RemoteAddr())
|
||||
|
|
|
@ -127,7 +127,7 @@ func (r *Relay) relayOutput() {
|
|||
buffer.Reset()
|
||||
buffer.Write(b)
|
||||
} else {
|
||||
level.Debug(r.logger).Log("msg", "Adding line to buffer", "line", b)
|
||||
level.Debug(r.logger).Log("msg", "Adding line to buffer", "line", string(b))
|
||||
buffer.Write(b)
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ func (r *Relay) sendPacket(buf []byte) error {
|
|||
level.Debug(r.logger).Log("msg", "Empty buffer, nothing to send")
|
||||
return nil
|
||||
}
|
||||
level.Debug(r.logger).Log("msg", "Sending packet", "length", len(buf), "data", buf)
|
||||
level.Debug(r.logger).Log("msg", "Sending packet", "length", len(buf), "data", string(buf))
|
||||
_, err := r.conn.WriteToUDP(buf, r.addr)
|
||||
r.packetsTotal.Inc()
|
||||
return err
|
||||
|
@ -158,7 +158,7 @@ func (r *Relay) RelayLine(l string) {
|
|||
r.longLinesTotal.Inc()
|
||||
return
|
||||
}
|
||||
level.Debug(r.logger).Log("msg", "Relaying line", "line", l)
|
||||
level.Debug(r.logger).Log("msg", "Relaying line", "line", string(l))
|
||||
if !strings.HasSuffix(l, "\n") {
|
||||
l = l + "\n"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue