Add the protobuf defintion to store edit event logs
Test: make edit_event_proto
bug: 365617369
Change-Id: Icffb9a281331cd9f6270487b8a7e74fc94dac008
diff --git a/tools/edit_monitor/Android.bp b/tools/edit_monitor/Android.bp
index b939633..08ca155 100644
--- a/tools/edit_monitor/Android.bp
+++ b/tools/edit_monitor/Android.bp
@@ -21,6 +21,16 @@
}
python_library_host {
+ name: "edit_event_proto",
+ srcs: [
+ "proto/edit_event.proto",
+ ],
+ proto: {
+ canonical_path_from_root: false,
+ },
+}
+
+python_library_host {
name: "edit_monitor_lib",
pkg_path: "edit_monitor",
srcs: [
diff --git a/tools/edit_monitor/proto/edit_event.proto b/tools/edit_monitor/proto/edit_event.proto
new file mode 100644
index 0000000..b3630bc
--- /dev/null
+++ b/tools/edit_monitor/proto/edit_event.proto
@@ -0,0 +1,58 @@
+syntax = "proto3";
+
+package tools.asuite.edit_monitor;
+
+message EditEvent {
+ enum EditType {
+ UNSUPPORTED_TYPE = 0;
+ CREATE = 1;
+ MODIFY = 2;
+ DELETE = 3;
+ MOVE = 4;
+ }
+
+ enum ErrorType {
+ UNKNOWN_ERROR = 0;
+ FAILED_TO_START_EDIT_MONITOR = 1;
+ FAILED_TO_STOP_EDIT_MONITOR = 2;
+ FAILED_TO_REBOOT_EDIT_MONITOR = 3;
+ KILLED_DUE_TO_EXCEEDED_RESOURCE_USAGE = 4;
+ FORCE_CLEANUP = 5;
+ }
+
+ // Event that logs a single edit
+ message SingleEditEvent {
+ // Full path of the file that edited.
+ string file_path = 1;
+ // Type of the edit.
+ EditType edit_type = 2;
+ }
+
+ // Event that logs aggregated info for a set of edits.
+ message AggregatedEditEvent {
+ int32 num_edits = 1;
+ }
+
+ // Event that logs errors happened in the edit monitor.
+ message EditMonitorErrorEvent {
+ ErrorType error_type = 1;
+ string error_msg = 2;
+ string stack_trace = 3;
+ }
+
+ // ------------------------
+ // FIELDS FOR EditEvent
+ // ------------------------
+ // Internal user name.
+ string user_name = 1;
+ // The root of Android source.
+ string source_root = 2;
+ // Name of the host workstation.
+ string host_name = 3;
+
+ oneof event {
+ SingleEditEvent single_edit_event = 4;
+ AggregatedEditEvent aggregated_edit_event = 5;
+ EditMonitorErrorEvent edit_monitor_error_event = 6;
+ }
+}