Skip to content

Commit

Permalink
Initialize TunnelTime for new IPKeys with default value of 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Mar 22, 2024
1 parent a5731fc commit 4112238
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/outline-ss-server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ func (t *tunnelTimeTracker) startConnection(ipKey IPKey) {
c, exists := t.activeClients[ipKey]
if !exists {
clientInfo, _ := ipinfo.GetIPInfoFromIP(t.IPInfoMap, net.IP(ipKey.ip.AsSlice()))
// Initialize the TunnelTime for this IPKey with default value of 0:
// https://prometheus.io/docs/practices/instrumentation/#avoid-missing-metrics
t.reportTunnelTime(ipKey, clientInfo, 0)
c = &activeClient{
clientInfo: clientInfo,
startTime: now(),
Expand Down

0 comments on commit 4112238

Please sign in to comment.