metricsd: Persist metrics on shutdown.
When metricsd receives a SIGTERM signal (on system shutdown for
example), save the metrics to disk before exiting.
Bug: 26184202
Test: Start metricsd. Log a metric sample. Stop metricsd. The metric is
saved to disk.
Change-Id: Ib224efa8837130393fac5d06fa80d320263cfc84
diff --git a/metricsd/uploader/upload_service.cc b/metricsd/uploader/upload_service.cc
index ab44b28..0dc59a4 100644
--- a/metricsd/uploader/upload_service.cc
+++ b/metricsd/uploader/upload_service.cc
@@ -90,6 +90,7 @@
void UploadService::OnShutdown(int* exit_code) {
metricsd_service_runner_.Stop();
+ PersistToDisk();
}
void UploadService::InitForTest(SystemProfileSetter* setter) {