Skip to content

Commit

Permalink
extend connection health error metric and add extra
Browse files Browse the repository at this point in the history
  • Loading branch information
mcleinman committed Jan 2, 2025
1 parent aa804bc commit d535ef4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/platforms/ios/ConnectionHealth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ class ConnectionHealth {
}

logger.info(message: "Creating PingAnalyzer")
let _ = PingAnalyzer(pingAddress: pingAddress) { (connectivity) in
let _ = PingAnalyzer(pingAddress: pingAddress) { (connectivity, error) in
guard let connectivity = connectivity else {
self.logger.error(message: "PingAnalyzer returned error")
GleanMetrics.ConnectionHealth.pingAnalyzerError.record()
GleanMetrics.ConnectionHealth.pingAnalyzerError.record(PingAnalyzerErrorExtra(errorMessage: error.localizedDescription))
return
}

Expand Down
8 changes: 4 additions & 4 deletions src/platforms/ios/PingAnalyzer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class PingAnalyzer {
timer = Timer.scheduledTimer(timeInterval: TimeInterval(checkTime), target: self, selector: #selector(calculateStability), userInfo: nil, repeats: false)
} catch {
logger.error(message: "Error when sending pings: \(error)")
callback(nil)
callback(nil, error)
}
}

Expand All @@ -68,11 +68,11 @@ class PingAnalyzer {

// If any pings take too long to return or
if (packetLossPercent >= pingLossNoSignalThreshold) {
callback(.noSignal)
callback(.noSignal, nil)
} else if (packetLossPercent >= pingLossUnstableThreshold) {
callback(.unstable)
callback(.unstable, nil)
} else {
callback(.stable)
callback(.stable, nil)
}
}
}
9 changes: 7 additions & 2 deletions src/telemetry/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1050,10 +1050,15 @@ connection_health:
bugs:
- https://mozilla-hub.atlassian.net/browse/VPN-6406
data_reviews:
- TBA
- https://github.com/mozilla-mobile/mozilla-vpn-client/pull/9593#issuecomment-2159109154
data_sensitivity:
- technical
notification_emails:
- [email protected]
- [email protected]
expires: 2024-12-31
expires: 2025-06-30
extra_keys:
error_message:
description: |
Error type
type: string

0 comments on commit d535ef4

Please sign in to comment.