xref: /aosp_15_r20/external/cronet/components/metrics/debug/README.md (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1*6777b538SAndroid Build Coastguard Worker# Metrics Internals Debug Page
2*6777b538SAndroid Build Coastguard Worker
3*6777b538SAndroid Build Coastguard Worker**chrome://metrics-internals** is a debug page that reports the state of various
4*6777b538SAndroid Build Coastguard Workermetrics systems.
5*6777b538SAndroid Build Coastguard Worker
6*6777b538SAndroid Build Coastguard WorkerThe page displays logs that have been collected by the UMA metrics service,
7*6777b538SAndroid Build Coastguard Workerwhich are eventually sent to Google servers. These logs can be exported, and
8*6777b538SAndroid Build Coastguard Workertheir proto data can later be inspected using a Google-internal tool:
9*6777b538SAndroid Build Coastguard Worker[go/metrics-internals-inspector](http://go/metrics-internals-inspector).
10*6777b538SAndroid Build Coastguard Worker
11*6777b538SAndroid Build Coastguard WorkerOn debug builds, the page will show all logs collected since browser startup,
12*6777b538SAndroid Build Coastguard Workerincluding logs from previous sessions that were not sent yet. On release builds,
13*6777b538SAndroid Build Coastguard Workerthe page will instead show logs collected since the page was opened. This
14*6777b538SAndroid Build Coastguard Workerdifference is mostly due to memory concerns (on official releases, we don't want
15*6777b538SAndroid Build Coastguard Workerlogs to be lingering in memory since they can be relatively large).
16*6777b538SAndroid Build Coastguard Worker
17*6777b538SAndroid Build Coastguard Worker> Tip: By using the `--export-uma-logs-to-file=FILE_PATH` command line flag, all
18*6777b538SAndroid Build Coastguard Workerlogs collected throughout the Chrome session will be exported to the passed
19*6777b538SAndroid Build Coastguard Worker`FILE_PATH` on shutdown (the file is created if it does not already exist). For
20*6777b538SAndroid Build Coastguard Workerrelease builds, this flag also has the effect of showing all logs collected
21*6777b538SAndroid Build Coastguard Workersince browser startup on the page.
22*6777b538SAndroid Build Coastguard Worker
23*6777b538SAndroid Build Coastguard Worker> Note: The delay between logs being closed can be [long]. If you are just
24*6777b538SAndroid Build Coastguard Workertesting to see if a certain metric (e.g., histogram, user action, etc.) is being
25*6777b538SAndroid Build Coastguard Workerproperly sent to Google servers and you want logs to be collected more often,
26*6777b538SAndroid Build Coastguard Workeryou can use the `--metrics-upload-interval=N` command line flag, where `N` is in
27*6777b538SAndroid Build Coastguard Workerseconds and is at least `20`.
28*6777b538SAndroid Build Coastguard Worker
29*6777b538SAndroid Build Coastguard Worker[long]: https://source.chromium.org/chromium/chromium/src/+/main:components/metrics/net/cellular_logic_helper.cc;l=18,21;drc=8ba1bad80dc22235693a0dd41fe55c0fd2dbdabd
30*6777b538SAndroid Build Coastguard Worker
31*6777b538SAndroid Build Coastguard WorkerUnlike other metrics debug pages ([chrome://user-actions], **chrome://ukm**, and
32*6777b538SAndroid Build Coastguard Worker[chrome://histograms]), this page focuses mainly on what has actually been sent
33*6777b538SAndroid Build Coastguard Workerto Google servers. For example, it is possible that a user action shown on
34*6777b538SAndroid Build Coastguard Worker[chrome://user-actions] is never actually sent (e.g., due to being [truncated]
35*6777b538SAndroid Build Coastguard Workerfor bandwidth reasons). Similarly, a source shown on **chrome://ukm** might be
36*6777b538SAndroid Build Coastguard Worker[dropped] and hence never be sent. Or, a histogram shown on
37*6777b538SAndroid Build Coastguard Worker[chrome://histograms] would not have been collected under regular circumstances
38*6777b538SAndroid Build Coastguard Worker(e.g., subprocess histograms, which are normally only collected periodically,
39*6777b538SAndroid Build Coastguard Workerbut are collected [immediately] when loading **chrome://histograms**). In other
40*6777b538SAndroid Build Coastguard Workerwords, this page displays the actual logs that have been created and sent,
41*6777b538SAndroid Build Coastguard Workerwithout modifications.
42*6777b538SAndroid Build Coastguard Worker
43*6777b538SAndroid Build Coastguard Worker[chrome://user-actions]: https://chromium.googlesource.com/chromium/src/+/master/tools/metrics/actions/README.md#Testing
44*6777b538SAndroid Build Coastguard Worker[chrome://histograms]: https://chromium.googlesource.com/chromium/src/+/master/tools/metrics/histograms/README.md#Testing
45*6777b538SAndroid Build Coastguard Worker[truncated]: https://source.chromium.org/chromium/chromium/src/+/main:components/metrics/metrics_log.cc;l=552;drc=38321ee39cd73ac2d9d4400c56b90613dee5fe29
46*6777b538SAndroid Build Coastguard Worker[dropped]: https://source.chromium.org/chromium/chromium/src/+/main:components/ukm/ukm_recorder_impl.cc;l=362;drc=38321ee39cd73ac2d9d4400c56b90613dee5fe29
47*6777b538SAndroid Build Coastguard Worker[immediately]: https://source.chromium.org/chromium/chromium/src/+/main:content/browser/metrics/histograms_internals_ui.cc;l=100;drc=5e521f43547ebdce502a555c5edb3a18f0c87a8a
48