Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate initial log logic behind feature flag
This CL is essentially a reland of crrev.com/c/2753547 which removes the logic for the initial log (credits to asvitkine@). But this CL gates the changes behind the feature flag ConsolidateMetricsServiceInitialLogLogic. This CL includes a few additional changes: 1. - With the status quo logic, for initial logs, we trim right after closing the initial log. So then an initial log that is over the max size limit would not be sent. For non-initial logs, we do *not* trim after closing the log. So then logs over the max size limit would be attempted to be sent once. If that failed, we would then trim it. - With the changes in crrev.com/c/2753547, we would trim after closing every log. So then for initial logs, the logic stayed the same. But for non-initial logs, we wouldn't attempt to send them at all if they were over the max size. I think this is what was causing logs drop. - With the changes in this CL, we do not trim at all after closing a log (regardless of if it's an initial or non-initial log). So then an initial log that is over the max size will be attempted to be sent once, like non-initial logs. For non-initial logs the logic essentially stays the same. 2. In this CL, after closing a log, we call TrimAndPersistUnsentLogs(/*overwrite_in_memory_store=*/false). This way, if we crash before sending the log that we just closed, we won't lose it. But at the same time, we still give the log a chance to be sent once if it's over the max size limit. This parameter was introduced in crrev.com/c/3806465 3. Unit tests in components/metrics/metrics_service_unittest.cc are now parameterized to test the behavior with both the feature enabled and the feature disabled. Bug: 1171830 Change-Id: Ifb3b2a0a3bc22c3c6f5e92d16f9140a78f3024fc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3781383 Reviewed-by: Alexei Svitkine <asvitkine@chromium.org> Commit-Queue: Luc Nguyen <lucnguyen@google.com> Cr-Commit-Position: refs/heads/main@{#1032725}
- Loading branch information