fix udp metrics increment

Signed-off-by: kullanici0606 <yakup.turgut@btk.gov.tr>
This commit is contained in:
kullanici0606 2023-09-18 14:40:29 +03:00
parent ccb3eb6277
commit b0c6d983e1

View file

@ -71,6 +71,7 @@ func (l *StatsDUDPListener) Listen() {
}
func (l *StatsDUDPListener) EnqueueUdpPacket(packet []byte) {
l.UDPPackets.Inc()
packetCopy := make([]byte, len(packet))
copy(packetCopy, packet)
l.UdpPacketQueue <- packetCopy
@ -84,7 +85,6 @@ func (l *StatsDUDPListener) ProcessUdpPacketQueue() {
}
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)