implement ukm (go/ukm) for downloads. design doc: go/downloads-ukm
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/71566dac0210ce08ea01c50bfc73335bfd188c58 commit 71566dac0210ce08ea01c50bfc73335bfd188c58 Author: Joy Ming <jming@chromium.org> Date: Wed Jan 10 20:57:12 2018 [Downloads ukm] Persist unique UKM ID and source ID. In order to ensure that there is a unique ID for each download and that the source ID is retrieved from the web contents, it is necessary to persist that information in the cache that stores information about in-progress downloads, even across interruptions and resumptions. All downloads that have WebContents will pass through DownloadResourceHandler, which will pass a DownloadCreateInfo to DownloadManager through the StartDownload call. This ensures that every download that goes through this path will have a corresponding entry in InProgressCache, which it owns, with a UKM ID and Source ID. Later, when UKM is implemented, these can be looked up using the GUID. However, there are cases where the download is started without WebContents. Those cases will still maintain an entry with a unique ID for UKM. However, they will keep a null SourceID to be later processed. Bug: 785557 Change-Id: I77fd867d68819f47479ad9ab84edcf3d16d94369 Reviewed-on: https://chromium-review.googlesource.com/828200 Reviewed-by: Steven Holte <holte@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: David Trainor <dtrainor@chromium.org> Commit-Queue: Joy Ming <jming@chromium.org> Cr-Commit-Position: refs/heads/master@{#528418} [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/components/download/downloader/in_progress/BUILD.gn [add] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/components/download/downloader/in_progress/DEPS [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/components/download/downloader/in_progress/download_entry.cc [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/components/download/downloader/in_progress/download_entry.h [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/components/download/downloader/in_progress/in_progress_cache_impl_unittest.cc [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/components/download/downloader/in_progress/in_progress_conversions.cc [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/components/download/downloader/in_progress/in_progress_conversions_unittest.cc [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/components/download/downloader/in_progress/proto/download_entry.proto [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/BUILD.gn [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/download/download_create_info.cc [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/download/download_create_info.h [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/download/download_manager_impl.cc [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/download/download_manager_impl.h [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/download/download_resource_handler.cc [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/download/download_resource_handler.h [add] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/download/download_ukm_helper.cc [add] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/download/download_ukm_helper.h [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/content/browser/download/save_package.cc [modify] https://crrev.com/71566dac0210ce08ea01c50bfc73335bfd188c58/services/metrics/public/cpp/ukm_recorder.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/123e66ca4d38c7a180c1482511c3a18f28ae6073 commit 123e66ca4d38c7a180c1482511c3a18f28ae6073 Author: Joy Ming <jming@chromium.org> Date: Mon Jan 29 22:00:18 2018 [Downloads ukm] Initial implementation. Begin implementation for downloads by creating entries in ukm.xml and a DownloadUkmHelper following go/downloads-ukm for: - Download.Started: file_type, download_source - Download.Interrupted: change_in_file_size, reason, resulting_file_size, time_since_start - Download.Resumed: mode, time_since_start - Download.Completed: resulting_file_size, time_since_start The implementation strategy is to have a ukm_download_id persisted that will uniquely identify each download. The ukm_source_id will be reported only at the start of the download. Bug: 785557 Change-Id: I94b46bc3287fcde949e58424dc929e71cec7df16 Reviewed-on: https://chromium-review.googlesource.com/742357 Commit-Queue: Joy Ming <jming@chromium.org> Reviewed-by: David Trainor <dtrainor@chromium.org> Reviewed-by: Steven Holte <holte@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Xing Liu <xingliu@chromium.org> Cr-Commit-Position: refs/heads/master@{#532613} [modify] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/BUILD.gn [add] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/download/download_content.h [modify] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/download/download_item_impl.cc [modify] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/download/download_item_impl.h [modify] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/download/download_stats.cc [modify] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/download/download_stats.h [modify] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/download/download_ukm_helper.cc [modify] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/download/download_ukm_helper.h [add] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/download/download_ukm_helper_unittest.cc [add] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/browser/download/resume_mode.h [modify] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/content/test/BUILD.gn [modify] https://crrev.com/123e66ca4d38c7a180c1482511c3a18f28ae6073/tools/metrics/ukm/ukm.xml
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4a8fc9da53e66db1c6aa7812114fb40812a93d49 commit 4a8fc9da53e66db1c6aa7812114fb40812a93d49 Author: Joy Ming <jming@chromium.org> Date: Wed Mar 07 01:30:56 2018 [Downloads ukm] Add bytes wasted metrics. Bytes wasted measures the number of bytes used beyond the file size, often as a result of resumptions. Before the in-progress cache, there was no way of maintaining the number of bytes wasted across resumptions on the native side even though Java uses SharedPreferences to do so in DownloadManagerService.updateBytesReceived. This CL implements the bytes wasted count on native utilizing the in-progress cache and reporting these metrics through UKM. Bug: 785557 Change-Id: I79614f1f4fab73d0e526c096e3f68541f7cb1170 Reviewed-on: https://chromium-review.googlesource.com/909288 Commit-Queue: Joy Ming <jming@chromium.org> Reviewed-by: Min Qin <qinmin@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Steven Holte <holte@chromium.org> Reviewed-by: David Trainor <dtrainor@chromium.org> Cr-Commit-Position: refs/heads/master@{#541263} [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/downloader/in_progress/download_entry.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/downloader/in_progress/download_entry.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/downloader/in_progress/in_progress_conversions.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/downloader/in_progress/in_progress_conversions_unittest.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/downloader/in_progress/proto/download_entry.proto [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/internal/common/base_file.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/internal/common/base_file_unittest.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/internal/common/base_file_win_unittest.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/internal/common/download_ukm_helper.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/internal/common/download_ukm_helper_unittest.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/public/common/base_file.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/public/common/download_item.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/components/download/public/common/download_ukm_helper.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/devtools/protocol/devtools_protocol_browsertest.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_browsertest.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_file.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_file_impl.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_file_impl.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_file_unittest.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_item_impl.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_item_impl.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_item_impl_unittest.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_job.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_job.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/download_manager_impl.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/mock_download_file.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/mock_download_file.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/parallel_download_job.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/parallel_download_job.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/parallel_download_job_unittest.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/browser/download/save_file.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/public/test/fake_download_item.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/public/test/fake_download_item.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/public/test/mock_download_item.h [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/content/public/test/test_file_error_injector.cc [modify] https://crrev.com/4a8fc9da53e66db1c6aa7812114fb40812a93d49/tools/metrics/ukm/ukm.xml
Comment 1 by bugdroid1@chromium.org
, Jan 10 2018