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

VPN-6324: Telemetry for web based authentication #10171

Merged
merged 3 commits into from
Jan 8, 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
23 changes: 23 additions & 0 deletions src/tasks/authenticate/taskauthenticate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "authenticationlistener.h"
#include "constants.h"
#include "errorhandler.h"
#include "glean/generated/metrics.h"
#include "leakdetector.h"
#include "logger.h"
#include "networkrequest.h"
Expand Down Expand Up @@ -52,6 +53,14 @@ void TaskAuthenticate::run() {
logger.debug() << "Authentication completed with code:"
<< logger.sensitive(pkceCodeSuccess);

if (m_authenticationType ==
AuthenticationListener::AuthenticationInBrowser) {
mozilla::glean::web_authentication::successful.record(
mozilla::glean::web_authentication::SuccessfulExtra{
._uuid = m_metricUuid.toString(QUuid::WithoutBraces),
});
}

NetworkRequest* request = new NetworkRequest(this, 200);
request->post(
AuthenticationListener::createLoginVerifyUrl(),
Expand All @@ -76,6 +85,13 @@ void TaskAuthenticate::run() {

connect(m_authenticationListener, &AuthenticationListener::failed, this,
[this](ErrorHandler::ErrorType error) {
if (m_authenticationType ==
AuthenticationListener::AuthenticationInBrowser) {
mozilla::glean::web_authentication::failed.record(
mozilla::glean::web_authentication::FailedExtra{
._uuid = m_metricUuid.toString(QUuid::WithoutBraces),
});
}
REPORTERROR(error, name());
m_authenticationListener->aboutToFinish();
});
Expand All @@ -86,6 +102,13 @@ void TaskAuthenticate::run() {
m_authenticationListener->aboutToFinish();
});

m_metricUuid = QUuid::createUuid();
if (m_authenticationType == AuthenticationListener::AuthenticationInBrowser) {
mozilla::glean::web_authentication::started.record(
mozilla::glean::web_authentication::StartedExtra{
._uuid = m_metricUuid.toString(QUuid::WithoutBraces),
});
}
m_authenticationListener->start(this, pkceCodeChallenge,
CODE_CHALLENGE_METHOD,
SettingsHolder::instance()->userEmail());
Expand Down
3 changes: 3 additions & 0 deletions src/tasks/authenticate/taskauthenticate.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef TASKAUTHENTICATE_H
#define TASKAUTHENTICATE_H

#include <QUuid>

#include "authenticationlistener.h"
#include "task.h"

Expand Down Expand Up @@ -32,6 +34,7 @@ class TaskAuthenticate final : public Task {
AuthenticationListener* m_authenticationListener = nullptr;
AuthenticationListener::AuthenticationType m_authenticationType =
AuthenticationListener::AuthenticationInBrowser;
QUuid m_metricUuid = QUuid::createUuid();
};

#endif // TASKAUTHENTICATE_H
75 changes: 71 additions & 4 deletions src/telemetry/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ session:
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:
Expand Down Expand Up @@ -839,7 +839,7 @@ 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:
Expand Down Expand Up @@ -945,7 +945,7 @@ 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:
Expand Down Expand Up @@ -1032,7 +1032,7 @@ 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:
Expand Down Expand Up @@ -1062,3 +1062,70 @@ connection_health:
description: |
Error type
type: string

web_authentication:
started:
type: event
lifetime: ping
send_in_pings:
- main
description: |
Web authentication was started.
bugs:
- https://mozilla-hub.atlassian.net/browse/VPN-6323
data_reviews:
- https://github.com/mozilla-mobile/mozilla-vpn-client/pull/10171#pullrequestreview-2537047062
data_sensitivity:
- interaction
notification_emails:
- [email protected]
- [email protected]
expires: 2026-06-30
extra_keys:
uuid:
description: UUID to match starting events to ending ones
type: string

successful:
type: event
lifetime: ping
send_in_pings:
- main
description: |
Web authentication was successfully completed.
bugs:
- https://mozilla-hub.atlassian.net/browse/VPN-6323
data_reviews:
- https://github.com/mozilla-mobile/mozilla-vpn-client/pull/10171#pullrequestreview-2537047062
data_sensitivity:
- interaction
notification_emails:
- [email protected]
- [email protected]
expires: 2026-06-30
extra_keys:
uuid:
description: UUID to match ending event to starting one
type: string

failed:
type: event
lifetime: ping
send_in_pings:
- main
description: |
Web authentication was unsuccessfully completed.
bugs:
- https://mozilla-hub.atlassian.net/browse/VPN-6323
data_reviews:
- https://github.com/mozilla-mobile/mozilla-vpn-client/pull/10171#pullrequestreview-2537047062
data_sensitivity:
- interaction
notification_emails:
- [email protected]
- [email protected]
expires: 2026-06-30
extra_keys:
uuid:
description: UUID to match ending event to starting one
type: string
Loading