Add hooks for IsolatedCompilation metrics
Enhance the CompOS service to report more details on failure.
Create a new IsolatedCompilationMetrics class to handle reporting when
compilation is scheduled and when it succeeds/fails.
No metrics are logged yet - we first need to define the proto format
in atoms.proto.
Additionally, improve the handling of multiple calls to onCompletion so
only the first one does anything. (We can get binderDied() called
after success, since composd exits.)
Bug: 218525257
Test: stage an APEX, run the job, observe logs
Test: run composd_cmd, cause it to fail in various ways
Change-Id: I4f97a82ddb5c1d53d67921e1e7ecc6c61229fb76
diff --git a/compos/composd/src/odrefresh_task.rs b/compos/composd/src/odrefresh_task.rs
index 9dec1c1..e06e5fe 100644
--- a/compos/composd/src/odrefresh_task.rs
+++ b/compos/composd/src/odrefresh_task.rs
@@ -19,7 +19,8 @@
use crate::fd_server_helper::FdServerConfig;
use crate::instance_starter::CompOsInstance;
use android_system_composd::aidl::android::system::composd::{
- ICompilationTask::ICompilationTask, ICompilationTaskCallback::ICompilationTaskCallback,
+ ICompilationTask::ICompilationTask,
+ ICompilationTaskCallback::{FailureReason::FailureReason, ICompilationTaskCallback},
};
use android_system_composd::binder::{Interface, Result as BinderResult, Strong};
use anyhow::{Context, Result};
@@ -99,12 +100,15 @@
task.callback.onSuccess()
}
Ok(exit_code) => {
- error!("Unexpected odrefresh result: {:?}", exit_code);
- task.callback.onFailure()
+ let message = format!("Unexpected odrefresh result: {:?}", exit_code);
+ error!("{}", message);
+ task.callback
+ .onFailure(FailureReason::UnexpectedCompilationResult, &message)
}
Err(e) => {
- error!("Running odrefresh failed: {:?}", e);
- task.callback.onFailure()
+ let message = format!("Running odrefresh failed: {:?}", e);
+ error!("{}", message);
+ task.callback.onFailure(FailureReason::CompilationFailed, &message)
}
};
if let Err(e) = result {