Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11986e82 authored by Zhuoyao Zhang's avatar Zhuoyao Zhang
Browse files

Add the protobuf defintion to store edit event logs

Test: make edit_event_proto
bug: 365617369
Change-Id: Icffb9a281331cd9f6270487b8a7e74fc94dac008
parent d28da5cf
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -20,6 +20,16 @@ package {
    default_team: "trendy_team_adte",
}

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",
+58 −0
Original line number Diff line number Diff line
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;
  }
}