diff options
author | jwd@chromium.org <jwd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-01 21:50:31 +0000 |
---|---|---|
committer | jwd@chromium.org <jwd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-01 21:50:31 +0000 |
commit | ea21f6f0173384504ce7ad4368793551a4b007c9 (patch) | |
tree | 293a9b7cbb9708f55a655074066cd86c7b40a0b9 | |
parent | 22433f70e752e03aa8a961e6d18eac3c8ab2706e (diff) | |
download | chromium_src-ea21f6f0173384504ce7ad4368793551a4b007c9.zip chromium_src-ea21f6f0173384504ce7ad4368793551a4b007c9.tar.gz chromium_src-ea21f6f0173384504ce7ad4368793551a4b007c9.tar.bz2 |
Merge 260349 "One-time reset of UMA client ids and low entropy s..."
> One-time reset of UMA client ids and low entropy source.
>
> As we've observed a "cloned install" effect in the wild,
> doing this will de-clone such installs. (Which will work
> in conjunction with other measures to prevent new instances
> of cloned installs appearing).
>
> Renames client id and low entropy source prefs so that they
> are re-generated the next time Chrome runs. Makes the code
> clear the old prefs, so that they are cleaned up in
> existing local state files (in a future milestone, we can
> remove them completely - http://crbug.com/357704).
>
> (Note: Does not rename kMetricsPermutedEntropyCache as
> that pref is reset when the low entropy id is re-generated.)
>
> BUG=357618
> TEST=Running an UMA-enabled build should result in local state
> getting new values for user_experience_metrics.low_entropy_source2
> and user_experience_metrics.client_id2 and removal of prefs
> low_entropy_source and client_id.
> NOTRY=true
>
> Review URL: https://codereview.chromium.org/217083002
TBR=asvitkine@chromium.org
Review URL: https://codereview.chromium.org/218493016
git-svn-id: svn://svn.chromium.org/chrome/branches/1916/src@260952 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/metrics/metrics_log.cc | 2 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_log_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 25 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 21 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 4 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 13 |
6 files changed, 49 insertions, 20 deletions
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index f9721f4..4fd74e7 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -84,7 +84,7 @@ std::string GetMetricsEnabledDate(PrefService* pref) { return "0"; } - return pref->GetString(prefs::kMetricsClientIDTimestamp); + return pref->GetString(prefs::kMetricsReportingEnabledTimestamp); } OmniboxEventProto::InputType AsOmniboxEventInputType( diff --git a/chrome/browser/metrics/metrics_log_unittest.cc b/chrome/browser/metrics/metrics_log_unittest.cc index 9f3ca7c..eba9ed1 100644 --- a/chrome/browser/metrics/metrics_log_unittest.cc +++ b/chrome/browser/metrics/metrics_log_unittest.cc @@ -160,8 +160,8 @@ class TestMetricsLog : public MetricsLog { private: void InitPrefs() { prefs_->SetInt64(prefs::kInstallDate, kInstallDate); - prefs_->SetString(prefs::kMetricsClientIDTimestamp, - base::Int64ToString(kEnabledDate)); + prefs_->SetString(prefs::kMetricsReportingEnabledTimestamp, + base::Int64ToString(kEnabledDate)); #if defined(OS_CHROMEOS) prefs_->SetInteger(prefs::kStabilityChildProcessCrashCount, 10); prefs_->SetInteger(prefs::kStabilityOtherUserCrashCount, 11); diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 7155c40..ecd3114 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -437,9 +437,9 @@ void MetricsService::RegisterPrefs(PrefRegistrySimple* registry) { DCHECK(IsSingleThreaded()); registry->RegisterBooleanPref(prefs::kMetricsResetIds, false); registry->RegisterStringPref(prefs::kMetricsClientID, std::string()); + registry->RegisterInt64Pref(prefs::kMetricsReportingEnabledTimestamp, 0); registry->RegisterIntegerPref(prefs::kMetricsLowEntropySource, kLowEntropySourceNotSet); - registry->RegisterInt64Pref(prefs::kMetricsClientIDTimestamp, 0); registry->RegisterInt64Pref(prefs::kStabilityLaunchTimeSec, 0); registry->RegisterInt64Pref(prefs::kStabilityLastTimestampSec, 0); registry->RegisterStringPref(prefs::kStabilityStatsVersion, std::string()); @@ -484,6 +484,11 @@ void MetricsService::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0); registry->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0); + // TODO(asvitkine): Remove these once a couple of releases have passed. + // http://crbug.com/357704 + registry->RegisterStringPref(prefs::kMetricsOldClientID, std::string()); + registry->RegisterIntegerPref(prefs::kMetricsOldLowEntropySource, 0); + #if defined(OS_ANDROID) RegisterPrefsAndroid(registry); #endif // defined(OS_ANDROID) @@ -646,9 +651,14 @@ void MetricsService::ForceClientIdCreation() { client_id_ = GenerateClientID(); pref->SetString(prefs::kMetricsClientID, client_id_); - // Might as well make a note of how long this ID has existed - pref->SetString(prefs::kMetricsClientIDTimestamp, - base::Int64ToString(Time::Now().ToTimeT())); + if (pref->GetString(prefs::kMetricsOldClientID).empty()) { + // Record the timestamp of when the user opted in to UMA. + pref->SetInt64(prefs::kMetricsReportingEnabledTimestamp, + Time::Now().ToTimeT()); + } else { + UMA_HISTOGRAM_BOOLEAN("UMA.ClientIdMigrated", true); + } + pref->ClearPref(prefs::kMetricsOldClientID); } void MetricsService::EnableRecording() { @@ -1225,12 +1235,6 @@ int MetricsService::GetLowEntropySource() { // Otherwise, skip to generating a new value. if (!command_line->HasSwitch(switches::kResetVariationState)) { int value = local_state->GetInteger(prefs::kMetricsLowEntropySource); - // Old versions of the code would generate values in the range of [1, 8192], - // before the range was switched to [0, 8191] and then to [0, 7999]. Map - // 8192 to 0, so that the 0th bucket remains uniform, while re-generating - // the low entropy source for old values in the [8000, 8191] range. - if (value == 8192) - value = 0; // If the value is outside the [0, kMaxLowEntropySize) range, re-generate // it below. if (value >= 0 && value < kMaxLowEntropySize) { @@ -1243,6 +1247,7 @@ int MetricsService::GetLowEntropySource() { UMA_HISTOGRAM_BOOLEAN("UMA.GeneratedLowEntropySource", true); low_entropy_source_ = GenerateLowEntropySource(); local_state->SetInteger(prefs::kMetricsLowEntropySource, low_entropy_source_); + local_state->ClearPref(prefs::kMetricsOldLowEntropySource); metrics::CachingPermutedEntropyProvider::ClearCache(local_state); return low_entropy_source_; diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 678ee6d..c79a100 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -1362,22 +1362,31 @@ const char kDisableSSLRecordSplitting[] = "ssl.ssl_record_splitting.disabled"; const char kEulaAccepted[] = "EulaAccepted"; // The metrics client GUID, entropy source and session ID. -const char kMetricsClientID[] = "user_experience_metrics.client_id"; +// Note: The names client_id2 and low_entropy_source2 are a result of creating +// new prefs to do a one-time reset of the previous values. +const char kMetricsClientID[] = "user_experience_metrics.client_id2"; const char kMetricsSessionID[] = "user_experience_metrics.session_id"; const char kMetricsLowEntropySource[] = - "user_experience_metrics.low_entropy_source"; + "user_experience_metrics.low_entropy_source2"; const char kMetricsPermutedEntropyCache[] = "user_experience_metrics.permuted_entropy_cache"; -// Date/time when the current metrics profile ID was created -// (which hopefully corresponds to first run). -const char kMetricsClientIDTimestamp[] = - "user_experience_metrics.client_id_timestamp"; +// Old client id and low entropy source values, cleared the first time this +// version is launched. +// TODO(asvitkine): Delete these after a few releases have gone by and old +// values have been cleaned up. http://crbug.com/357704 +const char kMetricsOldClientID[] = "user_experience_metrics.client_id"; +const char kMetricsOldLowEntropySource[] = + "user_experience_metrics.low_entropy_source"; // Boolean that specifies whether or not crash reporting and metrics reporting // are sent over the network for analysis. const char kMetricsReportingEnabled[] = "user_experience_metrics.reporting_enabled"; +// Date/time when the user opted in to UMA and generated the client id for the +// very first time (local machine time, stored as a 64-bit time_t value). +const char kMetricsReportingEnabledTimestamp[] = + "user_experience_metrics.client_id_timestamp"; // A machine ID used to detect when underlying hardware changes. It is only // stored locally and never transmitted in metrics reports. diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index d79f0a5..573f834 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -435,8 +435,10 @@ extern const char kMetricsClientID[]; extern const char kMetricsSessionID[]; extern const char kMetricsLowEntropySource[]; extern const char kMetricsPermutedEntropyCache[]; -extern const char kMetricsClientIDTimestamp[]; +extern const char kMetricsOldClientID[]; +extern const char kMetricsOldLowEntropySource[]; extern const char kMetricsReportingEnabled[]; +extern const char kMetricsReportingEnabledTimestamp[]; extern const char kMetricsMachineId[]; extern const char kMetricsResetIds[]; // Android has it's own metric / crash reporting implemented in Android diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index bad41e4..cb68f31 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -27714,6 +27714,14 @@ other types of suffix sets. <summary>Whether the scroll is executed on main thread.</summary> </histogram> +<histogram name="UMA.ClientIdMigrated" enum="BooleanMigrated"> + <owner>asvitkine@chromium.org</owner> + <summary> + Recorded when the one-time UMA client id reset was performed (and the client + id of this user was migrated). + </summary> +</histogram> + <histogram name="UMA.CollectExternalEventsTime" units="milliseconds"> <owner>asvitkine@chromium.org</owner> <summary> @@ -30021,6 +30029,11 @@ other types of suffix sets. <int value="1" label="Matched"/> </enum> +<enum name="BooleanMigrated" type="int"> + <int value="0" label="Not migrated"/> + <int value="1" label="Migrated"/> +</enum> + <enum name="BooleanOrphan" type="int"> <int value="0" label="Non-orphan"/> <int value="1" label="Orphan"/> |