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