metrics.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_VARIATIONS_METRICS_H_
  5. #define COMPONENTS_VARIATIONS_METRICS_H_
  6. #include "base/component_export.h"
  7. #include "build/build_config.h"
  8. namespace variations {
  9. #if BUILDFLAG(IS_ANDROID)
  10. // The result of importing a seed during Android first run.
  11. // Note: UMA histogram enum - don't re-order or remove entries.
  12. enum class FirstRunSeedImportResult {
  13. SUCCESS,
  14. FAIL_NO_CALLBACK,
  15. FAIL_NO_FIRST_RUN_SEED,
  16. FAIL_STORE_FAILED,
  17. FAIL_INVALID_RESPONSE_DATE,
  18. ENUM_SIZE
  19. };
  20. #endif // BUILDFLAG(IS_ANDROID)
  21. // The result of attempting to load a variations seed during startup.
  22. //
  23. // These values are persisted to logs. Entries should not be renumbered and
  24. // numeric values should never be reused.
  25. //
  26. // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.variations
  27. enum class LoadSeedResult {
  28. kSuccess = 0,
  29. kEmpty = 1,
  30. // kCorrupt = 2, // Deprecated.
  31. kInvalidSignature = 3,
  32. kCorruptBase64 = 4,
  33. kCorruptProtobuf = 5,
  34. kCorruptGzip = 6,
  35. kLoadTimedOut = 7,
  36. kLoadInterrupted = 8,
  37. kLoadOtherFailure = 9,
  38. kMaxValue = kLoadOtherFailure,
  39. };
  40. // The result of attempting to store a variations seed received from the server.
  41. //
  42. // These values are persisted to logs. Entries should not be renumbered and
  43. // numeric values should never be reused.
  44. enum class StoreSeedResult {
  45. kSuccess = 0,
  46. // kFailedEmpty = 1, // Deprecated.
  47. kFailedParse = 2,
  48. kFailedSignature = 3,
  49. kFailedGzip = 4,
  50. // kDeltaCount = 5, // Deprecated.
  51. kFailedDeltaReadSeed = 6,
  52. kFailedDeltaApply = 7,
  53. kFailedDeltaStore = 8,
  54. kFailedUngzip = 9,
  55. kFailedEmptyGzipContents = 10,
  56. kFailedUnsupportedSeedFormat = 11,
  57. // The following are not so much a result of the seed store, but rather
  58. // counting the types of seeds the SeedStore() function saw. Kept in the same
  59. // histogram for efficiency and convenience of comparing against the other
  60. // values.
  61. kGzipDeltaCount = 12,
  62. kNonGzipDeltaCount = 13,
  63. kGzipFullCount = 14,
  64. kNonGzipFullCount = 15,
  65. kMaxValue = kNonGzipFullCount,
  66. };
  67. // The result of updating the date associated with an existing stored variations
  68. // seed.
  69. // Note: UMA histogram enum - don't re-order or remove entries.
  70. enum class UpdateSeedDateResult {
  71. NO_OLD_DATE,
  72. NEW_DATE_IS_OLDER,
  73. SAME_DAY,
  74. NEW_DAY,
  75. ENUM_SIZE
  76. };
  77. // The result of verifying a variation seed's signature.
  78. // Note: UMA histogram enum - don't re-order or remove entries.
  79. enum class VerifySignatureResult {
  80. MISSING_SIGNATURE,
  81. DECODE_FAILED,
  82. INVALID_SIGNATURE,
  83. INVALID_SEED,
  84. VALID_SIGNATURE,
  85. ENUM_SIZE
  86. };
  87. // Describes instance manipulations applied to data.
  88. struct InstanceManipulations {
  89. const bool gzip_compressed;
  90. const bool delta_compressed;
  91. };
  92. #if BUILDFLAG(IS_ANDROID)
  93. // Records the result of importing a seed during Android first run.
  94. COMPONENT_EXPORT(VARIATIONS)
  95. void RecordFirstRunSeedImportResult(FirstRunSeedImportResult result);
  96. #endif // BUILDFLAG(IS_ANDROID)
  97. // Records the result of attempting to load the latest variations seed on
  98. // startup.
  99. COMPONENT_EXPORT(VARIATIONS) void RecordLoadSeedResult(LoadSeedResult state);
  100. // Records the result of attempting to load the safe variations seed on startup.
  101. COMPONENT_EXPORT(VARIATIONS)
  102. void RecordLoadSafeSeedResult(LoadSeedResult state);
  103. // Records the result of attempting to store a variations seed received from the
  104. // server.
  105. COMPONENT_EXPORT(VARIATIONS) void RecordStoreSeedResult(StoreSeedResult result);
  106. // Records the result of attempting to store a seed as the safe seed.
  107. COMPONENT_EXPORT(VARIATIONS)
  108. void RecordStoreSafeSeedResult(StoreSeedResult result);
  109. // Reports to UMA that the seed format specified by the server is unsupported.
  110. COMPONENT_EXPORT(VARIATIONS) void ReportUnsupportedSeedFormatError();
  111. // Records the instance manipulations a seed was received with.
  112. COMPONENT_EXPORT(VARIATIONS)
  113. void RecordSeedInstanceManipulations(const InstanceManipulations& im);
  114. } // namespace variations
  115. #endif // COMPONENTS_VARIATIONS_METRICS_H_