xref: /aosp_15_r20/external/cronet/components/metrics/metrics_features.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1*6777b538SAndroid Build Coastguard Worker // Copyright 2022 The Chromium Authors
2*6777b538SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*6777b538SAndroid Build Coastguard Worker // found in the LICENSE file.
4*6777b538SAndroid Build Coastguard Worker 
5*6777b538SAndroid Build Coastguard Worker #ifndef COMPONENTS_METRICS_METRICS_FEATURES_H_
6*6777b538SAndroid Build Coastguard Worker #define COMPONENTS_METRICS_METRICS_FEATURES_H_
7*6777b538SAndroid Build Coastguard Worker 
8*6777b538SAndroid Build Coastguard Worker #include "base/feature_list.h"
9*6777b538SAndroid Build Coastguard Worker #include "base/metrics/field_trial_params.h"
10*6777b538SAndroid Build Coastguard Worker 
11*6777b538SAndroid Build Coastguard Worker namespace metrics::features {
12*6777b538SAndroid Build Coastguard Worker 
13*6777b538SAndroid Build Coastguard Worker // Determines at what point the metrics service is allowed to close a log when
14*6777b538SAndroid Build Coastguard Worker // Chrome is closed (and backgrounded/foregrounded for mobile platforms). When
15*6777b538SAndroid Build Coastguard Worker // this feature is disabled, the metrics service can only close a log if it has
16*6777b538SAndroid Build Coastguard Worker // already started sending logs. When this feature is enabled, the metrics
17*6777b538SAndroid Build Coastguard Worker // service can close a log starting from when the first log is opened.
18*6777b538SAndroid Build Coastguard Worker BASE_DECLARE_FEATURE(kMetricsServiceAllowEarlyLogClose);
19*6777b538SAndroid Build Coastguard Worker 
20*6777b538SAndroid Build Coastguard Worker // This can be used to disable structured metrics as a whole.
21*6777b538SAndroid Build Coastguard Worker BASE_DECLARE_FEATURE(kStructuredMetrics);
22*6777b538SAndroid Build Coastguard Worker 
23*6777b538SAndroid Build Coastguard Worker // Determines whether to schedule a flush of persistent histogram memory
24*6777b538SAndroid Build Coastguard Worker // immediately after writing a system profile to it.
25*6777b538SAndroid Build Coastguard Worker BASE_DECLARE_FEATURE(kFlushPersistentSystemProfileOnWrite);
26*6777b538SAndroid Build Coastguard Worker 
27*6777b538SAndroid Build Coastguard Worker // Determines whether to perform histogram delta snapshots in a background
28*6777b538SAndroid Build Coastguard Worker // thread (in contrast to snapshotting unlogged samples in the background, then
29*6777b538SAndroid Build Coastguard Worker // marking them as logged on the main thread).
30*6777b538SAndroid Build Coastguard Worker BASE_DECLARE_FEATURE(kMetricsServiceDeltaSnapshotInBg);
31*6777b538SAndroid Build Coastguard Worker 
32*6777b538SAndroid Build Coastguard Worker // Determines whether to always flush Local State immediately after an UMA/UKM
33*6777b538SAndroid Build Coastguard Worker // log upload. If this is disabled, Local State is only immediately flushed
34*6777b538SAndroid Build Coastguard Worker // after an upload if this is a mobile platform and the browser is in the
35*6777b538SAndroid Build Coastguard Worker // background.
36*6777b538SAndroid Build Coastguard Worker BASE_DECLARE_FEATURE(kReportingServiceAlwaysFlush);
37*6777b538SAndroid Build Coastguard Worker 
38*6777b538SAndroid Build Coastguard Worker // Controls trimming for metrics logs. This feature allows tuning of the log
39*6777b538SAndroid Build Coastguard Worker // trimming behaviour via serverside parameters. Do not remove. See
40*6777b538SAndroid Build Coastguard Worker // components/metrics/metrics_service_client.cc and
41*6777b538SAndroid Build Coastguard Worker // components/metrics/unsent_log_store.cc.
42*6777b538SAndroid Build Coastguard Worker BASE_DECLARE_FEATURE(kMetricsLogTrimming);
43*6777b538SAndroid Build Coastguard Worker 
44*6777b538SAndroid Build Coastguard Worker }  // namespace metrics::features
45*6777b538SAndroid Build Coastguard Worker 
46*6777b538SAndroid Build Coastguard Worker #endif  // COMPONENTS_METRICS_METRICS_FEATURES_H_
47