File: metric_default_utils.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (162 lines) | stat: -rw-r--r-- 6,678 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_REPORTING_METRIC_DEFAULT_UTILS_H_
#define CHROME_BROWSER_CHROMEOS_REPORTING_METRIC_DEFAULT_UTILS_H_

#include "base/time/time.h"

namespace reporting::metrics {

// IMPORTANT: If you are updating any of the values in this file please
// make sure you keep it in sync with the comments in the proto:
// components/reporting/proto/synced/metric_data.proto

// Default app telemetry collection rate.
inline constexpr base::TimeDelta kDefaultAppUsageTelemetryCollectionRate =
    base::Minutes(15);

// Default audio telemetry collection rate.
inline constexpr base::TimeDelta kDefaultAudioTelemetryCollectionRate =
    base::Minutes(15);

// Default runtime counters telemetry collection rate.
inline constexpr base::TimeDelta
    kDefaultRuntimeCountersTelemetryCollectionRate = base::Days(1);

// Default metric collection rate used for testing purposes.
inline constexpr base::TimeDelta kDefaultCollectionRateForTesting =
    base::Minutes(2);

// Default device activity heartbeat collection rate.
inline constexpr base::TimeDelta kDefaultDeviceActivityHeartbeatCollectionRate =
    base::Minutes(15);

// Default Kiosk Heartbeat activity collection rate
inline constexpr base::TimeDelta kDefaultHeartbeatTelemetryCollectionRate =
    base::Minutes(2);

// Default Kiosk Vision telemetry collection rate
inline constexpr base::TimeDelta kDefaultKioskVisionTelemetryCollectionRate =
    base::Minutes(2);

// Default event checking rate for testing purposes.
inline constexpr base::TimeDelta kDefaultEventCheckingRateForTesting =
    base::Minutes(1);

// Default network telemetry collection rate.
inline constexpr base::TimeDelta kDefaultNetworkTelemetryCollectionRate =
    base::Minutes(60);

// Default network telemetry event checking rate.
inline constexpr base::TimeDelta kDefaultNetworkTelemetryEventCheckingRate =
    base::Minutes(10);

// Default record upload frequency.
inline constexpr base::TimeDelta kDefaultReportUploadFrequency = base::Hours(3);

// Default record upload frequency used for testing purposes.
inline constexpr base::TimeDelta kDefaultReportUploadFrequencyForTesting =
    base::Minutes(5);

// Default record upload frequency for KioskHeartbeats.
inline constexpr base::TimeDelta kDefaultKioskHeartbeatUploadFrequency =
    base::Minutes(2);

// Default record upload frequency for KioskHeartbeats.
inline constexpr base::TimeDelta
    kDefaultKioskHeartbeatUploadFrequencyForTesting = base::Minutes(1);

// Default website telemetry collection rate.
inline constexpr base::TimeDelta kDefaultWebsiteTelemetryCollectionRate =
    base::Minutes(15);

// Initial metric reporting collection delay.
inline constexpr base::TimeDelta kInitialCollectionDelay = base::Minutes(1);

// Peripheral collection delay to mitigate the race
// condition where CrosHealthD may query fwupd before it has a chance to read
// all of the USB devices that are plugged into the machine.
inline constexpr base::TimeDelta kPeripheralCollectionDelay = base::Seconds(5);

// Initial metric reporting upload delay.
inline constexpr base::TimeDelta kInitialUploadDelay = base::Minutes(3);

// Minimum usage time threshold for app usage reporting.
inline constexpr base::TimeDelta kMinimumAppUsageTime = base::Milliseconds(1);

// Minimum usage time threshold for website usage reporting.
inline constexpr base::TimeDelta kMinimumWebsiteUsageTime =
    base::Milliseconds(1);

// App event reporting rate limiter configuration.
inline constexpr size_t kAppEventsTotalSize = 4u * 1024u * 1024u;  // 4 MiB
inline constexpr base::TimeDelta kAppEventsWindow = base::Seconds(10);
inline constexpr size_t kAppEventsBucketCount = 10u;

// Website event reporting rate limiter configuration.
inline constexpr size_t kWebsiteEventsTotalSize =
    10u * 1024u * 1024u;  // 10 MiB
inline constexpr base::TimeDelta kWebsiteEventsWindow = base::Seconds(10);
inline constexpr size_t kWebsiteEventsBucketCount = 10u;

// Default value that controls app inventory reporting. Set to false even though
// the corresponding user policy is a list type to signify reporting is
// disallowed by default.
inline constexpr bool kReportAppInventoryEnabledDefaultValue = false;

// Default value for reporting device activity heartbeats.
inline constexpr bool kDeviceActivityHeartbeatEnabledDefaultValue = false;

// Default value for reporting device audio status.
inline constexpr bool kReportDeviceAudioStatusDefaultValue = true;

// Default value for reporting device network status.
inline constexpr bool kReportDeviceNetworkStatusDefaultValue = true;

// Default value for reporting device network events.
inline constexpr bool kDeviceReportNetworkEventsDefaultValue = false;

// Default value for reporting device peripheral status.
inline constexpr bool kReportDevicePeripheralsDefaultValue = false;

// Default value for reporting runtime counters.
inline constexpr bool kDeviceReportRuntimeCountersDefaultValue = false;

// Default value for reporting device graphics status.
inline constexpr bool kReportDeviceGraphicsStatusDefaultValue = false;

// Default value for reporting device app info and usage.
inline constexpr bool kReportDeviceAppInfoDefaultValue = false;

// Default value for reporting fatal crashes.
inline constexpr bool kReportDeviceCrashReportInfoDefaultValue = false;

// Default value that controls website activity event reporting. Set to false
// even though the corresponding user policy is an allowlist to signify
// reporting is disabled by default.
inline constexpr bool kReportWebsiteActivityEnabledDefaultValue = false;

// Default value for kHeartbeatTelemetry heartbeats to be sent.
inline constexpr bool kHeartbeatTelemetryDefaultValue = false;

// Default value for kKioskVisionTelemetry data to be sent.
inline constexpr bool kKioskVisionTelemetryDefaultValue = false;

// Returns the default report upload frequency for the current environment.
const base::TimeDelta GetDefaultReportUploadFrequency();

// Returns the default event checking rate for KioskHeartbeats and the current
// environment.
const base::TimeDelta GetDefaultKioskHeartbeatUploadFrequency();

// Returns the default metric collection rate for the current environment.
const base::TimeDelta GetDefaultCollectionRate(base::TimeDelta default_rate);

// Returns the default event checking rate for the current environment.
const base::TimeDelta GetDefaultEventCheckingRate(base::TimeDelta default_rate);

}  // namespace reporting::metrics

#endif  // CHROME_BROWSER_CHROMEOS_REPORTING_METRIC_DEFAULT_UTILS_H_