Skip to content

Commit

Permalink
Retire the Tron metrics reporting for non-A/B update
Browse files Browse the repository at this point in the history
This is part of the effort to remove libmetricslogger in platform.
Remove the reporting since the status from non-A/B update is less
important to us. Plus the gmscore already has a copy of the logic
to parse the contents from last_install and report non-A/B metrics
to the clearcut log.

bug: 147776349
Test: build
Change-Id: I4fc5d58fb616edb3eb1edadf4614d3eca15c7ce1
  • Loading branch information
Tianjie Xu committed Jan 16, 2020
1 parent 1477c86 commit eb27bfe
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ cc_binary {
shared_libs: [
"libbase",
"liblog",
"libmetricslogger",
],

static_libs: [
Expand Down
18 changes: 0 additions & 18 deletions recovery-persist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@
#include <string.h>
#include <unistd.h>

#include <limits>
#include <string>

#include <android-base/file.h>
#include <android-base/logging.h>
#include <metricslogger/metrics_logger.h>
#include <private/android_logger.h> /* private pmsg functions */

#include "recovery_utils/logging.h"
Expand Down Expand Up @@ -112,20 +110,6 @@ ssize_t logsave(
return android::base::WriteStringToFile(buffer, destination.c_str());
}

// Parses the LAST_INSTALL file and reports the update metrics saved under recovery mode.
static void report_metrics_from_last_install(const std::string& file_name) {
auto metrics = ParseLastInstall(file_name);
// TODO(xunchang) report the installation result.
for (const auto& [event, value] : metrics) {
if (value > std::numeric_limits<int>::max()) {
LOG(WARNING) << event << " (" << value << ") exceeds integer max.";
} else {
LOG(INFO) << "Uploading " << value << " to " << event;
android::metricslogger::LogHistogram(event, value);
}
}
}

int main(int argc, char **argv) {

/* Is /cache a mount?, we have been delivered where we are not wanted */
Expand Down Expand Up @@ -157,7 +141,6 @@ int main(int argc, char **argv) {
if (has_cache) {
// Collects and reports the non-a/b update metrics from last_install; and removes the file
// to avoid duplicate report.
report_metrics_from_last_install(LAST_INSTALL_FILE_IN_CACHE);
if (access(LAST_INSTALL_FILE_IN_CACHE, F_OK) && unlink(LAST_INSTALL_FILE_IN_CACHE) == -1) {
PLOG(ERROR) << "Failed to unlink " << LAST_INSTALL_FILE_IN_CACHE;
}
Expand All @@ -181,7 +164,6 @@ int main(int argc, char **argv) {
// For those device without /cache, the last_install file has been copied to
// /data/misc/recovery from pmsg. Looks for the sideload history only.
if (!has_cache) {
report_metrics_from_last_install(LAST_INSTALL_FILE);
if (access(LAST_INSTALL_FILE, F_OK) && unlink(LAST_INSTALL_FILE) == -1) {
PLOG(ERROR) << "Failed to unlink " << LAST_INSTALL_FILE;
}
Expand Down

0 comments on commit eb27bfe

Please sign in to comment.