Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend metric, add extra #10133

Merged
merged 4 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(GleanMetrics.ConnectionHealth.PingAnalyzerErrorExtra(errorMessage: error?.localizedDescription ?? "no error"))
return
}

Expand Down
12 changes: 6 additions & 6 deletions src/platforms/ios/PingAnalyzer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class PingAnalyzer {
private let pingLossUnstableThreshold: Double = 0.65 // 13 of 20 pings
private let pingLossNoSignalThreshold: Double = 1.0 // all pings

private let callback: (ConnectionHealth.ConnectionStability?) -> Void
private let callback: (ConnectionHealth.ConnectionStability?, Error?) -> Void

init(pingAddress: String, callback: @escaping (ConnectionHealth.ConnectionStability?) -> Void) {
init(pingAddress: String, callback: @escaping (ConnectionHealth.ConnectionStability?, Error?) -> Void) {
self.callback = callback

do {
Expand All @@ -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
Loading