event_log.proto 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. syntax = "proto3";
  2. package chatto.admin.v1;
  3. import "buf/validate/validate.proto";
  4. import "google/protobuf/timestamp.proto";
  5. // Filter for owner/auditor event-log inspection.
  6. message AdminEventLogFilter {
  7. // Event oneof payload type, such as MessagePostedEvent.
  8. string event_type = 1;
  9. // Actor user ID.
  10. string actor_id = 2;
  11. // Inclusive lower creation timestamp bound.
  12. google.protobuf.Timestamp created_at_from = 3;
  13. // Inclusive upper creation timestamp bound.
  14. google.protobuf.Timestamp created_at_to = 4;
  15. }
  16. // Request to list durable EVT entries newest-first.
  17. message ListEventsRequest {
  18. // Maximum entries to return. The server clamps this to its diagnostic limit.
  19. int32 limit = 1 [(buf.validate.field).int32.gte = 0];
  20. // Exclusive sequence cursor. Returned entries are older than this sequence.
  21. optional string before = 2;
  22. // Optional filter. Filtered scans inspect a bounded window per request.
  23. AdminEventLogFilter filter = 3;
  24. }
  25. // Newest-first page of durable EVT entries.
  26. message ListEventsResponse {
  27. // Event-log rows.
  28. repeated AdminEventLogEntry entries = 1;
  29. // Whether older rows may be fetched with end_cursor.
  30. bool has_older = 2;
  31. // Sequence cursor for loading older rows.
  32. optional string end_cursor = 3;
  33. // Total EVT message count reported by JetStream.
  34. int64 total_count = 4;
  35. // Number of stream sequences inspected while building this page.
  36. int32 scanned_count = 5;
  37. // Maximum number of stream sequences inspected for this page.
  38. int32 scan_limit = 6;
  39. // True when a filtered request reached scan_limit before finding a full page.
  40. bool scan_limited = 7;
  41. }
  42. // Request to list filterable event types.
  43. message ListEventTypesRequest {}
  44. // Finite snapshot of event types accepted by event-log filters.
  45. message ListEventTypesResponse {
  46. // Sorted event type names.
  47. repeated string event_types = 1;
  48. }
  49. // Request to read one durable EVT entry by stream sequence.
  50. message GetEventRequest {
  51. // Required EVT stream sequence.
  52. string sequence = 1 [(buf.validate.field).string.min_len = 1];
  53. }
  54. // Result of reading one durable EVT entry.
  55. message GetEventResponse {
  56. // Requested event-log entry.
  57. AdminEventLogEntry entry = 1;
  58. }
  59. // One durable EVT entry decoded for operator inspection.
  60. message AdminEventLogEntry {
  61. // EVT stream sequence.
  62. string sequence = 1;
  63. // NATS subject.
  64. string subject = 2;
  65. // Aggregate type parsed from the subject.
  66. string aggregate_type = 3;
  67. // Aggregate ID parsed from the subject.
  68. string aggregate_id = 4;
  69. // Event oneof payload type, or decode-error when decoding failed.
  70. string event_type = 5;
  71. // Durable event ID.
  72. string event_id = 6;
  73. // Actor user ID stored on the event.
  74. string actor_id = 7;
  75. // Event creation timestamp.
  76. google.protobuf.Timestamp created_at = 8;
  77. // Pretty-printed JSON representation of the event payload.
  78. string payload_json = 9;
  79. }
  80. // Provides server-admin audit/event-log diagnostics.
  81. service AdminEventLogService {
  82. // Lists durable EVT entries newest-first. Requires admin.view-audit.
  83. rpc ListEvents(ListEventsRequest) returns (ListEventsResponse);
  84. // Lists filterable event type names as a finite snapshot. Requires
  85. // admin.view-audit.
  86. rpc ListEventTypes(ListEventTypesRequest) returns (ListEventTypesResponse);
  87. // Reads one durable EVT entry by stream sequence. Requires admin.view-audit.
  88. // Returns NOT_FOUND when the requested sequence does not exist.
  89. rpc GetEvent(GetEventRequest) returns (GetEventResponse);
  90. }