remote.proto 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Copyright 2016 Prometheus Team
  2. // Licensed under the Apache License, Version 2.0 (the "License");
  3. // you may not use this file except in compliance with the License.
  4. // You may obtain a copy of the License at
  5. //
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. // NOTICE: THIS FILE HAS BEEN MODIFIED FROM THE ORIGINAL
  14. // Changes were made to use go protobuf instead of gogo protobuf.
  15. // Original code is here: https://github.com/prometheus/prometheus/blob/e4ec263bcc11493953c75d1b2e7bc78fd0463e05/prompb/remote.proto
  16. syntax = "proto3";
  17. package prometheus.v1;
  18. //option go_package = "prompb";
  19. option go_package = "github.com/certusone/wormhole/node/pkg/proto/prometheus/v1;prometheusv1";
  20. import "prometheus/v1/types.proto";
  21. //import "gogoproto/gogo.proto";
  22. message WriteRequest {
  23. repeated prometheus.v1.TimeSeries timeseries = 1 ;
  24. // Cortex uses this field to determine the source of the write request.
  25. // We reserve it to avoid any compatibility issues.
  26. reserved 2;
  27. repeated prometheus.v1.MetricMetadata metadata = 3 ;
  28. }
  29. // ReadRequest represents a remote read request.
  30. message ReadRequest {
  31. repeated Query queries = 1;
  32. enum ResponseType {
  33. // Server will return a single ReadResponse message with matched series that includes list of raw samples.
  34. // It's recommended to use streamed response types instead.
  35. //
  36. // Response headers:
  37. // Content-Type: "application/x-protobuf"
  38. // Content-Encoding: "snappy"
  39. RESPONSE_TYPE_SAMPLES_UNSPECIFIED = 0;
  40. // Server will stream a delimited ChunkedReadResponse message that
  41. // contains XOR or HISTOGRAM(!) encoded chunks for a single series.
  42. // Each message is following varint size and fixed size bigendian
  43. // uint32 for CRC32 Castagnoli checksum.
  44. //
  45. // Response headers:
  46. // Content-Type: "application/x-streamed-protobuf; proto=prometheus.ChunkedReadResponse"
  47. // Content-Encoding: ""
  48. RESPONSE_TYPE_STREAMED_XOR_CHUNKS = 1;
  49. }
  50. // accepted_response_types allows negotiating the content type of the response.
  51. //
  52. // Response types are taken from the list in the FIFO order. If no response type in `accepted_response_types` is
  53. // implemented by server, error is returned.
  54. // For request that do not contain `accepted_response_types` field the SAMPLES response type will be used.
  55. repeated ResponseType accepted_response_types = 2;
  56. }
  57. // ReadResponse is a response when response_type equals SAMPLES.
  58. message ReadResponse {
  59. // In same order as the request's queries.
  60. repeated QueryResult results = 1;
  61. }
  62. message Query {
  63. int64 start_timestamp_ms = 1;
  64. int64 end_timestamp_ms = 2;
  65. repeated prometheus.v1.LabelMatcher matchers = 3;
  66. prometheus.v1.ReadHints hints = 4;
  67. }
  68. message QueryResult {
  69. // Samples within a time series must be ordered by time.
  70. repeated prometheus.v1.TimeSeries timeseries = 1;
  71. }
  72. // ChunkedReadResponse is a response when response_type equals STREAMED_XOR_CHUNKS.
  73. // We strictly stream full series after series, optionally split by time. This means that a single frame can contain
  74. // partition of the single series, but once a new series is started to be streamed it means that no more chunks will
  75. // be sent for previous one. Series are returned sorted in the same way TSDB block are internally.
  76. message ChunkedReadResponse {
  77. repeated prometheus.v1.ChunkedSeries chunked_series = 1;
  78. // query_index represents an index of the query from ReadRequest.queries these chunks relates to.
  79. int64 query_index = 2;
  80. }