Skip to content

Commit 0fa29af

Browse files
authored
Merge pull request #53 from coder/spike/fix-drop-reason-stats
fix: fix dropReason metrics labels
2 parents e0fddea + 7a387dd commit 0fa29af

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

derp/derp_server.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,16 @@ func NewServer(privateKey key.NodePrivate, logf logger.Logf) *Server {
326326
s.initMetacert()
327327
s.packetsRecvDisco = s.packetsRecvByKind.Get("disco")
328328
s.packetsRecvOther = s.packetsRecvByKind.Get("other")
329-
s.packetsDroppedReasonCounters = []*expvar.Int{
330-
s.packetsDroppedReason.Get("unknown_dest"),
331-
s.packetsDroppedReason.Get("unknown_dest_on_fwd"),
332-
s.packetsDroppedReason.Get("gone_disconnected"),
333-
s.packetsDroppedReason.Get("gone_not_here"),
334-
s.packetsDroppedReason.Get("queue_head"),
335-
s.packetsDroppedReason.Get("queue_tail"),
336-
s.packetsDroppedReason.Get("write_error"),
337-
}
329+
330+
s.packetsDroppedReasonCounters = make([]*expvar.Int, 7)
331+
s.packetsDroppedReasonCounters[dropReasonUnknownDest] = s.packetsDroppedReason.Get("unknown_dest")
332+
s.packetsDroppedReasonCounters[dropReasonUnknownDestOnFwd] = s.packetsDroppedReason.Get("unknown_dest_on_fwd")
333+
s.packetsDroppedReasonCounters[dropReasonGoneDisconnected] = s.packetsDroppedReason.Get("gone_disconnected")
334+
s.packetsDroppedReasonCounters[dropReasonQueueHead] = s.packetsDroppedReason.Get("queue_head")
335+
s.packetsDroppedReasonCounters[dropReasonQueueTail] = s.packetsDroppedReason.Get("queue_tail")
336+
s.packetsDroppedReasonCounters[dropReasonWriteError] = s.packetsDroppedReason.Get("write_error")
337+
s.packetsDroppedReasonCounters[dropReasonDupClient] = s.packetsDroppedReason.Get("dup_client")
338+
338339
s.packetsDroppedTypeDisco = s.packetsDroppedType.Get("disco")
339340
s.packetsDroppedTypeOther = s.packetsDroppedType.Get("other")
340341
return s

0 commit comments

Comments
 (0)