ukm_reporting_ios_util.h 1.3 KB

1234567891011121314151617181920212223242526
  1. // Copyright 2020 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_UKM_IOS_UKM_REPORTING_IOS_UTIL_H_
  5. #define COMPONENTS_UKM_IOS_UKM_REPORTING_IOS_UTIL_H_
  6. // Utilities in this file should help to figure out the root cause of
  7. // crbug.com/1154678 (Data loss on UMA in iOS). If total sum of
  8. // "UKM.IOSLog.OnSuccess" is greater than total count of "UKM.LogSize.OnSuccess"
  9. // records, then data loss is caused by failure to write the histogram to the
  10. // disk on background thread. Otherwise (if total sum of
  11. // "UKM.IOSLog.OnSuccess" is equal to total count of "UKM.LogSize.OnSuccess"
  12. // records) then there is actually no data loss and app simply gets terminated
  13. // in a short window between UKM reached the server and the API call which
  14. // records the data.
  15. // Records "UKM.IOSLog.OnSuccess" histogram and resets the counter.
  16. void RecordAndResetUkmLogSizeOnSuccessCounter();
  17. // Increments the counter which will be recorded as UMA histogram when
  18. // RecordAndResetUkmLogSizeOnSuccessCounter is called. Counter represents
  19. // number of times "UKM.LogSize.OnSuccess" was recorded.
  20. void IncrementUkmLogSizeOnSuccessCounter();
  21. #endif // COMPONENTS_UKM_IOS_UKM_REPORTING_IOS_UTIL_H_