| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_METRICS_PERSISTED_LOGS_METRICS_H_ | 5 #ifndef COMPONENTS_METRICS_PERSISTED_LOGS_METRICS_H_ |
| 6 #define COMPONENTS_METRICS_PERSISTED_LOGS_METRICS_H_ | 6 #define COMPONENTS_METRICS_PERSISTED_LOGS_METRICS_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/metrics/persisted_logs.h" | 9 #include "components/metrics/persisted_logs.h" |
| 10 | 10 |
| 11 namespace metrics { | 11 namespace metrics { |
| 12 | 12 |
| 13 // Interface for recording metrics from PersistedLogs. | 13 // Interface for recording metrics from PersistedLogs. |
| 14 class PersistedLogsMetrics { | 14 class PersistedLogsMetrics { |
| 15 public: | 15 public: |
| 16 // Used to produce a histogram that keeps track of the status of recalling |
| 17 // persisted per logs. |
| 18 enum LogReadStatus { |
| 19 RECALL_SUCCESS, // We were able to correctly recall a persisted log. |
| 20 LIST_EMPTY, // Attempting to recall from an empty list. |
| 21 LIST_SIZE_MISSING, // Failed to recover list size using GetAsInteger(). |
| 22 LIST_SIZE_TOO_SMALL, // Too few elements in the list (less than 3). |
| 23 LIST_SIZE_CORRUPTION, // List size is not as expected. |
| 24 LOG_STRING_CORRUPTION, // Failed to recover log string using GetAsString(). |
| 25 CHECKSUM_CORRUPTION, // Failed to verify checksum. |
| 26 CHECKSUM_STRING_CORRUPTION, // Failed to recover checksum string using |
| 27 // GetAsString(). |
| 28 DECODE_FAIL, // Failed to decode log. |
| 29 DEPRECATED_XML_PROTO_MISMATCH, // The XML and protobuf logs have |
| 30 // inconsistent data. |
| 31 END_RECALL_STATUS // Number of bins to use to create the histogram. |
| 32 }; |
| 33 |
| 16 PersistedLogsMetrics() {} | 34 PersistedLogsMetrics() {} |
| 17 virtual ~PersistedLogsMetrics() {} | 35 virtual ~PersistedLogsMetrics() {} |
| 18 | 36 |
| 19 virtual PersistedLogs::LogReadStatus RecordLogReadStatus( | 37 virtual void RecordLogReadStatus(LogReadStatus status){}; |
| 20 PersistedLogs::LogReadStatus status) = 0; | |
| 21 | 38 |
| 22 virtual void RecordCompressionRatio( | 39 virtual void RecordCompressionRatio( |
| 23 size_t compressed_size, size_t original_size) {} | 40 size_t compressed_size, size_t original_size) {} |
| 24 | 41 |
| 25 virtual void RecordDroppedLogSize(size_t size) {} | 42 virtual void RecordDroppedLogSize(size_t size) {} |
| 26 | 43 |
| 27 virtual void RecordDroppedLogsNum(int dropped_logs_num) {} | 44 virtual void RecordDroppedLogsNum(int dropped_logs_num) {} |
| 28 | 45 |
| 29 private: | 46 private: |
| 30 DISALLOW_COPY_AND_ASSIGN(PersistedLogsMetrics); | 47 DISALLOW_COPY_AND_ASSIGN(PersistedLogsMetrics); |
| 31 }; | 48 }; |
| 32 | 49 |
| 33 } // namespace metrics | 50 } // namespace metrics |
| 34 | 51 |
| 35 #endif // COMPONENTS_METRICS_PERSISTED_LOGS_METRICS_H_ | 52 #endif // COMPONENTS_METRICS_PERSISTED_LOGS_METRICS_H_ |
| OLD | NEW |