controller.proto 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. // Copyright 2019 Google LLC.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. syntax = "proto3";
  16. package google.devtools.clouddebugger.v2;
  17. import "google/api/annotations.proto";
  18. import "google/api/client.proto";
  19. import "google/api/field_behavior.proto";
  20. import "google/devtools/clouddebugger/v2/data.proto";
  21. option csharp_namespace = "Google.Cloud.Debugger.V2";
  22. option go_package = "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2;clouddebugger";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "ControllerProto";
  25. option java_package = "com.google.devtools.clouddebugger.v2";
  26. option php_namespace = "Google\\Cloud\\Debugger\\V2";
  27. option ruby_package = "Google::Cloud::Debugger::V2";
  28. // The Controller service provides the API for orchestrating a collection of
  29. // debugger agents to perform debugging tasks. These agents are each attached
  30. // to a process of an application which may include one or more replicas.
  31. //
  32. // The debugger agents register with the Controller to identify the application
  33. // being debugged, the Debuggee. All agents that register with the same data,
  34. // represent the same Debuggee, and are assigned the same `debuggee_id`.
  35. //
  36. // The debugger agents call the Controller to retrieve the list of active
  37. // Breakpoints. Agents with the same `debuggee_id` get the same breakpoints
  38. // list. An agent that can fulfill the breakpoint request updates the
  39. // Controller with the breakpoint result. The controller selects the first
  40. // result received and discards the rest of the results.
  41. // Agents that poll again for active breakpoints will no longer have
  42. // the completed breakpoint in the list and should remove that breakpoint from
  43. // their attached process.
  44. //
  45. // The Controller service does not provide a way to retrieve the results of
  46. // a completed breakpoint. This functionality is available using the Debugger
  47. // service.
  48. service Controller2 {
  49. option (google.api.default_host) = "clouddebugger.googleapis.com";
  50. option (google.api.oauth_scopes) =
  51. "https://www.googleapis.com/auth/cloud-platform,"
  52. "https://www.googleapis.com/auth/cloud_debugger";
  53. // Registers the debuggee with the controller service.
  54. //
  55. // All agents attached to the same application must call this method with
  56. // exactly the same request content to get back the same stable `debuggee_id`.
  57. // Agents should call this method again whenever `google.rpc.Code.NOT_FOUND`
  58. // is returned from any controller method.
  59. //
  60. // This protocol allows the controller service to disable debuggees, recover
  61. // from data loss, or change the `debuggee_id` format. Agents must handle
  62. // `debuggee_id` value changing upon re-registration.
  63. rpc RegisterDebuggee(RegisterDebuggeeRequest) returns (RegisterDebuggeeResponse) {
  64. option (google.api.http) = {
  65. post: "/v2/controller/debuggees/register"
  66. body: "*"
  67. };
  68. option (google.api.method_signature) = "debuggee";
  69. }
  70. // Returns the list of all active breakpoints for the debuggee.
  71. //
  72. // The breakpoint specification (`location`, `condition`, and `expressions`
  73. // fields) is semantically immutable, although the field values may
  74. // change. For example, an agent may update the location line number
  75. // to reflect the actual line where the breakpoint was set, but this
  76. // doesn't change the breakpoint semantics.
  77. //
  78. // This means that an agent does not need to check if a breakpoint has changed
  79. // when it encounters the same breakpoint on a successive call.
  80. // Moreover, an agent should remember the breakpoints that are completed
  81. // until the controller removes them from the active list to avoid
  82. // setting those breakpoints again.
  83. rpc ListActiveBreakpoints(ListActiveBreakpointsRequest) returns (ListActiveBreakpointsResponse) {
  84. option (google.api.http) = {
  85. get: "/v2/controller/debuggees/{debuggee_id}/breakpoints"
  86. };
  87. option (google.api.method_signature) = "debuggee_id";
  88. }
  89. // Updates the breakpoint state or mutable fields.
  90. // The entire Breakpoint message must be sent back to the controller service.
  91. //
  92. // Updates to active breakpoint fields are only allowed if the new value
  93. // does not change the breakpoint specification. Updates to the `location`,
  94. // `condition` and `expressions` fields should not alter the breakpoint
  95. // semantics. These may only make changes such as canonicalizing a value
  96. // or snapping the location to the correct line of code.
  97. rpc UpdateActiveBreakpoint(UpdateActiveBreakpointRequest) returns (UpdateActiveBreakpointResponse) {
  98. option (google.api.http) = {
  99. put: "/v2/controller/debuggees/{debuggee_id}/breakpoints/{breakpoint.id}"
  100. body: "*"
  101. };
  102. option (google.api.method_signature) = "debuggee_id,breakpoint";
  103. }
  104. }
  105. // Request to register a debuggee.
  106. message RegisterDebuggeeRequest {
  107. // Required. Debuggee information to register.
  108. // The fields `project`, `uniquifier`, `description` and `agent_version`
  109. // of the debuggee must be set.
  110. Debuggee debuggee = 1 [(google.api.field_behavior) = REQUIRED];
  111. }
  112. // Response for registering a debuggee.
  113. message RegisterDebuggeeResponse {
  114. // Debuggee resource.
  115. // The field `id` is guaranteed to be set (in addition to the echoed fields).
  116. // If the field `is_disabled` is set to `true`, the agent should disable
  117. // itself by removing all breakpoints and detaching from the application.
  118. // It should however continue to poll `RegisterDebuggee` until reenabled.
  119. Debuggee debuggee = 1;
  120. }
  121. // Request to list active breakpoints.
  122. message ListActiveBreakpointsRequest {
  123. // Required. Identifies the debuggee.
  124. string debuggee_id = 1 [(google.api.field_behavior) = REQUIRED];
  125. // A token that, if specified, blocks the method call until the list
  126. // of active breakpoints has changed, or a server-selected timeout has
  127. // expired. The value should be set from the `next_wait_token` field in
  128. // the last response. The initial value should be set to `"init"`.
  129. string wait_token = 2;
  130. // If set to `true` (recommended), returns `google.rpc.Code.OK` status and
  131. // sets the `wait_expired` response field to `true` when the server-selected
  132. // timeout has expired.
  133. //
  134. // If set to `false` (deprecated), returns `google.rpc.Code.ABORTED` status
  135. // when the server-selected timeout has expired.
  136. bool success_on_timeout = 3;
  137. }
  138. // Response for listing active breakpoints.
  139. message ListActiveBreakpointsResponse {
  140. // List of all active breakpoints.
  141. // The fields `id` and `location` are guaranteed to be set on each breakpoint.
  142. repeated Breakpoint breakpoints = 1;
  143. // A token that can be used in the next method call to block until
  144. // the list of breakpoints changes.
  145. string next_wait_token = 2;
  146. // If set to `true`, indicates that there is no change to the
  147. // list of active breakpoints and the server-selected timeout has expired.
  148. // The `breakpoints` field would be empty and should be ignored.
  149. bool wait_expired = 3;
  150. }
  151. // Request to update an active breakpoint.
  152. message UpdateActiveBreakpointRequest {
  153. // Required. Identifies the debuggee being debugged.
  154. string debuggee_id = 1 [(google.api.field_behavior) = REQUIRED];
  155. // Required. Updated breakpoint information.
  156. // The field `id` must be set.
  157. // The agent must echo all Breakpoint specification fields in the update.
  158. Breakpoint breakpoint = 2 [(google.api.field_behavior) = REQUIRED];
  159. }
  160. // Response for updating an active breakpoint.
  161. // The message is defined to allow future extensions.
  162. message UpdateActiveBreakpointResponse {
  163. }