Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: components/feature_engagement_tracker/internal/stats.h

Issue 2911123003: Metrics for feature engagement tracker. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
5 #ifndef COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_STATS_H_
6 #define COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_STATS_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "components/feature_engagement_tracker/internal/condition_validator.h"
12 #include "components/feature_engagement_tracker/internal/configuration.h"
13 #include "components/feature_engagement_tracker/internal/proto/event.pb.h"
14
15 namespace feature_engagement_tracker {
16 namespace stats {
17
18 // Enum used in the metrics to record the result when in-product help UI is
19 // going to be triggered.
20 // Most of the fields maps to |ConditionValidator::Result|.
21 // The failure reasons are not mutually exclusive.
22 // Out-dated entries shouldn't be deleted but marked as obselete.
23 enum class TriggerHelpUIResult {
24 // The help UI is triggered.
25 SUCCESS = 0,
26
27 // The help UI is not triggered.
28 FAILURE = 1,
29
30 // Data layer is not ready.
31 FAILURE_MODEL_NOT_READY = 2,
32
33 // Some other help UI is currently showing.
34 FAILURE_CURRENTLY_SHOWING = 3,
35
36 // The feature is disabled.
37 FAILURE_FEATURE_DISABLED = 4,
38
39 // Configuration can not be parsed.
40 FAILURE_CONFIG_INVALID = 5,
41
42 // Used event precondition is not satisfied.
43 FAILURE_USED_PRECONDITION_UNMET = 6,
44
45 // Trigger event precondition is not satisfied.
46 FAILURE_TRIGGER_PRECONDITION_UNMET = 7,
47
48 // Other event precondition is not satisfied.
49 FAILURE_OTHER_PRECONDITION_UNMET = 8,
50
51 // Session rate does not meet the requirement.
52 FAILURE_SESSION_RATE = 9,
53
54 // Availability mode is not ready.
55 FAILURE_AVAILABILITY_MODEL_NOT_READY = 10,
56
57 // Availability precondition is not satisfied.
58 FAILURE_AVAILABILITY_PRECONDITION_UNMET = 11,
59
60 // Last entry for the enum.
61 COUNT = 12,
62 };
63
64 // Used in the metrics to track the configuration parsing event.
65 // The failure reasons are not mutually exclusive.
66 // Out-dated entries shouldn't be deleted but marked as obsolete.
67 enum class ConfigParsingEvent {
68 // The configuration is parsed correctly.
69 SUCCESS = 0,
70
71 // The configuration is invalid after parsing.
72 FAILURE = 1,
73
74 // Fails to parse the feature config because no field trial is found.
75 FAILURE_NO_FIELD_TRIAL = 2,
76
77 // Fails to parse the used event.
78 FAILURE_USED_EVENT_PARSE = 3,
79
80 // Used event is missing.
81 FAILURE_USED_EVENT_MISSING = 4,
82
83 // Fails to parse the trigger event.
84 FAILURE_TRIGGER_EVENT_PARSE = 5,
85
86 // Trigger event is missing.
87 FAILURE_TRIGGER_EVENT_MISSING = 6,
88
89 // Fails to parse other events.
90 FAILURE_OTHER_EVENT_PARSE = 7,
91
92 // Fails to parse the session rate comparator.
93 FAILURE_SESSION_RATE_PARSE = 8,
94
95 // Fails to parse the availability comparator.
96 FAILURE_AVAILABILITY_PARSE = 9,
97
98 // UnKnown key in configuration parameters.
99 FAILURE_UNKNOWN_KEY = 10,
100
101 // Last entry for the enum.
102 COUNT = 11,
103 };
104
105 // Used in metrics to track database states. Each type will match to a suffix
106 // in the histograms to identify the database.
107 enum class StoreType {
108 // Events store.
109 EVENTS_STORE = 0,
110
111 // Availability store.
112 AVAILABILITY_STORE = 1,
113 };
114
115 // Helper function that converts a store type to histogram suffix string.
116 std::string ToDbHistogramSuffix(StoreType type);
117
118 // Records the feature engagement events. Used event will be tracked
119 // separately.
120 void RecordNotifyEvent(const std::string& event,
121 const Configuration* config,
122 bool is_model_ready);
123
124 // Records user action and the result histogram when in-product help will be
125 // shown to the user.
126 void RecordShouldTriggerHelpUI(const base::Feature& feature,
127 const ConditionValidator::Result& result);
128
129 // Records when the user dismisses the in-product help UI.
130 void RecordUserDismiss();
131
132 // Records the result of database updates.
133 void RecordDbUpdate(bool success, StoreType type);
134
135 // Record database init.
136 void RecordDbInitEvent(bool success, StoreType type);
137
138 // Records events database load event.
139 void RecordEventDbLoadEvent(bool success, const std::vector<Event>& events);
140
141 // Records availability database load event.
142 void RecordAvailabilityDbLoadEvent(bool success);
143
144 // Records configuration parsing event.
145 void RecordConfigParsingEvent(ConfigParsingEvent event);
146
147 } // namespace stats
148 } // namespace feature_engagement_tracker
149
150 #endif // COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_STATS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698