Skip to content

Commit

Permalink
fix: don't calculate tunneltime for unauthenticated connections (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens authored Sep 11, 2024
1 parent e9b6b5e commit adf8a31
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/outline-ss-server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ func (cm *tcpConnMetrics) AddClosed(status string, data metrics.ProxyMetrics, du
cm.tcpServiceMetrics.proxyCollector.addClientTarget(data.ClientProxy, data.ProxyTarget, cm.accessKey, cm.clientInfo)
cm.tcpServiceMetrics.proxyCollector.addTargetClient(data.TargetProxy, data.ProxyClient, cm.accessKey, cm.clientInfo)
cm.tcpServiceMetrics.closeConnection(status, duration, cm.accessKey, cm.clientInfo)
ipKey, err := toIPKey(cm.clientAddr, cm.accessKey)
if err == nil {
cm.tunnelTimeMetrics.stopConnection(*ipKey)
// We only track authenticated TCP connections, so ignore unauthenticated closed connections
// when calculating tunneltime. See https://github.com/Jigsaw-Code/outline-server/issues/1590.
if cm.accessKey != "" {
ipKey, err := toIPKey(cm.clientAddr, cm.accessKey)
if err == nil {
cm.tunnelTimeMetrics.stopConnection(*ipKey)
}
}
}

Expand Down

0 comments on commit adf8a31

Please sign in to comment.