diff options
author | Tej Singh <singhtejinder@google.com> | 2020-04-14 16:23:30 -0700 |
---|---|---|
committer | Tej Singh <singhtejinder@google.com> | 2020-04-21 15:31:14 -0700 |
commit | e678cb753ad589edfec0b713ec49b44aa76fbf40 (patch) | |
tree | 51922348dae91d9aa1f12eeed99a178d96abd701 /cmds/statsd/src/metrics/MetricsManager.cpp | |
parent | 769f35fc0fedc21730a76608ad94050a6c6eb533 (diff) |
Split buckets on boot complete
Also clean up a bit of code on splitting on app upgrades
Piggy-backed off the app upgrade tests, adding parameterized tests to
also test boot complete event.
Refactored some value metric test code to increase code reuse and
assertions.
Fixed a broken value metric test that had assertions commented out.
Refactored NamedLatch into MultiConditionTrigger to avoid creating a
thread before necessary.
Test: atest statsd_test
Test: push a simple test config, reboot, wait, get data. Made sure
the bucket was split
Bug: 144099206
Bug: 154511974
Change-Id: I73858b5db08e8cda762bd8091b30da8738d1fd88
Diffstat (limited to 'cmds/statsd/src/metrics/MetricsManager.cpp')
-rw-r--r-- | cmds/statsd/src/metrics/MetricsManager.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/cmds/statsd/src/metrics/MetricsManager.cpp b/cmds/statsd/src/metrics/MetricsManager.cpp index d832ed86580d..bcca1fd9fdc9 100644 --- a/cmds/statsd/src/metrics/MetricsManager.cpp +++ b/cmds/statsd/src/metrics/MetricsManager.cpp @@ -231,8 +231,8 @@ bool MetricsManager::isConfigValid() const { void MetricsManager::notifyAppUpgrade(const int64_t& eventTimeNs, const string& apk, const int uid, const int64_t version) { // Inform all metric producers. - for (auto it : mAllMetricProducers) { - it->notifyAppUpgrade(eventTimeNs, apk, uid, version); + for (const auto& it : mAllMetricProducers) { + it->notifyAppUpgrade(eventTimeNs); } // check if we care this package if (std::find(mAllowedPkg.begin(), mAllowedPkg.end(), apk) != mAllowedPkg.end()) { @@ -252,8 +252,8 @@ void MetricsManager::notifyAppUpgrade(const int64_t& eventTimeNs, const string& void MetricsManager::notifyAppRemoved(const int64_t& eventTimeNs, const string& apk, const int uid) { // Inform all metric producers. - for (auto it : mAllMetricProducers) { - it->notifyAppRemoved(eventTimeNs, apk, uid); + for (const auto& it : mAllMetricProducers) { + it->notifyAppRemoved(eventTimeNs); } // check if we care this package if (std::find(mAllowedPkg.begin(), mAllowedPkg.end(), apk) != mAllowedPkg.end()) { @@ -282,6 +282,13 @@ void MetricsManager::onUidMapReceived(const int64_t& eventTimeNs) { initLogSourceWhiteList(); } +void MetricsManager::onStatsdInitCompleted(const int64_t& eventTimeNs) { + // Inform all metric producers. + for (const auto& it : mAllMetricProducers) { + it->onStatsdInitCompleted(eventTimeNs); + } +} + void MetricsManager::init() { for (const auto& producer : mAllMetricProducers) { producer->prepareFirstBucket(); |