// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/variations/service/safe_seed_manager.h" #include <algorithm> #include "base/base_switches.h" #include "base/command_line.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "components/prefs/pref_registry.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/variations/client_filterable_state.h" #include "components/variations/pref_names.h" #include "components/variations/variations_seed_store.h" #include "components/variations/variations_switches.h" namespace variations { // Consecutive seed fetch failures are, unfortunately, a bit more common. As of // January 2018, users at the 99.5th percentile tend to see fewer than 4 // consecutive fetch failures on mobile platforms; and users at the 99th // percentile tend to see fewer than 5 or 6 consecutive failures on desktop // platforms. It makes sense that the characteristics differ on mobile // vs. desktop platforms, given that the two use different scheduling algorithms // for the fetches. Graphs: // [1] Android, all channels (consistently connected): // https://uma.googleplex.com/timeline_v2?sid=99d1d4c2490c60bcbde7afeb77c12a28 // [2] High-connectivity platforms, Stable and Beta channel (consistently // connected): // https://uma.googleplex.com/timeline_v2?sid=2db5b7278dad41cbf349f5f2cb30efd9 // [3] Other platforms, Stable and Beta channel (slightly less connected): // https://uma.googleplex.com/timeline_v2?sid=d4ba2f3751d211898f8e69214147c2ec // [4] All platforms, Dev (even less connected): // https://uma.googleplex.com/timeline_v2?sid=5740fb22b17faa823822adfd8e00ec1a // [5] All platforms, Canary (actually fairly well-connected!): // https://uma.googleplex.com/timeline_v2?sid=3e14d3e4887792bb614db9f3f2c1d48c // Note the all of the graphs show a spike on a particular day, presumably due // to server-side instability. Moreover, the Dev channel on desktop is an // outlier – users on the Dev channel can experience just shy of 9 consecutive // failures on some platforms. // Decision: There is not an obvious threshold that both achieves a low // false-positive rate and provides good coverage for true positives. For now, // set a threshold that should minimize false-positives. // TODO(isherman): Check in with the networking team about their thoughts on how // to find a better balance here. constexpr int kFetchFailureStreakSafeSeedThreshold = …; constexpr int kFetchFailureStreakNullSeedThreshold = …; SafeSeedManager::SafeSeedManager(PrefService* local_state) : … { … } SafeSeedManager::~SafeSeedManager() = default; // static void SafeSeedManager::RegisterPrefs(PrefRegistrySimple* registry) { … } SeedType SafeSeedManager::GetSeedType() const { … } void SafeSeedManager::RecordFetchStarted() { … } void SafeSeedManager::RecordSuccessfulFetch(VariationsSeedStore* seed_store) { … } } // namespace variations