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

Side by Side Diff: components/metrics/metrics_log.h

Issue 2910023003: Change the logic for discarding all non-histogram logs because of actions/omnibox events to truncat… (Closed)
Patch Set: today extension 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
« no previous file with comments | « no previous file | components/metrics/metrics_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This file defines a set of user experience metrics data recorded by 5 // This file defines a set of user experience metrics data recorded by
6 // the MetricsService. This is the unit of data that is sent to the server. 6 // the MetricsService. This is the unit of data that is sent to the server.
7 7
8 #ifndef COMPONENTS_METRICS_METRICS_LOG_H_ 8 #ifndef COMPONENTS_METRICS_METRICS_LOG_H_
9 #define COMPONENTS_METRICS_METRICS_LOG_H_ 9 #define COMPONENTS_METRICS_METRICS_LOG_H_
10 10
(...skipping 13 matching lines...) Expand all
24 namespace base { 24 namespace base {
25 class HistogramSamples; 25 class HistogramSamples;
26 } 26 }
27 27
28 namespace variations { 28 namespace variations {
29 struct ActiveGroupId; 29 struct ActiveGroupId;
30 } 30 }
31 31
32 namespace metrics { 32 namespace metrics {
33 33
34 namespace internal {
35 extern const int kOmniboxEventLimit;
36 extern const int kUserActionEventLimit;
37 }
38
34 class MetricsProvider; 39 class MetricsProvider;
35 class MetricsServiceClient; 40 class MetricsServiceClient;
36 41
37 class MetricsLog { 42 class MetricsLog {
38 public: 43 public:
39 enum LogType { 44 enum LogType {
40 INITIAL_STABILITY_LOG, // The initial log containing stability stats. 45 INITIAL_STABILITY_LOG, // The initial log containing stability stats.
41 ONGOING_LOG, // Subsequent logs in a session. 46 ONGOING_LOG, // Subsequent logs in a session.
42 }; 47 };
43 48
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 base::TimeDelta uptime); 126 base::TimeDelta uptime);
122 127
123 // Records general metrics based on the specified |metrics_providers|. 128 // Records general metrics based on the specified |metrics_providers|.
124 void RecordGeneralMetrics( 129 void RecordGeneralMetrics(
125 const std::vector<std::unique_ptr<MetricsProvider>>& metrics_providers); 130 const std::vector<std::unique_ptr<MetricsProvider>>& metrics_providers);
126 131
127 // Stop writing to this record and generate the encoded representation. 132 // Stop writing to this record and generate the encoded representation.
128 // None of the Record* methods can be called after this is called. 133 // None of the Record* methods can be called after this is called.
129 void CloseLog(); 134 void CloseLog();
130 135
136 // Truncate some of the fields within the log that we want to restrict in
137 // size due to bandwidth concerns.
138 void TruncateEvents();
139
131 // Fills |encoded_log| with the serialized protobuf representation of the 140 // Fills |encoded_log| with the serialized protobuf representation of the
132 // record. Must only be called after CloseLog() has been called. 141 // record. Must only be called after CloseLog() has been called.
133 void GetEncodedLog(std::string* encoded_log); 142 void GetEncodedLog(std::string* encoded_log);
134 143
135 const base::TimeTicks& creation_time() const { 144 const base::TimeTicks& creation_time() const {
136 return creation_time_; 145 return creation_time_;
137 } 146 }
138 147
139 int num_events() const {
140 return uma_proto_.omnibox_event_size() +
141 uma_proto_.user_action_event_size();
142 }
143
144 LogType log_type() const { return log_type_; } 148 LogType log_type() const { return log_type_; }
145 149
146 protected: 150 protected:
147 // Exposed for the sake of mocking/accessing in test code. 151 // Exposed for the sake of mocking/accessing in test code.
148 152
149 // Fills |field_trial_ids| with the list of initialized field trials name and 153 // Fills |field_trial_ids| with the list of initialized field trials name and
150 // group ids. 154 // group ids.
151 virtual void GetFieldTrialIds( 155 virtual void GetFieldTrialIds(
152 std::vector<variations::ActiveGroupId>* field_trial_ids) const; 156 std::vector<variations::ActiveGroupId>* field_trial_ids) const;
153 157
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 const base::TimeTicks creation_time_; 201 const base::TimeTicks creation_time_;
198 202
199 PrefService* local_state_; 203 PrefService* local_state_;
200 204
201 DISALLOW_COPY_AND_ASSIGN(MetricsLog); 205 DISALLOW_COPY_AND_ASSIGN(MetricsLog);
202 }; 206 };
203 207
204 } // namespace metrics 208 } // namespace metrics
205 209
206 #endif // COMPONENTS_METRICS_METRICS_LOG_H_ 210 #endif // COMPONENTS_METRICS_METRICS_LOG_H_
OLDNEW
« no previous file with comments | « no previous file | components/metrics/metrics_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698