diagnostics.proto 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. syntax = "proto3";
  2. package chatto.admin.v1;
  3. import "google/protobuf/timestamp.proto";
  4. // Request to read owner-only server diagnostics.
  5. message GetSystemInfoRequest {}
  6. // Owner-only operational diagnostics for the Chatto server.
  7. message GetSystemInfoResponse {
  8. // Broker connection, account, and JetStream state.
  9. AdminSystemInfo system_info = 1;
  10. // Event-sourced projection health and memory estimates.
  11. repeated AdminProjectionState projections = 2;
  12. // Recoverable physical deletion worker health.
  13. AdminAssetCleanupStatus asset_cleanup = 3;
  14. }
  15. // Current health of recoverable message-owned asset deletion.
  16. message AdminAssetCleanupStatus {
  17. // Operator-facing worker state derived from lease and heartbeat state.
  18. AdminAssetCleanupHealth health = 1;
  19. // Deletion effects currently waiting for a successful retry.
  20. int64 pending_count = 2;
  21. // Creation time of the oldest pending deletion, when known.
  22. google.protobuf.Timestamp oldest_pending_at = 3;
  23. // Whether the elected worker is currently running a cleanup pass.
  24. bool pass_in_progress = 4;
  25. // Completion time of the most recent pass.
  26. google.protobuf.Timestamp last_pass_at = 5;
  27. // Completion time of the most recent fully successful pass.
  28. google.protobuf.Timestamp last_successful_pass_at = 6;
  29. // Time of the latest elected-worker heartbeat.
  30. google.protobuf.Timestamp updated_at = 7;
  31. // Whether the most recent completed pass had one or more failures.
  32. bool last_pass_failed = 8;
  33. // Global EVT sequence through which deletion facts were inspected.
  34. string last_inspected_sequence = 9;
  35. // Current latest global EVT sequence matching asset deletion facts.
  36. string latest_deletion_sequence = 10;
  37. }
  38. // Operator-facing state for the elected asset cleanup worker.
  39. enum AdminAssetCleanupHealth {
  40. ADMIN_ASSET_CLEANUP_HEALTH_UNSPECIFIED = 0;
  41. ADMIN_ASSET_CLEANUP_HEALTH_INACTIVE = 1;
  42. ADMIN_ASSET_CLEANUP_HEALTH_INITIALIZING = 2;
  43. ADMIN_ASSET_CLEANUP_HEALTH_HEALTHY = 3;
  44. ADMIN_ASSET_CLEANUP_HEALTH_RETRYING = 4;
  45. ADMIN_ASSET_CLEANUP_HEALTH_STALLED = 5;
  46. // Cleanup diagnostics could not be read; other system diagnostics remain valid.
  47. ADMIN_ASSET_CLEANUP_HEALTH_UNAVAILABLE = 6;
  48. }
  49. // Broker and application diagnostics shown on the server admin system page.
  50. message AdminSystemInfo {
  51. // Current NATS server connection metadata.
  52. AdminConnectionInfo connection = 1;
  53. // JetStream account limits and usage.
  54. AdminAccountInfo account = 2;
  55. // JetStream stream and consumer diagnostics.
  56. AdminNatsStats nats = 3;
  57. // Aggregate Chatto object counts.
  58. AdminServerStats stats = 4;
  59. }
  60. // Current NATS server connection metadata.
  61. message AdminConnectionInfo {
  62. // Whether Chatto is currently connected to NATS.
  63. bool connected = 1;
  64. // Connected NATS server ID.
  65. string server_id = 2;
  66. // Connected NATS server name.
  67. string server_name = 3;
  68. // Connected NATS server version.
  69. string version = 4;
  70. // Maximum payload accepted by the connected NATS server.
  71. int64 max_payload = 5;
  72. // Round-trip latency to the connected NATS server.
  73. string rtt = 6;
  74. }
  75. // JetStream account limits and usage.
  76. message AdminAccountInfo {
  77. // Maximum memory storage in bytes. Values less than or equal to zero mean unlimited.
  78. int64 memory = 1;
  79. // Used memory storage in bytes.
  80. int64 memory_used = 2;
  81. // Maximum file storage in bytes. Values less than or equal to zero mean unlimited.
  82. int64 storage = 3;
  83. // Used file storage in bytes.
  84. int64 storage_used = 4;
  85. // Maximum number of streams. Values less than or equal to zero mean unlimited.
  86. int32 streams = 5;
  87. // Current number of streams.
  88. int32 streams_used = 6;
  89. // Maximum number of consumers. Values less than or equal to zero mean unlimited.
  90. int32 consumers = 7;
  91. // Current number of consumers.
  92. int32 consumers_used = 8;
  93. }
  94. // Aggregate Chatto object counts.
  95. message AdminServerStats {
  96. // Registered user count.
  97. int32 user_count = 1;
  98. // Channel room count.
  99. int32 channel_room_count = 2;
  100. // Direct-message room count.
  101. int32 dm_room_count = 3;
  102. }
  103. // JetStream stream and consumer diagnostics.
  104. message AdminNatsStats {
  105. // Total messages stored across all streams.
  106. int64 total_messages = 1;
  107. // Total bytes stored across all streams.
  108. int64 total_bytes = 2;
  109. // Total pending messages across all consumers.
  110. int64 total_consumer_pending = 3;
  111. // Total messages currently waiting for acknowledgement.
  112. int32 total_ack_pending = 4;
  113. // Streams sorted by name.
  114. repeated AdminNatsStreamInfo streams = 5;
  115. // Consumers sorted by stream and name.
  116. repeated AdminNatsConsumerInfo consumers = 6;
  117. }
  118. // JetStream stream state.
  119. message AdminNatsStreamInfo {
  120. // Stream name.
  121. string name = 1;
  122. // Stream description.
  123. string description = 2;
  124. // Subjects stored in the stream.
  125. repeated string subjects = 3;
  126. // Storage backend name.
  127. string storage = 4;
  128. // Number of messages in the stream.
  129. int64 messages = 5;
  130. // Number of bytes in the stream.
  131. int64 bytes = 6;
  132. // First stream sequence.
  133. string first_sequence = 7;
  134. // Last stream sequence.
  135. string last_sequence = 8;
  136. // Number of stream consumers.
  137. int32 consumer_count = 9;
  138. // Configured stream replica count.
  139. int32 replicas = 10;
  140. // Current cluster leader, when reported by NATS.
  141. string cluster_leader = 11;
  142. }
  143. // JetStream consumer state.
  144. message AdminNatsConsumerInfo {
  145. // Stream that owns the consumer.
  146. string stream = 1;
  147. // Consumer name.
  148. string name = 2;
  149. // Durable name, when the consumer is durable.
  150. string durable = 3;
  151. // Single filter subject, when configured.
  152. string filter_subject = 4;
  153. // Multiple filter subjects, when configured.
  154. repeated string filter_subjects = 5;
  155. // NATS acknowledgement policy.
  156. string ack_policy = 6;
  157. // Whether this is a pull consumer.
  158. bool pull_based = 7;
  159. // Whether this push consumer has an active subscription.
  160. bool push_bound = 8;
  161. // Pending messages for this consumer.
  162. int64 pending = 9;
  163. // Messages waiting for acknowledgement.
  164. int32 ack_pending = 10;
  165. // Redelivered message count.
  166. int32 redelivered = 11;
  167. // Pull requests waiting for messages.
  168. int32 waiting = 12;
  169. // Delivered consumer sequence.
  170. string delivered_consumer_sequence = 13;
  171. // Delivered stream sequence.
  172. string delivered_stream_sequence = 14;
  173. // Acknowledgement floor consumer sequence.
  174. string ack_floor_consumer_sequence = 15;
  175. // Acknowledgement floor stream sequence.
  176. string ack_floor_stream_sequence = 16;
  177. }
  178. // Event-sourced projection health and memory estimates.
  179. message AdminProjectionState {
  180. // Stable projection key.
  181. string key = 1;
  182. // Display name.
  183. string name = 2;
  184. // EVT subjects consumed by this projection.
  185. repeated string subjects = 3;
  186. // Whether the projection projector is running.
  187. bool started = 4;
  188. // Startup duration in seconds, set after startup completes.
  189. optional double startup_duration_seconds = 5;
  190. // Last event sequence applied by the projection.
  191. string last_applied_sequence = 6;
  192. // Target sequence among the projection's matching subjects.
  193. string matching_stream_sequence = 7;
  194. // Current last sequence of the EVT stream.
  195. string stream_last_sequence = 8;
  196. // Matching-subject lag between target and applied sequence.
  197. int64 lag = 9;
  198. // Whether the projection failed.
  199. bool failed = 10;
  200. // Sequence that failed, when failed is true.
  201. string failed_sequence = 11;
  202. // Failure message, when failed is true.
  203. string failure = 12;
  204. // Estimated number of entries held by the projection.
  205. int64 entry_count = 13;
  206. // Estimated memory used by the projection in bytes.
  207. int64 estimated_bytes = 14;
  208. // Estimated average memory per entry in bytes.
  209. int64 average_entry_bytes = 15;
  210. // Projection-specific diagnostic metrics.
  211. repeated AdminProjectionMetric metrics = 16;
  212. }
  213. // Projection-specific diagnostic metric.
  214. message AdminProjectionMetric {
  215. // Metric name.
  216. string name = 1;
  217. // Metric value.
  218. int64 value = 2;
  219. // Estimated memory represented by this metric in bytes.
  220. int64 bytes = 3;
  221. }
  222. // Provides server diagnostics for the admin system page.
  223. service AdminDiagnosticsService {
  224. // Returns broker, JetStream, and projection diagnostics. Requires the
  225. // server owner role.
  226. rpc GetSystemInfo(GetSystemInfoRequest) returns (GetSystemInfoResponse);
  227. }