Bug 1923028 - Migrate scalars to use Glean APIs for startup.*, r=chutten,mossop.
Differential Revision: https://phabricator.services.mozilla.com/D225862
This commit is contained in:
@@ -1903,11 +1903,8 @@ BrowserGlue.prototype = {
|
||||
Services.startup.secondsSinceLastOSRestart;
|
||||
let isColdStartup =
|
||||
nowSeconds - secondsSinceLastOSRestart > lastCheckSeconds;
|
||||
Services.telemetry.scalarSet("startup.is_cold", isColdStartup);
|
||||
Services.telemetry.scalarSet(
|
||||
"startup.seconds_since_last_os_restart",
|
||||
secondsSinceLastOSRestart
|
||||
);
|
||||
Glean.startup.isCold.set(isColdStartup);
|
||||
Glean.startup.secondsSinceLastOsRestart.set(secondsSinceLastOSRestart);
|
||||
} catch (ex) {
|
||||
console.error(ex);
|
||||
}
|
||||
|
||||
@@ -493,3 +493,39 @@ datasanitization:
|
||||
expires: never
|
||||
unit: unknown
|
||||
telemetry_mirror: DATASANITIZATION_SESSION_PERMISSION_EXCEPTIONS
|
||||
|
||||
startup:
|
||||
is_cold:
|
||||
type: boolean
|
||||
description: >
|
||||
Whether or not this startup is the first startup since OS reboot
|
||||
(according to our best guess.)
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
scalar startup.is_cold.
|
||||
bugs:
|
||||
- https://bugzil.la/1542833
|
||||
data_reviews:
|
||||
- https://bugzil.la/1542833
|
||||
notification_emails:
|
||||
- dothayer@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: STARTUP_IS_COLD
|
||||
|
||||
seconds_since_last_os_restart:
|
||||
type: quantity
|
||||
description: >
|
||||
The time in seconds between the first browser window loading, and
|
||||
the time the OS started. This can give us an indication of whether
|
||||
starting the browser may have been the first thing the user did
|
||||
after starting their computer.
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
scalar startup.seconds_since_last_os_restart.
|
||||
bugs:
|
||||
- https://bugzil.la/1654063
|
||||
data_reviews:
|
||||
- https://bugzil.la/1654063
|
||||
notification_emails:
|
||||
- dothayer@mozilla.com
|
||||
expires: never
|
||||
unit: seconds
|
||||
telemetry_mirror: STARTUP_SECONDS_SINCE_LAST_OS_RESTART
|
||||
|
||||
@@ -71,6 +71,7 @@ gecko_metrics = [
|
||||
"toolkit/mozapps/extensions/metrics.yaml",
|
||||
"toolkit/mozapps/extensions/metrics_legacy.yaml",
|
||||
"toolkit/mozapps/handling/metrics.yaml",
|
||||
"toolkit/profile/metrics.yaml",
|
||||
"toolkit/xre/metrics.yaml",
|
||||
"widget/gtk/metrics.yaml",
|
||||
"widget/metrics.yaml",
|
||||
|
||||
113
toolkit/profile/metrics.yaml
Normal file
113
toolkit/profile/metrics.yaml
Normal file
@@ -0,0 +1,113 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Adding a new metric? We have docs for that!
|
||||
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html
|
||||
|
||||
---
|
||||
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
|
||||
$tags:
|
||||
- 'Toolkit :: Startup and Profile System'
|
||||
|
||||
startup:
|
||||
profile_selection_reason:
|
||||
type: string
|
||||
description: >
|
||||
How the profile was selected during startup. One of the following reasons:
|
||||
unknown:
|
||||
Generally should not happen, set as a default in case no other reason
|
||||
occured.
|
||||
profile-manager:
|
||||
The profile was selected by the profile manager.
|
||||
profile-selector:
|
||||
The profile was selected by the profile selector window.
|
||||
profile-reset:
|
||||
The profile was selected for reset, normally this would mean a restart.
|
||||
restart:
|
||||
The user restarted the application, the same profile as previous will
|
||||
be used.
|
||||
argument-profile:
|
||||
The profile was selected by the --profile command line argument.
|
||||
argument-p:
|
||||
The profile was selected by the -p command line argument.
|
||||
firstrun-claimed-default:
|
||||
A first run of a dedicated profiles build chose the old default
|
||||
profile to be the default for this install.
|
||||
firstrun-skipped-default:
|
||||
A first run of a dedicated profiles build skipped over the old default
|
||||
profile and created a new profile.
|
||||
restart-claimed-default:
|
||||
A first run of a dedicated profiles build after a restart chose the
|
||||
old default profile to be the default for this install.
|
||||
restart-skipped-default:
|
||||
A first run of a dedicated profiles build after a restart skipped over
|
||||
the old default profile and created a new profile.
|
||||
firstrun-created-default:
|
||||
A first run of the application created a new profile to use.
|
||||
default:
|
||||
The default profile was selected as normal.
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
scalar startup.profile_selection_reason.
|
||||
bugs:
|
||||
- https://bugzil.la/1522934
|
||||
- https://bugzil.la/1570652
|
||||
- https://bugzil.la/1623406
|
||||
- https://bugzil.la/1749887
|
||||
- https://bugzil.la/1893667
|
||||
data_reviews:
|
||||
- https://bugzil.la/1522934
|
||||
- https://bugzil.la/1570652
|
||||
- https://bugzil.la/1623406
|
||||
- https://bugzil.la/1749887
|
||||
- https://bugzil.la/1893667
|
||||
notification_emails:
|
||||
- dtownsend@mozilla.com
|
||||
- rtestard@mozilla.com
|
||||
- gkaberere@mozilla.com
|
||||
- jhollek@mozilla.com
|
||||
- echo@mozilla.com
|
||||
- shong@mozilla.com
|
||||
- jhirsch@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: STARTUP_PROFILE_SELECTION_REASON
|
||||
|
||||
profile_database_version:
|
||||
type: string
|
||||
description: >
|
||||
The version of the profiles.ini database loaded during startup. A
|
||||
value of "0" is used to indicate that no file was present during
|
||||
startup.
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
scalar startup.profile_database_version.
|
||||
bugs:
|
||||
- https://bugzil.la/1878339
|
||||
- https://bugzil.la/1916867
|
||||
data_reviews:
|
||||
- https://bugzil.la/1878339
|
||||
- https://bugzil.la/1916867
|
||||
notification_emails:
|
||||
- dtownsend@mozilla.com
|
||||
- kbryant@mozilla.com
|
||||
expires: 140
|
||||
telemetry_mirror: STARTUP_PROFILE_DATABASE_VERSION
|
||||
|
||||
profile_count:
|
||||
type: quantity
|
||||
description: >
|
||||
This records the number of known profiles after startup completes.
|
||||
This includes any profiles that were created during startup.
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
scalar startup.profile_count.
|
||||
bugs:
|
||||
- https://bugzil.la/1878339
|
||||
- https://bugzil.la/1916867
|
||||
data_reviews:
|
||||
- https://bugzil.la/1878339
|
||||
- https://bugzil.la/1916867
|
||||
notification_emails:
|
||||
- dtownsend@mozilla.com
|
||||
- kbryant@mozilla.com
|
||||
expires: 140
|
||||
unit: profiles
|
||||
telemetry_mirror: STARTUP_PROFILE_COUNT
|
||||
@@ -58,7 +58,7 @@
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsIToolkitShellService.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/glean/GleanMetrics.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#ifdef MOZ_HAS_REMOTE
|
||||
# include "nsRemoteService.h"
|
||||
@@ -644,7 +644,7 @@ nsToolkitProfileService::nsToolkitProfileService()
|
||||
#else
|
||||
mUseDedicatedProfile(false),
|
||||
#endif
|
||||
mStartupReason(u"unknown"_ns),
|
||||
mStartupReason("unknown"_ns),
|
||||
mStartupFileVersion("0"_ns),
|
||||
mMaybeLockProfile(false),
|
||||
mUpdateChannel(MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL)),
|
||||
@@ -666,12 +666,9 @@ void nsToolkitProfileService::CompleteStartup() {
|
||||
return;
|
||||
}
|
||||
|
||||
ScalarSet(mozilla::Telemetry::ScalarID::STARTUP_PROFILE_SELECTION_REASON,
|
||||
mStartupReason);
|
||||
ScalarSet(mozilla::Telemetry::ScalarID::STARTUP_PROFILE_DATABASE_VERSION,
|
||||
NS_ConvertUTF8toUTF16(mStartupFileVersion));
|
||||
ScalarSet(mozilla::Telemetry::ScalarID::STARTUP_PROFILE_COUNT,
|
||||
static_cast<uint32_t>(mProfiles.length()));
|
||||
glean::startup::profile_selection_reason.Set(mStartupReason);
|
||||
glean::startup::profile_database_version.Set(mStartupFileVersion);
|
||||
glean::startup::profile_count.Set(static_cast<uint32_t>(mProfiles.length()));
|
||||
|
||||
// If we started into an unmanaged profile in a profile group, set the group
|
||||
// profile to be the managed profile belonging to the group.
|
||||
@@ -1525,7 +1522,7 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
rv = MaybeMakeDefaultDedicatedProfile(profile, &result);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (result) {
|
||||
mStartupReason = u"restart-claimed-default"_ns;
|
||||
mStartupReason = "restart-claimed-default"_ns;
|
||||
|
||||
mCurrent = profile;
|
||||
} else {
|
||||
@@ -1538,7 +1535,7 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
rv = Flush();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mStartupReason = u"restart-skipped-default"_ns;
|
||||
mStartupReason = "restart-skipped-default"_ns;
|
||||
*aDidCreate = true;
|
||||
}
|
||||
|
||||
@@ -1551,13 +1548,13 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
}
|
||||
|
||||
if (EnvHasValue("XRE_RESTARTED_BY_PROFILE_MANAGER")) {
|
||||
mStartupReason = u"profile-manager"_ns;
|
||||
mStartupReason = "profile-manager"_ns;
|
||||
} else if (EnvHasValue("XRE_RESTARTED_BY_PROFILE_SELECTOR")) {
|
||||
mStartupReason = u"profile-selector"_ns;
|
||||
mStartupReason = "profile-selector"_ns;
|
||||
} else if (aIsResetting) {
|
||||
mStartupReason = u"profile-reset"_ns;
|
||||
mStartupReason = "profile-reset"_ns;
|
||||
} else {
|
||||
mStartupReason = u"restart"_ns;
|
||||
mStartupReason = "restart"_ns;
|
||||
}
|
||||
|
||||
mCurrent = profile;
|
||||
@@ -1587,7 +1584,7 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mStartupReason = u"argument-profile"_ns;
|
||||
mStartupReason = "argument-profile"_ns;
|
||||
|
||||
GetProfileByDir(lf, nullptr, getter_AddRefs(mCurrent));
|
||||
NS_ADDREF(*aRootDir = lf);
|
||||
@@ -1649,7 +1646,7 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
if (ar) {
|
||||
mCurrent = GetProfileByName(nsDependentCString(arg));
|
||||
if (mCurrent) {
|
||||
mStartupReason = u"argument-p"_ns;
|
||||
mStartupReason = "argument-p"_ns;
|
||||
|
||||
mCurrent->GetRootDir(aRootDir);
|
||||
mCurrent->GetLocalDir(aLocalDir);
|
||||
@@ -1688,7 +1685,7 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
if (BackgroundTasks::IsEphemeralProfileTaskName(taskName)) {
|
||||
// Background task mode does not enable legacy telemetry, so this is for
|
||||
// completeness and testing only.
|
||||
mStartupReason = u"backgroundtask-ephemeral"_ns;
|
||||
mStartupReason = "backgroundtask-ephemeral"_ns;
|
||||
|
||||
nsCOMPtr<nsIFile> rootDir;
|
||||
rv = GetSpecialSystemDirectory(OS_TemporaryDirectory,
|
||||
@@ -1706,7 +1703,7 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
} else {
|
||||
// Background task mode does not enable legacy telemetry, so this is for
|
||||
// completeness and testing only.
|
||||
mStartupReason = u"backgroundtask-not-ephemeral"_ns;
|
||||
mStartupReason = "backgroundtask-not-ephemeral"_ns;
|
||||
|
||||
// A non-ephemeral profile is required.
|
||||
nsCOMPtr<nsIFile> rootDir;
|
||||
@@ -1859,7 +1856,7 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
rv = MaybeMakeDefaultDedicatedProfile(profile, &result);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (result) {
|
||||
mStartupReason = u"firstrun-claimed-default"_ns;
|
||||
mStartupReason = "firstrun-claimed-default"_ns;
|
||||
|
||||
mCurrent = profile;
|
||||
rootDir.forget(aRootDir);
|
||||
@@ -1895,9 +1892,9 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (skippedDefaultProfile) {
|
||||
mStartupReason = u"firstrun-skipped-default"_ns;
|
||||
mStartupReason = "firstrun-skipped-default"_ns;
|
||||
} else {
|
||||
mStartupReason = u"firstrun-created-default"_ns;
|
||||
mStartupReason = "firstrun-created-default"_ns;
|
||||
}
|
||||
|
||||
// Use the new profile.
|
||||
@@ -1920,7 +1917,7 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
|
||||
|
||||
// Let the caller know that the profile was selected by default.
|
||||
*aWasDefaultSelection = true;
|
||||
mStartupReason = u"default"_ns;
|
||||
mStartupReason = "default"_ns;
|
||||
|
||||
// Use the selected profile.
|
||||
mCurrent->GetRootDir(aRootDir);
|
||||
|
||||
@@ -184,7 +184,7 @@ class nsToolkitProfileService final : public nsIToolkitProfileService {
|
||||
bool mUseDevEditionProfile;
|
||||
// True if this install should use a dedicated default profile.
|
||||
const bool mUseDedicatedProfile;
|
||||
nsString mStartupReason;
|
||||
nsCString mStartupReason;
|
||||
// Records the version of the profiles.ini file as it was when it was loaded
|
||||
// during startup.
|
||||
nsCString mStartupFileVersion;
|
||||
|
||||
Reference in New Issue
Block a user