-
Notifications
You must be signed in to change notification settings - Fork 187
Cherry pick PR #8845: cobalt/metrics: Implement Memory.Total.PrivateMemoryFootprint metric #9045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 26.eap
Are you sure you want to change the base?
Conversation
…8845) Implement the collection of the private memory footprint metric. This change leverages the Chromium memory_instrumentation service to periodically request global memory dumps and record the total private memory footprint as a UMA histogram. This provides crucial data for monitoring memory usage in Cobalt. A new command-line switch is added to allow configuration of the collection interval. Note: Local testing was also done via `python3 cobalt/tools/uma/pull_uma_histogram_set_via_cdp.py --no-manage-cobalt --output-file=uma_output.txt`. Test: `out/android-x86_devel/bin/run_cobalt_unittests --gtest_filter="*CobaltMetricsServiceClientTest*"` Test: `out/android-x86_devel/bin/run_cobalt_browsertests --gtest_filter="*CobaltMetricsBrowserTest*"` Bug: 479261728 (cherry picked from commit 52f2617)
|
Caution There were merge conflicts while cherry picking! Check out cherry-pick-26.eap-8845 and fix the conflicts before proceeding. Check the log at https://github.com/youtube/cobalt/actions/runs/21886594466 for details. |
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
Awallky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix merge conflicts
…emory.Total.PrivateMemoryFootprint metric (#8845)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request aims to implement the collection of the private memory footprint metric by leveraging Chromium's memory instrumentation service to periodically gather and report memory usage. While the core memory metrics collection appears correct, a medium-severity Path Traversal vulnerability was identified in the pull_uma_histogram_set_via_cdp.py script due to unvalidated user-supplied filenames, which could allow arbitrary file reads. Additionally, two command-line switches in cobalt/browser/switches.h are unrelated to this PR's purpose and should be moved to a separate pull request.
cobalt/browser/switches.h
Outdated
| // Whether to request, download, and install uncompressed (rather than | ||
| // compressed) Evergreen binaries. | ||
| constexpr char kUseUncompressedUpdates[] = "use_uncompressed_updates"; | ||
|
|
||
| // Uses the QA update server to test the changes to the configuration of the | ||
| // PROD update server. | ||
| constexpr char kUseQAUpdateServer[] = "use_qa_update_server"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two switches, kUseUncompressedUpdates and kUseQAUpdateServer, appear to be unrelated to the memory metrics functionality being added in this pull request. To maintain clear and atomic commits, it's recommended to move these changes to a separate pull request that deals with update server configuration.
|
Tests look to be passing locally: |

Refer to the original PR: #8845
Implement the collection of the private memory footprint metric.
This change leverages the Chromium memory_instrumentation service
to periodically request global memory dumps and record the total
private memory footprint as a UMA histogram. This provides crucial
data for monitoring memory usage in Cobalt. A new command-line
switch is added to allow configuration of the collection interval.
Note: Local testing was also done via
python3 cobalt/tools/uma/pull_uma_histogram_set_via_cdp.py --no-manage-cobalt --output-file=uma_output.txt.Test:
out/android-x86_devel/bin/run_cobalt_unittests --gtest_filter="*CobaltMetricsServiceClientTest*"Test:
out/android-x86_devel/bin/run_cobalt_browsertests --gtest_filter="*CobaltMetricsBrowserTest*"Bug: 479261728