blob: e3c58dd1c56b59f6c49a35d20a22de3f06195619 [file] [log] [blame]
holte961fa392016-12-28 20:57:061// Copyright 2016 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
5#ifndef COMPONENTS_METRICS_PERSISTED_LOGS_METRICS_H_
6#define COMPONENTS_METRICS_PERSISTED_LOGS_METRICS_H_
7
8#include "base/macros.h"
9#include "components/metrics/persisted_logs.h"
10
11namespace metrics {
12
13// Interface for recording metrics from PersistedLogs.
14class PersistedLogsMetrics {
15 public:
holteade6fdf2017-02-23 02:42:3916 // 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
holte961fa392016-12-28 20:57:0634 PersistedLogsMetrics() {}
holte7b74c622017-01-23 23:13:0735 virtual ~PersistedLogsMetrics() {}
holte961fa392016-12-28 20:57:0636
holteade6fdf2017-02-23 02:42:3937 virtual void RecordLogReadStatus(LogReadStatus status){};
holte961fa392016-12-28 20:57:0638
39 virtual void RecordCompressionRatio(
40 size_t compressed_size, size_t original_size) {}
41
42 virtual void RecordDroppedLogSize(size_t size) {}
43
44 virtual void RecordDroppedLogsNum(int dropped_logs_num) {}
45
46 private:
47 DISALLOW_COPY_AND_ASSIGN(PersistedLogsMetrics);
48};
49
50} // namespace metrics
51
52#endif // COMPONENTS_METRICS_PERSISTED_LOGS_METRICS_H_