trusted_vault_histograms.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright 2021 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_SYNC_DRIVER_TRUSTED_VAULT_HISTOGRAMS_H_
  5. #define COMPONENTS_SYNC_DRIVER_TRUSTED_VAULT_HISTOGRAMS_H_
  6. namespace syncer {
  7. // These values are persisted to logs. Entries should not be renumbered and
  8. // numeric values should never be reused.
  9. enum class TrustedVaultDeviceRegistrationStateForUMA {
  10. kAlreadyRegisteredV0 = 0,
  11. kLocalKeysAreStale = 1,
  12. kThrottledClientSide = 2,
  13. kAttemptingRegistrationWithNewKeyPair = 3,
  14. kAttemptingRegistrationWithExistingKeyPair = 4,
  15. kAttemptingRegistrationWithPersistentAuthError = 5,
  16. kAlreadyRegisteredV1 = 6,
  17. kMaxValue = kAlreadyRegisteredV1,
  18. };
  19. // Used to provide UMA metric breakdowns.
  20. enum class TrustedVaultURLFetchReasonForUMA {
  21. kUnspecified,
  22. kRegisterDevice,
  23. kRegisterUnspecifiedAuthenticationFactor,
  24. kDownloadKeys,
  25. kDownloadIsRecoverabilityDegraded,
  26. };
  27. // These values are persisted to logs. Entries should not be renumbered and
  28. // numeric values should never be reused.
  29. enum class TrustedVaultDownloadKeysStatusForUMA {
  30. kSuccess = 0,
  31. // Deprecated in favor of the more fine-grained buckets.
  32. kDeprecatedMembershipNotFoundOrCorrupted = 1,
  33. kNoNewKeys = 2,
  34. kKeyProofsVerificationFailed = 3,
  35. kAccessTokenFetchingFailure = 4,
  36. kOtherError = 5,
  37. kMemberNotFound = 6,
  38. kMembershipNotFound = 7,
  39. kMembershipCorrupted = 8,
  40. kMembershipEmpty = 9,
  41. kNoPrimaryAccount = 10,
  42. kDeviceNotRegistered = 11,
  43. kThrottledClientSide = 12,
  44. kCorruptedLocalDeviceRegistration = 13,
  45. kAborted = 14,
  46. kMaxValue = kAborted
  47. };
  48. void RecordTrustedVaultDeviceRegistrationState(
  49. TrustedVaultDeviceRegistrationStateForUMA registration_state);
  50. // Records url fetch response status (combined http and net error code). If
  51. // |http_response_code| is non-zero, it will be recorded, otherwise |net_error|
  52. // will be recorded. Either |http_status| or |net_error| must be non zero.
  53. void RecordTrustedVaultURLFetchResponse(
  54. int http_response_code,
  55. int net_error,
  56. TrustedVaultURLFetchReasonForUMA reason =
  57. TrustedVaultURLFetchReasonForUMA::kUnspecified);
  58. void RecordTrustedVaultDownloadKeysStatus(
  59. TrustedVaultDownloadKeysStatusForUMA status);
  60. } // namespace syncer
  61. #endif // COMPONENTS_SYNC_DRIVER_TRUSTED_VAULT_HISTOGRAMS_H_