forked from mirrors/statsd_exporter
Merge pull request #305 from chai-nadig/chai/log-ingested-metrics
Log Ingested Lines
This commit is contained in:
commit
3908609918
2 changed files with 4 additions and 1 deletions
2
main.go
2
main.go
|
@ -257,7 +257,7 @@ func main() {
|
|||
statsdListenUDP = kingpin.Flag("statsd.listen-udp", "The UDP address on which to receive statsd metric lines. \"\" disables it.").Default(":9125").String()
|
||||
statsdListenTCP = kingpin.Flag("statsd.listen-tcp", "The TCP address on which to receive statsd metric lines. \"\" disables it.").Default(":9125").String()
|
||||
statsdListenUnixgram = kingpin.Flag("statsd.listen-unixgram", "The Unixgram socket path to receive statsd metric lines in datagram. \"\" disables it.").Default("").String()
|
||||
// not using Int here because flag diplays default in decimal, 0755 will show as 493
|
||||
// not using Int here because flag displays default in decimal, 0755 will show as 493
|
||||
statsdUnixSocketMode = kingpin.Flag("statsd.unixsocket-mode", "The permission mode of the unix socket.").Default("755").String()
|
||||
mappingConfig = kingpin.Flag("statsd.mapping-config", "Metric mapping configuration file name.").String()
|
||||
readBuffer = kingpin.Flag("statsd.read-buffer", "Size (in bytes) of the operating system's transmit read buffer associated with the UDP or Unixgram connection. Please make sure the kernel parameters net.core.rmem_max is set to a value greater than the value specified.").Int()
|
||||
|
|
|
@ -65,6 +65,7 @@ func (l *StatsDUDPListener) HandlePacket(packet []byte) {
|
|||
l.UDPPackets.Inc()
|
||||
lines := strings.Split(string(packet), "\n")
|
||||
for _, line := range lines {
|
||||
level.Debug(l.Logger).Log("msg", "Incoming line", "proto", "udp", "line", line)
|
||||
l.LinesReceived.Inc()
|
||||
l.EventHandler.Queue(pkgLine.LineToEvents(line, l.SampleErrors, l.SamplesReceived, l.TagErrors, l.TagsReceived, l.Logger))
|
||||
}
|
||||
|
@ -120,6 +121,7 @@ func (l *StatsDTCPListener) HandleConn(c *net.TCPConn) {
|
|||
}
|
||||
break
|
||||
}
|
||||
level.Debug(l.Logger).Log("msg", "Incoming line", "proto", "tcp", "line", line)
|
||||
if isPrefix {
|
||||
l.TCPLineTooLong.Inc()
|
||||
level.Debug(l.Logger).Log("msg", "Read failed: line too long", "addr", c.RemoteAddr())
|
||||
|
@ -168,6 +170,7 @@ func (l *StatsDUnixgramListener) HandlePacket(packet []byte) {
|
|||
l.UnixgramPackets.Inc()
|
||||
lines := strings.Split(string(packet), "\n")
|
||||
for _, line := range lines {
|
||||
level.Debug(l.Logger).Log("msg", "Incoming line", "proto", "unixgram", "line", line)
|
||||
l.LinesReceived.Inc()
|
||||
l.EventHandler.Queue(pkgLine.LineToEvents(line, l.SampleErrors, l.SamplesReceived, l.TagErrors, l.TagsReceived, l.Logger))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue