TUN-1270: cloudflared panic (HA metrics missing label)

This commit is contained in:
Adam Chalmers 2018-12-11 11:41:49 -06:00
parent 8e2908f889
commit b2d0c612a5
1 changed files with 3 additions and 2 deletions

View File

@ -35,11 +35,12 @@ func NewTunnelsForHA() tunnelsForHA {
func (t *tunnelsForHA) AddTunnelID(haConn uint8, tunnelID string) {
t.Lock()
defer t.Unlock()
haStr := fmt.Sprintf("%v", haConn)
if oldTunnelID, ok := t.entries[haConn]; ok {
t.metrics.WithLabelValues(oldTunnelID).Dec()
t.metrics.WithLabelValues(oldTunnelID, haStr).Dec()
}
t.entries[haConn] = tunnelID
t.metrics.WithLabelValues(tunnelID, fmt.Sprintf("%v", haConn)).Inc()
t.metrics.WithLabelValues(tunnelID, haStr).Inc()
}
func (t *tunnelsForHA) String() string {