Skip to content

Commit

Permalink
Record events on controller error steps
Browse files Browse the repository at this point in the history
  • Loading branch information
brizental committed Oct 7, 2022
1 parent df7517b commit c95bfe1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
37 changes: 34 additions & 3 deletions glean/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0

sample:

addon_state_changed:
type: event
lifetime: ping
Expand Down Expand Up @@ -71,7 +70,6 @@ sample:
Received, Notified, Read, or Dismissed
type: string


addon_cta_clicked:
type: event
lifetime: ping
Expand Down Expand Up @@ -566,7 +564,6 @@ sample:
- amarchesini@mozilla.com
expires: never


connection_health_no_signal:
type: event
lifetime: ping
Expand Down Expand Up @@ -1047,6 +1044,40 @@ 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:
- TODO
data_sensitivity:
- technical
notification_emails:
- brizental@mozilla.com
expires: never

backend_failure_error:
type: event
lifetime: ping
send_in_pings:
- main
description: |
A "Backend failure" error has occured.
bugs:
- https://github.com/mozilla-mobile/mozilla-vpn-client/issues/4589
data_reviews:
- TODO
data_sensitivity:
- technical
notification_emails:
- brizental@mozilla.com
expires: never

app_step:
type: event
lifetime: ping
Expand Down
7 changes: 7 additions & 0 deletions src/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ bool Controller::processNextStep() {
NextStep nextStep = m_nextStep;
m_nextStep = None;

MozillaVPN* vpn = MozillaVPN::instance();
Q_ASSERT(vpn);

if (nextStep == Quit) {
emit readyToQuit();
return true;
Expand All @@ -602,12 +605,16 @@ bool Controller::processNextStep() {
}

if (nextStep == BackendFailure) {
emit vpn->recordGleanEvent(GleanSample::backendFailureError);

emit readyToBackendFailure();
return true;
}

if (nextStep == ServerUnavailable) {
logger.info() << "Server Unavailable - Ping succeeded: " << m_ping_received;
emit vpn->recordGleanEvent(GleanSample::serverUnavailableError);

emit readyToServerUnavailable(m_ping_received);
return true;
}
Expand Down

0 comments on commit c95bfe1

Please sign in to comment.