Remove libmetricslogger dependency from bootstats

These are either already migrated or are planned to be migrated to
statsd.

Bug: 147777989
Bug: 148575354
Test: compiles
Merged-In: I00b110dcf5cf4a0fb1673fe05004662b6f3327d0
Change-Id: I00b110dcf5cf4a0fb1673fe05004662b6f3327d0
This commit is contained in:
Howard Ro 2020-01-31 17:37:32 -08:00
parent 8fda5feb25
commit fe0b389190
2 changed files with 20 additions and 13 deletions

View file

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

View file

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