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