Remove libmetricslogger dependency from bootstats

Now that bootstats metrics are migrated to statsd in ag/10082348 and in
ag/9957072, we should not need these anymore.(subject to boottime team)

Bug: 147777989
Bug: 148575354
Test: compiles
Change-Id: I00b110dcf5cf4a0fb1673fe05004662b6f3327d0
This commit is contained in:
Howard Ro 2020-01-31 14:55:55 -08:00
parent 6b7985aa8d
commit e03c360b4d
3 changed files with 22 additions and 14 deletions

View file

@ -30,8 +30,8 @@ cc_defaults {
"libbase", "libbase",
"libcutils", "libcutils",
"liblog", "liblog",
"libmetricslogger",
], ],
static_libs: ["libgtest_prod"],
} }
// bootstat static library // bootstat static library

View file

@ -69,4 +69,4 @@ class BootEventRecordStore {
DISALLOW_COPY_AND_ASSIGN(BootEventRecordStore); DISALLOW_COPY_AND_ASSIGN(BootEventRecordStore);
}; };
#endif // BOOT_EVENT_RECORD_STORE_H_ #endif // BOOT_EVENT_RECORD_STORE_H_

View file

@ -44,7 +44,6 @@
#include <android/log.h> #include <android/log.h>
#include <cutils/android_reboot.h> #include <cutils/android_reboot.h>
#include <cutils/properties.h> #include <cutils/properties.h>
#include <metricslogger/metrics_logger.h>
#include <statslog.h> #include <statslog.h>
#include "boot_event_record_store.h" #include "boot_event_record_store.h"
@ -57,9 +56,10 @@ void LogBootEvents() {
BootEventRecordStore boot_event_store; BootEventRecordStore boot_event_store;
auto events = boot_event_store.GetAllBootEvents(); auto events = boot_event_store.GetAllBootEvents();
for (auto i = events.cbegin(); i != events.cend(); ++i) { // TODO(b/148575354): Replace with statsd.
android::metricslogger::LogHistogram(i->first, i->second); // for (auto i = events.cbegin(); i != events.cend(); ++i) {
} // android::metricslogger::LogHistogram(i->first, i->second);
// }
} }
// Records the named boot |event| to the record store. If |value| is non-empty // Records the named boot |event| to the record store. If |value| is non-empty
@ -1212,13 +1212,17 @@ void RecordBootReason() {
const auto reason = android::base::GetProperty(bootloader_reboot_reason_property, ""); const auto reason = android::base::GetProperty(bootloader_reboot_reason_property, "");
if (reason.empty()) { if (reason.empty()) {
// TODO(b/148575354): Replace with statsd.
// Log an empty boot reason value as '<EMPTY>' to ensure the value is intentional // Log an empty boot reason value as '<EMPTY>' to ensure the value is intentional
// (and not corruption anywhere else in the reporting pipeline). // (and not corruption anywhere else in the reporting pipeline).
android::metricslogger::LogMultiAction(android::metricslogger::ACTION_BOOT, // android::metricslogger::LogMultiAction(android::metricslogger::ACTION_BOOT,
android::metricslogger::FIELD_PLATFORM_REASON, "<EMPTY>"); // android::metricslogger::FIELD_PLATFORM_REASON,
// "<EMPTY>");
} else { } else {
android::metricslogger::LogMultiAction(android::metricslogger::ACTION_BOOT, // TODO(b/148575354): Replace with statsd.
android::metricslogger::FIELD_PLATFORM_REASON, reason); // android::metricslogger::LogMultiAction(android::metricslogger::ACTION_BOOT,
// android::metricslogger::FIELD_PLATFORM_REASON,
// reason);
} }
// Log the raw bootloader_boot_reason property value. // Log the raw bootloader_boot_reason property value.
@ -1246,9 +1250,11 @@ void RecordFactoryReset() {
time_t current_time_utc = time(nullptr); time_t current_time_utc = time(nullptr);
if (current_time_utc < 0) { if (current_time_utc < 0) {
// TODO(b/148575354): Replace with statsd.
// UMA does not display negative values in buckets, so convert to positive. // UMA does not display negative values in buckets, so convert to positive.
android::metricslogger::LogHistogram("factory_reset_current_time_failure", // Logging via BootEventRecordStore.
std::abs(current_time_utc)); // android::metricslogger::LogHistogram("factory_reset_current_time_failure",
// std::abs(current_time_utc));
// Logging via BootEventRecordStore to see if using android::metricslogger::LogHistogram // Logging via BootEventRecordStore to see if using android::metricslogger::LogHistogram
// is losing records somehow. // is losing records somehow.
@ -1256,7 +1262,8 @@ void RecordFactoryReset() {
std::abs(current_time_utc)); std::abs(current_time_utc));
return; return;
} else { } else {
android::metricslogger::LogHistogram("factory_reset_current_time", current_time_utc); // TODO(b/148575354): Replace with statsd.
// android::metricslogger::LogHistogram("factory_reset_current_time", current_time_utc);
// Logging via BootEventRecordStore to see if using android::metricslogger::LogHistogram // Logging via BootEventRecordStore to see if using android::metricslogger::LogHistogram
// is losing records somehow. // is losing records somehow.
@ -1276,7 +1283,8 @@ void RecordFactoryReset() {
// Calculate and record the difference in time between now and the // Calculate and record the difference in time between now and the
// factory_reset time. // factory_reset time.
time_t factory_reset_utc = record.second; time_t factory_reset_utc = record.second;
android::metricslogger::LogHistogram("factory_reset_record_value", factory_reset_utc); // TODO(b/148575354): Replace with statsd.
// android::metricslogger::LogHistogram("factory_reset_record_value", factory_reset_utc);
// Logging via BootEventRecordStore to see if using android::metricslogger::LogHistogram // Logging via BootEventRecordStore to see if using android::metricslogger::LogHistogram
// is losing records somehow. // is losing records somehow.