2017-05-10 02:44:13 -07:00
|
|
|
// Copyright 2016 Prometheus Team
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
syntax = "proto3";
|
2017-08-01 03:12:34 -07:00
|
|
|
package prometheus;
|
2017-05-10 02:44:13 -07:00
|
|
|
|
2017-07-12 14:06:35 -07:00
|
|
|
option go_package = "prompb";
|
2017-05-10 02:44:13 -07:00
|
|
|
|
2017-07-12 14:06:35 -07:00
|
|
|
import "types.proto";
|
2019-01-15 11:13:39 -08:00
|
|
|
import "gogoproto/gogo.proto";
|
2017-05-10 02:44:13 -07:00
|
|
|
|
|
|
|
message WriteRequest {
|
2019-01-15 11:13:39 -08:00
|
|
|
repeated prometheus.TimeSeries timeseries = 1 [(gogoproto.nullable) = false];
|
2020-11-19 07:23:03 -08:00
|
|
|
// Cortex uses this field to determine the source of the write request.
|
|
|
|
// We reserve it to avoid any compatibility issues.
|
|
|
|
reserved 2;
|
|
|
|
repeated prometheus.MetricMetadata metadata = 3 [(gogoproto.nullable) = false];
|
2017-05-10 02:44:13 -07:00
|
|
|
}
|
|
|
|
|
2023-11-06 15:38:11 -08:00
|
|
|
message MinimizedWriteRequest {
|
|
|
|
repeated MinimizedTimeSeries timeseries = 1 [(gogoproto.nullable) = false];
|
|
|
|
// Cortex uses this field to determine the source of the write request.
|
|
|
|
// We reserve it to avoid any compatibility issues.
|
|
|
|
reserved 2;
|
|
|
|
// Metadata (3) has moved to be part of the TimeSeries type
|
|
|
|
reserved 3;
|
|
|
|
// The symbols table. All symbols are concatenated strings. To read the symbols table, it's required
|
|
|
|
// to know the offset:length range of the actual symbol to read from this string.
|
|
|
|
string symbols = 4;
|
|
|
|
}
|
2023-02-20 12:42:35 -08:00
|
|
|
|
2023-11-15 10:04:38 -08:00
|
|
|
message MinimizedWriteRequestLen {
|
|
|
|
repeated MinimizedTimeSeriesLen timeseries = 1 [(gogoproto.nullable) = false];
|
|
|
|
// Cortex uses this field to determine the source of the write request.
|
|
|
|
// We reserve it to avoid any compatibility issues.
|
|
|
|
reserved 2;
|
|
|
|
// Metadata (3) has moved to be part of the TimeSeries type
|
|
|
|
reserved 3;
|
|
|
|
// The symbols table. All symbols are concatenated strings prepended with a varint of their length.
|
|
|
|
// To read the symbols table, it's required to know the offset of the actual symbol to read from this string.
|
|
|
|
bytes symbols = 4;
|
|
|
|
}
|
|
|
|
|
2019-08-19 13:16:10 -07:00
|
|
|
// ReadRequest represents a remote read request.
|
2017-05-10 02:44:13 -07:00
|
|
|
message ReadRequest {
|
|
|
|
repeated Query queries = 1;
|
2019-08-19 13:16:10 -07:00
|
|
|
|
|
|
|
enum ResponseType {
|
|
|
|
// Server will return a single ReadResponse message with matched series that includes list of raw samples.
|
|
|
|
// It's recommended to use streamed response types instead.
|
|
|
|
//
|
|
|
|
// Response headers:
|
|
|
|
// Content-Type: "application/x-protobuf"
|
|
|
|
// Content-Encoding: "snappy"
|
|
|
|
SAMPLES = 0;
|
2022-06-15 08:20:27 -07:00
|
|
|
// Server will stream a delimited ChunkedReadResponse message that
|
|
|
|
// contains XOR or HISTOGRAM(!) encoded chunks for a single series.
|
|
|
|
// Each message is following varint size and fixed size bigendian
|
|
|
|
// uint32 for CRC32 Castagnoli checksum.
|
2019-08-19 13:16:10 -07:00
|
|
|
//
|
|
|
|
// Response headers:
|
|
|
|
// Content-Type: "application/x-streamed-protobuf; proto=prometheus.ChunkedReadResponse"
|
|
|
|
// Content-Encoding: ""
|
|
|
|
STREAMED_XOR_CHUNKS = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// accepted_response_types allows negotiating the content type of the response.
|
|
|
|
//
|
|
|
|
// Response types are taken from the list in the FIFO order. If no response type in `accepted_response_types` is
|
|
|
|
// implemented by server, error is returned.
|
|
|
|
// For request that do not contain `accepted_response_types` field the SAMPLES response type will be used.
|
|
|
|
repeated ResponseType accepted_response_types = 2;
|
2017-05-10 02:44:13 -07:00
|
|
|
}
|
|
|
|
|
2019-08-19 13:16:10 -07:00
|
|
|
// ReadResponse is a response when response_type equals SAMPLES.
|
2017-05-10 02:44:13 -07:00
|
|
|
message ReadResponse {
|
|
|
|
// In same order as the request's queries.
|
|
|
|
repeated QueryResult results = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message Query {
|
|
|
|
int64 start_timestamp_ms = 1;
|
|
|
|
int64 end_timestamp_ms = 2;
|
2017-07-12 14:06:35 -07:00
|
|
|
repeated prometheus.LabelMatcher matchers = 3;
|
2018-05-08 01:48:13 -07:00
|
|
|
prometheus.ReadHints hints = 4;
|
2017-05-10 02:44:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
message QueryResult {
|
2018-01-17 04:31:30 -08:00
|
|
|
// Samples within a time series must be ordered by time.
|
2017-07-12 14:06:35 -07:00
|
|
|
repeated prometheus.TimeSeries timeseries = 1;
|
2017-05-10 02:44:13 -07:00
|
|
|
}
|
2019-08-19 13:16:10 -07:00
|
|
|
|
|
|
|
// ChunkedReadResponse is a response when response_type equals STREAMED_XOR_CHUNKS.
|
|
|
|
// We strictly stream full series after series, optionally split by time. This means that a single frame can contain
|
|
|
|
// partition of the single series, but once a new series is started to be streamed it means that no more chunks will
|
2020-01-17 03:21:44 -08:00
|
|
|
// be sent for previous one. Series are returned sorted in the same way TSDB block are internally.
|
2019-08-19 13:16:10 -07:00
|
|
|
message ChunkedReadResponse {
|
|
|
|
repeated prometheus.ChunkedSeries chunked_series = 1;
|
|
|
|
|
|
|
|
// query_index represents an index of the query from ReadRequest.queries these chunks relates to.
|
|
|
|
int64 query_index = 2;
|
|
|
|
}
|