github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/scheduler/schedulerpb/scheduler.proto (about) 1 syntax = "proto3"; 2 3 package schedulerpb; 4 5 option go_package = "schedulerpb"; 6 7 import "github.com/gogo/protobuf/gogoproto/gogo.proto"; 8 import "github.com/weaveworks/common/httpgrpc/httpgrpc.proto"; 9 10 option (gogoproto.marshaler_all) = true; 11 option (gogoproto.unmarshaler_all) = true; 12 13 // Scheduler interface exposed to Queriers. 14 service SchedulerForQuerier { 15 // After calling this method, both Querier and Scheduler enter a loop, in which querier waits for 16 // "SchedulerToQuerier" messages containing HTTP requests and processes them. After processing the request, 17 // querier signals that it is ready to accept another one by sending empty QuerierToScheduler message. 18 // 19 // Long-running loop is used to detect broken connection between scheduler and querier. This is important 20 // for scheduler to keep a list of connected queriers up-to-date. 21 rpc QuerierLoop(stream QuerierToScheduler) returns (stream SchedulerToQuerier) { }; 22 23 // The querier notifies the query-scheduler that it started a graceful shutdown. 24 rpc NotifyQuerierShutdown(NotifyQuerierShutdownRequest) returns (NotifyQuerierShutdownResponse); 25 } 26 27 // Querier reports its own clientID when it connects, so that scheduler knows how many *different* queriers are connected. 28 // To signal that querier is ready to accept another request, querier sends empty message. 29 message QuerierToScheduler { 30 string querierID = 1; 31 } 32 33 message SchedulerToQuerier { 34 // Query ID as reported by frontend. When querier sends the response back to frontend (using frontendAddress), 35 // it identifies the query by using this ID. 36 uint64 queryID = 1; 37 httpgrpc.HTTPRequest httpRequest = 2; 38 39 // Where should querier send HTTP Response to (using FrontendForQuerier interface). 40 string frontendAddress = 3; 41 42 // User who initiated the request. Needed to send reply back to frontend. 43 string userID = 4; 44 45 // Whether query statistics tracking should be enabled. The response will include 46 // statistics only when this option is enabled. 47 bool statsEnabled = 5; 48 } 49 50 // Scheduler interface exposed to Frontend. Frontend can enqueue and cancel requests. 51 service SchedulerForFrontend { 52 // After calling this method, both Frontend and Scheduler enter a loop. Frontend will keep sending ENQUEUE and 53 // CANCEL requests, and scheduler is expected to process them. Scheduler returns one response for each request. 54 // 55 // Long-running loop is used to detect broken connection between frontend and scheduler. This is important for both 56 // parties... if connection breaks, frontend can cancel (and possibly retry on different scheduler) all pending 57 // requests sent to this scheduler, while scheduler can cancel queued requests from given frontend. 58 rpc FrontendLoop(stream FrontendToScheduler) returns (stream SchedulerToFrontend) { }; 59 } 60 61 enum FrontendToSchedulerType { 62 INIT = 0; 63 ENQUEUE = 1; 64 CANCEL = 2; 65 } 66 67 message FrontendToScheduler { 68 FrontendToSchedulerType type = 1; 69 70 // Used by INIT message. Will be put into all requests passed to querier. 71 string frontendAddress = 2; 72 73 // Used by ENQUEUE and CANCEL. 74 // Each frontend manages its own queryIDs. Different frontends may use same set of query IDs. 75 uint64 queryID = 3; 76 77 // Following are used by ENQUEUE only. 78 string userID = 4; 79 httpgrpc.HTTPRequest httpRequest = 5; 80 bool statsEnabled = 6; 81 } 82 83 enum SchedulerToFrontendStatus { 84 OK = 0; 85 TOO_MANY_REQUESTS_PER_TENANT = 1; 86 ERROR = 2; 87 SHUTTING_DOWN = 3; 88 } 89 90 message SchedulerToFrontend { 91 SchedulerToFrontendStatus status = 1; 92 string error = 2; 93 } 94 95 message NotifyQuerierShutdownRequest { 96 string querierID = 1; 97 } 98 99 message NotifyQuerierShutdownResponse {}