1/* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18 19package perfetto.protos; 20 21import "protos/perfetto/trace_processor/trace_processor.proto"; 22import "protos/perfetto/cloud_trace_processor/common.proto"; 23 24// RPC interface for a CloudTraceProcessor Orchestrator. 25// 26// Each CloudTraceProcessor instance has a single Orchestrator which is 27// responsible for receiving requests for loading and querying traces from 28// clients and shards these requests among a set of "Workers". 29service CloudTraceProcessorOrchestrator { 30 // Creates a TracePool with the specified arguments. 31 // 32 // A TracePool is a logical group of traces which can be addressed with a 33 // single id. 34 // 35 // Pools can be "shared" or "dedicated": 36 // a) a shared pool has the trace processor instances backing the pool shared 37 // among a group of users. This implicitly means that the pools are 38 // "stateless" (i.e. do not preserve trace processor state between RPCs) as 39 // the state of one user should not interfere with the state of another. 40 // b) a dedicated pool belongs to a single user and can only be accessed 41 // by that user. These pools are "stateful" i.e. preserve trace processor 42 // state between RPCs. 43 rpc TracePoolCreate(TracePoolCreateArgs) returns (TracePoolCreateResponse); 44 45 // Changes the set of traces associated with the specified TracePool. 46 // 47 // If this operation completes successfully, any future requests to this pool 48 // shard will refer to this set of traces. 49 rpc TracePoolSetTraces(TracePoolSetTracesArgs) 50 returns (TracePoolSetTracesResponse); 51 52 // Executes a SQL query on the specified TracePool and returns a stream 53 // with each element being the response for executing the query on the 54 // associated trace. 55 // 56 // Note that each trace can return >1 result due to chunking of protos at the 57 // TraceProcessor::QueryResult level. 58 rpc TracePoolQuery(TracePoolQueryArgs) 59 returns (stream TracePoolQueryResponse); 60 61 // Destroys the TracePool with the specified id. 62 // 63 // Any future requests to this pool will return an error. However, the 64 // same pool id (if a named pool) can be used to create a new pool. 65 rpc TracePoolDestroy(TracePoolDestroyArgs) returns (TracePoolDestroyResponse); 66} 67 68// Request/Response for Orchestrator::TracePoolCreate. 69message TracePoolCreateArgs { 70 optional TracePoolType pool_type = 1; 71 72 // If |pool_type| == SHARED, the name which should be refer to the pool. This 73 // name will form part of |pool_id|. 74 optional string shared_pool_name = 2; 75} 76message TracePoolCreateResponse { 77 // The id of the pool which should be used to reference the pool in all future 78 // RPCs. For shared pools, this id is expected to be a stable transformation 79 // of |shared_pool_name|. 80 optional string pool_id = 1; 81} 82 83// Request/Response for Orchestrator::TracePoolSetTraces. 84message TracePoolSetTracesArgs { 85 optional string pool_id = 1; 86 87 // The list of traces which should be associated with this pool. The existing 88 // loaded trace list will be diffed against this list. Traces not present in 89 // this list and loaded will be unloaded while traces present in this list 90 // and unloaded will be loaded. 91 repeated string traces = 2; 92} 93message TracePoolSetTracesResponse {} 94 95// Request/Response for Orchestrator::TracePoolQuery. 96message TracePoolQueryArgs { 97 optional string pool_id = 1; 98 optional string sql_query = 2; 99} 100message TracePoolQueryResponse { 101 optional string trace = 1; 102 optional QueryResult result = 2; 103} 104 105// Request/Response for Orchestrator::TracePoolDestroy. 106message TracePoolDestroyArgs { 107 optional string pool_id = 1; 108} 109message TracePoolDestroyResponse {} 110