2017-05-10 09:44:13 +00: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 10:12:34 +00:00
|
|
|
package prometheus;
|
2017-05-10 09:44:13 +00:00
|
|
|
|
2017-07-12 21:06:35 +00:00
|
|
|
option go_package = "prompb";
|
2017-05-10 09:44:13 +00:00
|
|
|
|
2017-07-12 21:06:35 +00:00
|
|
|
import "types.proto";
|
2019-01-15 19:13:39 +00:00
|
|
|
import "gogoproto/gogo.proto";
|
2017-05-10 09:44:13 +00:00
|
|
|
|
|
|
|
message WriteRequest {
|
2019-01-15 19:13:39 +00:00
|
|
|
repeated prometheus.TimeSeries timeseries = 1 [(gogoproto.nullable) = false];
|
2017-05-10 09:44:13 +00:00
|
|
|
}
|
|
|
|
|
2019-08-19 20:16:10 +00:00
|
|
|
// ReadRequest represents a remote read request.
|
2017-05-10 09:44:13 +00:00
|
|
|
message ReadRequest {
|
|
|
|
repeated Query queries = 1;
|
2019-08-19 20:16:10 +00: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;
|
|
|
|
// Server will stream a delimited ChunkedReadResponse message that contains XOR encoded chunks for a single series.
|
|
|
|
// Each message is following varint size and fixed size bigendian uint32 for CRC32 Castagnoli checksum.
|
|
|
|
//
|
|
|
|
// 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 09:44:13 +00:00
|
|
|
}
|
|
|
|
|
2019-08-19 20:16:10 +00:00
|
|
|
// ReadResponse is a response when response_type equals SAMPLES.
|
2017-05-10 09:44:13 +00: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 21:06:35 +00:00
|
|
|
repeated prometheus.LabelMatcher matchers = 3;
|
2018-05-08 08:48:13 +00:00
|
|
|
prometheus.ReadHints hints = 4;
|
2017-05-10 09:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message QueryResult {
|
2018-01-17 12:31:30 +00:00
|
|
|
// Samples within a time series must be ordered by time.
|
2017-07-12 21:06:35 +00:00
|
|
|
repeated prometheus.TimeSeries timeseries = 1;
|
2017-05-10 09:44:13 +00:00
|
|
|
}
|
2019-08-19 20:16:10 +00: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
|
|
|
|
// be sent for previous one.
|
|
|
|
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;
|
|
|
|
}
|