diagnostics.proto 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. syntax = "proto3";
  2. package chatto.admin.v1;
  3. // Request to read owner-only server diagnostics.
  4. message GetSystemInfoRequest {}
  5. // Owner-only operational diagnostics for the Chatto server.
  6. message GetSystemInfoResponse {
  7. // Broker connection, account, and JetStream state.
  8. AdminSystemInfo system_info = 1;
  9. // Event-sourced projection health and memory estimates.
  10. repeated AdminProjectionState projections = 2;
  11. }
  12. // Broker and application diagnostics shown on the server admin system page.
  13. message AdminSystemInfo {
  14. // Current NATS server connection metadata.
  15. AdminConnectionInfo connection = 1;
  16. // JetStream account limits and usage.
  17. AdminAccountInfo account = 2;
  18. // JetStream stream and consumer diagnostics.
  19. AdminNatsStats nats = 3;
  20. // Aggregate Chatto object counts.
  21. AdminServerStats stats = 4;
  22. }
  23. // Current NATS server connection metadata.
  24. message AdminConnectionInfo {
  25. // Whether Chatto is currently connected to NATS.
  26. bool connected = 1;
  27. // Connected NATS server ID.
  28. string server_id = 2;
  29. // Connected NATS server name.
  30. string server_name = 3;
  31. // Connected NATS server version.
  32. string version = 4;
  33. // Maximum payload accepted by the connected NATS server.
  34. int64 max_payload = 5;
  35. // Round-trip latency to the connected NATS server.
  36. string rtt = 6;
  37. }
  38. // JetStream account limits and usage.
  39. message AdminAccountInfo {
  40. // Maximum memory storage in bytes. Values less than or equal to zero mean unlimited.
  41. int64 memory = 1;
  42. // Used memory storage in bytes.
  43. int64 memory_used = 2;
  44. // Maximum file storage in bytes. Values less than or equal to zero mean unlimited.
  45. int64 storage = 3;
  46. // Used file storage in bytes.
  47. int64 storage_used = 4;
  48. // Maximum number of streams. Values less than or equal to zero mean unlimited.
  49. int32 streams = 5;
  50. // Current number of streams.
  51. int32 streams_used = 6;
  52. // Maximum number of consumers. Values less than or equal to zero mean unlimited.
  53. int32 consumers = 7;
  54. // Current number of consumers.
  55. int32 consumers_used = 8;
  56. }
  57. // Aggregate Chatto object counts.
  58. message AdminServerStats {
  59. // Registered user count.
  60. int32 user_count = 1;
  61. // Channel room count.
  62. int32 channel_room_count = 2;
  63. // Direct-message room count.
  64. int32 dm_room_count = 3;
  65. }
  66. // JetStream stream and consumer diagnostics.
  67. message AdminNatsStats {
  68. // Total messages stored across all streams.
  69. int64 total_messages = 1;
  70. // Total bytes stored across all streams.
  71. int64 total_bytes = 2;
  72. // Total pending messages across all consumers.
  73. int64 total_consumer_pending = 3;
  74. // Total messages currently waiting for acknowledgement.
  75. int32 total_ack_pending = 4;
  76. // Streams sorted by name.
  77. repeated AdminNatsStreamInfo streams = 5;
  78. // Consumers sorted by stream and name.
  79. repeated AdminNatsConsumerInfo consumers = 6;
  80. }
  81. // JetStream stream state.
  82. message AdminNatsStreamInfo {
  83. // Stream name.
  84. string name = 1;
  85. // Stream description.
  86. string description = 2;
  87. // Subjects stored in the stream.
  88. repeated string subjects = 3;
  89. // Storage backend name.
  90. string storage = 4;
  91. // Number of messages in the stream.
  92. int64 messages = 5;
  93. // Number of bytes in the stream.
  94. int64 bytes = 6;
  95. // First stream sequence.
  96. string first_sequence = 7;
  97. // Last stream sequence.
  98. string last_sequence = 8;
  99. // Number of stream consumers.
  100. int32 consumer_count = 9;
  101. // Configured stream replica count.
  102. int32 replicas = 10;
  103. // Current cluster leader, when reported by NATS.
  104. string cluster_leader = 11;
  105. }
  106. // JetStream consumer state.
  107. message AdminNatsConsumerInfo {
  108. // Stream that owns the consumer.
  109. string stream = 1;
  110. // Consumer name.
  111. string name = 2;
  112. // Durable name, when the consumer is durable.
  113. string durable = 3;
  114. // Single filter subject, when configured.
  115. string filter_subject = 4;
  116. // Multiple filter subjects, when configured.
  117. repeated string filter_subjects = 5;
  118. // NATS acknowledgement policy.
  119. string ack_policy = 6;
  120. // Whether this is a pull consumer.
  121. bool pull_based = 7;
  122. // Whether this push consumer has an active subscription.
  123. bool push_bound = 8;
  124. // Pending messages for this consumer.
  125. int64 pending = 9;
  126. // Messages waiting for acknowledgement.
  127. int32 ack_pending = 10;
  128. // Redelivered message count.
  129. int32 redelivered = 11;
  130. // Pull requests waiting for messages.
  131. int32 waiting = 12;
  132. // Delivered consumer sequence.
  133. string delivered_consumer_sequence = 13;
  134. // Delivered stream sequence.
  135. string delivered_stream_sequence = 14;
  136. // Acknowledgement floor consumer sequence.
  137. string ack_floor_consumer_sequence = 15;
  138. // Acknowledgement floor stream sequence.
  139. string ack_floor_stream_sequence = 16;
  140. }
  141. // Event-sourced projection health and memory estimates.
  142. message AdminProjectionState {
  143. // Stable projection key.
  144. string key = 1;
  145. // Display name.
  146. string name = 2;
  147. // EVT subjects consumed by this projection.
  148. repeated string subjects = 3;
  149. // Whether the projection projector is running.
  150. bool started = 4;
  151. // Startup duration in seconds, set after startup completes.
  152. optional double startup_duration_seconds = 5;
  153. // Last event sequence applied by the projection.
  154. string last_applied_sequence = 6;
  155. // Target sequence among the projection's matching subjects.
  156. string matching_stream_sequence = 7;
  157. // Current last sequence of the EVT stream.
  158. string stream_last_sequence = 8;
  159. // Matching-subject lag between target and applied sequence.
  160. int64 lag = 9;
  161. // Whether the projection failed.
  162. bool failed = 10;
  163. // Sequence that failed, when failed is true.
  164. string failed_sequence = 11;
  165. // Failure message, when failed is true.
  166. string failure = 12;
  167. // Estimated number of entries held by the projection.
  168. int64 entry_count = 13;
  169. // Estimated memory used by the projection in bytes.
  170. int64 estimated_bytes = 14;
  171. // Estimated average memory per entry in bytes.
  172. int64 average_entry_bytes = 15;
  173. // Projection-specific diagnostic metrics.
  174. repeated AdminProjectionMetric metrics = 16;
  175. }
  176. // Projection-specific diagnostic metric.
  177. message AdminProjectionMetric {
  178. // Metric name.
  179. string name = 1;
  180. // Metric value.
  181. int64 value = 2;
  182. // Estimated memory represented by this metric in bytes.
  183. int64 bytes = 3;
  184. }
  185. // Provides server diagnostics for the admin system page.
  186. service AdminDiagnosticsService {
  187. // Returns broker, JetStream, and projection diagnostics. Requires the
  188. // server owner role.
  189. rpc GetSystemInfo(GetSystemInfoRequest) returns (GetSystemInfoResponse);
  190. }