github.com/thanos-io/thanos@v0.32.5/pkg/store/storepb/prompb/remote.proto (about) 1 // Copyright (c) The Thanos Authors. 2 // Licensed under the Apache License 2.0. 3 4 // Copyright 2016 Prometheus Team 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 17 syntax = "proto3"; 18 package prometheus_copy; 19 20 option go_package = "prompb"; 21 22 import "store/storepb/prompb/types.proto"; 23 import "gogoproto/gogo.proto"; 24 25 // Do not generate XXX fields to reduce memory footprint and opening a door 26 // for zero-copy casts to/from prometheus data types. 27 option (gogoproto.goproto_unkeyed_all) = false; 28 option (gogoproto.goproto_unrecognized_all) = false; 29 option (gogoproto.goproto_sizecache_all) = false; 30 31 message WriteRequest { 32 repeated TimeSeries timeseries = 1 [(gogoproto.nullable) = false]; 33 // Cortex uses this field to determine the source of the write request. 34 // We reserve it to avoid any compatibility issues. 35 reserved 2; 36 repeated MetricMetadata metadata = 3 [(gogoproto.nullable) = false]; 37 } 38 39 // ReadRequest represents a remote read request. 40 message ReadRequest { 41 repeated Query queries = 1; 42 43 enum ResponseType { 44 // Server will return a single ReadResponse message with matched series that includes list of raw samples. 45 // It's recommended to use streamed response types instead. 46 // 47 // Response headers: 48 // Content-Type: "application/x-protobuf" 49 // Content-Encoding: "snappy" 50 SAMPLES = 0; 51 // Server will stream a delimited ChunkedReadResponse message that contains XOR encoded chunks for a single series. 52 // Each message is following varint size and fixed size bigendian uint32 for CRC32 Castagnoli checksum. 53 // 54 // Response headers: 55 // Content-Type: "application/x-streamed-protobuf; proto=prometheus.ChunkedReadResponse" 56 // Content-Encoding: "" 57 STREAMED_XOR_CHUNKS = 1; 58 } 59 60 // accepted_response_types allows negotiating the content type of the response. 61 // 62 // Response types are taken from the list in the FIFO order. If no response type in `accepted_response_types` is 63 // implemented by server, error is returned. 64 // For request that do not contain `accepted_response_types` field the SAMPLES response type will be used. 65 repeated ResponseType accepted_response_types = 2; 66 } 67 68 // ReadResponse is a response when response_type equals SAMPLES. 69 message ReadResponse { 70 // In same order as the request's queries. 71 repeated QueryResult results = 1; 72 } 73 74 message Query { 75 int64 start_timestamp_ms = 1; 76 int64 end_timestamp_ms = 2; 77 repeated LabelMatcher matchers = 3; 78 ReadHints hints = 4; 79 } 80 81 message QueryResult { 82 // Samples within a time series must be ordered by time. 83 repeated TimeSeries timeseries = 1; 84 } 85 86 // ChunkedReadResponse is a response when response_type equals STREAMED_XOR_CHUNKS. 87 // We strictly stream full series after series, optionally split by time. This means that a single frame can contain 88 // partition of the single series, but once a new series is started to be streamed it means that no more chunks will 89 // be sent for previous one. 90 message ChunkedReadResponse { 91 repeated ChunkedSeries chunked_series = 1; 92 93 // query_index represents an index of the query from ReadRequest.queries these chunks relates to. 94 int64 query_index = 2; 95 }