Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: components/metrics/metrics_log.cc

Issue 2296543002: Quantify initial stability report edge cases. (Closed)
Patch Set: Fix unittests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/metrics/metrics_log.cc
diff --git a/components/metrics/metrics_log.cc b/components/metrics/metrics_log.cc
index 691a946f9e6796d0ecd7051eddcbf569d51cc4d6..33981eed25163ab2b28c5df18f6e93c120787d72 100644
--- a/components/metrics/metrics_log.cc
+++ b/components/metrics/metrics_log.cc
@@ -117,9 +117,9 @@ MetricsLog::~MetricsLog() {
// static
void MetricsLog::RegisterPrefs(PrefRegistrySimple* registry) {
- registry->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0);
registry->RegisterIntegerPref(prefs::kStabilityCrashCount, 0);
registry->RegisterIntegerPref(prefs::kStabilityIncompleteSessionEndCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0);
registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationFail, 0);
registry->RegisterIntegerPref(
prefs::kStabilityBreakpadRegistrationSuccess, 0);
@@ -129,6 +129,9 @@ void MetricsLog::RegisterPrefs(PrefRegistrySimple* registry) {
std::string());
registry->RegisterStringPref(prefs::kStabilitySavedSystemProfileHash,
std::string());
+ registry->RegisterIntegerPref(prefs::kStabilityDeferredCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityDiscardCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityVersionMismatchCount, 0);
}
// static
@@ -242,6 +245,31 @@ void MetricsLog::RecordStabilityMetrics(
pref->SetInteger(prefs::kStabilityDebuggerNotPresent, 0);
stability->set_debugger_not_present_count(debugger_not_present_count);
}
+
+ // Note: only logging the following histograms for non-zero values.
+
+ int deferred_count = pref->GetInteger(prefs::kStabilityDeferredCount);
+ if (deferred_count) {
+ local_state_->SetInteger(prefs::kStabilityDeferredCount, 0);
+ UMA_HISTOGRAM_COUNTS_100("Stability.InitialStabilityLog.DeferredCount",
Alexei Svitkine (slow) 2016/09/02 17:57:49 If you want these to be logged in the initial stab
manzagop (departed) 2016/09/02 21:00:05 Oh, good to know! Done.
+ deferred_count);
+ }
+
+ int discard_count = local_state_->GetInteger(prefs::kStabilityDiscardCount);
+ if (discard_count) {
+ local_state_->SetInteger(prefs::kStabilityDiscardCount, 0);
+ UMA_HISTOGRAM_COUNTS_100("Stability.InitialStabilityLog.DiscardCount",
Alexei Svitkine (slow) 2016/09/02 17:57:49 Will these always be logged just in the initial st
manzagop (departed) 2016/09/02 21:00:05 No, they might be logged with any log. My thinking
Alexei Svitkine (slow) 2016/09/08 18:41:12 Ah, I see - the InitialStabilityLog refers to "wha
+ discard_count);
+ }
+
+ int version_mismatch_count =
+ local_state_->GetInteger(prefs::kStabilityVersionMismatchCount);
+ if (version_mismatch_count) {
+ local_state_->SetInteger(prefs::kStabilityVersionMismatchCount, 0);
+ UMA_HISTOGRAM_COUNTS_100(
+ "Stability.InitialStabilityLog.VersionMismatchCount",
+ version_mismatch_count);
+ }
}
void MetricsLog::RecordGeneralMetrics(
@@ -401,7 +429,10 @@ void MetricsLog::RecordEnvironment(
}
}
-bool MetricsLog::LoadSavedEnvironmentFromPrefs() {
+bool MetricsLog::LoadSavedEnvironmentFromPrefs(std::string* app_version) {
+ DCHECK(app_version);
+ app_version->clear();
+
PrefService* local_state = local_state_;
const std::string base64_system_profile =
local_state->GetString(prefs::kStabilitySavedSystemProfile);
@@ -415,10 +446,14 @@ bool MetricsLog::LoadSavedEnvironmentFromPrefs() {
SystemProfileProto* system_profile = uma_proto()->mutable_system_profile();
std::string serialized_system_profile;
- return base::Base64Decode(base64_system_profile,
- &serialized_system_profile) &&
- ComputeSHA1(serialized_system_profile) == system_profile_hash &&
- system_profile->ParseFromString(serialized_system_profile);
+
+ bool success =
+ base::Base64Decode(base64_system_profile, &serialized_system_profile) &&
+ ComputeSHA1(serialized_system_profile) == system_profile_hash &&
+ system_profile->ParseFromString(serialized_system_profile);
+ if (success)
+ *app_version = system_profile->app_version();
+ return success;
}
void MetricsLog::CloseLog() {

Powered by Google App Engine
This is Rietveld 408576698