From 3ddf0e1dfefea088d843b0f201359f9683c56c07 Mon Sep 17 00:00:00 2001 From: Beatriz Rizental Date: Fri, 7 Oct 2022 18:38:34 +0200 Subject: [PATCH] VPN-2988 - Record events on controller error steps (#4594) --- glean/metrics.yaml | 20 +++++++++++++++++--- src/controller.cpp | 1 + src/telemetry.cpp | 7 +++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/glean/metrics.yaml b/glean/metrics.yaml index eed7f43c62..4ca46f1083 100644 --- a/glean/metrics.yaml +++ b/glean/metrics.yaml @@ -18,7 +18,6 @@ $schema: moz://mozilla.org/schemas/glean/metrics/2-0-0 sample: - addon_state_changed: type: event lifetime: ping @@ -71,7 +70,6 @@ sample: Received, Notified, Read, or Dismissed type: string - addon_cta_clicked: type: event lifetime: ping @@ -566,7 +564,6 @@ sample: - amarchesini@mozilla.com expires: never - connection_health_no_signal: type: event lifetime: ping @@ -1047,6 +1044,23 @@ sample: description: The Host network type (i.e wifi or 4g) type: string + server_unavailable_error: + type: event + lifetime: ping + send_in_pings: + - main + description: | + A "Server unavailable" error has occured. + bugs: + - https://github.com/mozilla-mobile/mozilla-vpn-client/issues/4589 + data_reviews: + - https://github.com/mozilla-mobile/mozilla-vpn-client/pull/4594#issuecomment-1271601927 + data_sensitivity: + - technical + notification_emails: + - brizental@mozilla.com + expires: never + app_step: type: event lifetime: ping diff --git a/src/controller.cpp b/src/controller.cpp index abe7fb9caf..d2da2492e8 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -608,6 +608,7 @@ bool Controller::processNextStep() { if (nextStep == ServerUnavailable) { logger.info() << "Server Unavailable - Ping succeeded: " << m_ping_received; + emit readyToServerUnavailable(m_ping_received); return true; } diff --git a/src/telemetry.cpp b/src/telemetry.cpp index 181193387f..ec5ef29e02 100644 --- a/src/telemetry.cpp +++ b/src/telemetry.cpp @@ -75,6 +75,13 @@ void Telemetry::initialize() { emit vpn->recordGleanEvent(GleanSample::controllerStateOff); } }); + + connect(controller, &Controller::readyToServerUnavailable, this, []() { + MozillaVPN* vpn = MozillaVPN::instance(); + Q_ASSERT(vpn); + + emit vpn->recordGleanEvent(GleanSample::serverUnavailableError); + }); } void Telemetry::connectionStabilityEvent() {