github.com/thanos-io/thanos@v0.32.5/pkg/store/storepb/rpc.proto (about)

     1  // Copyright (c) The Thanos Authors.
     2  // Licensed under the Apache License 2.0.
     3  
     4  syntax = "proto3";
     5  package thanos;
     6  
     7  import "store/storepb/types.proto";
     8  import "gogoproto/gogo.proto";
     9  import "store/storepb/prompb/types.proto";
    10  import "store/labelpb/types.proto";
    11  import "google/protobuf/any.proto";
    12  
    13  option go_package = "storepb";
    14  
    15  option (gogoproto.sizer_all) = true;
    16  option (gogoproto.marshaler_all) = true;
    17  option (gogoproto.unmarshaler_all) = true;
    18  option (gogoproto.goproto_getters_all) = false;
    19  
    20  // Do not generate XXX fields to reduce memory footprint and opening a door
    21  // for zero-copy casts to/from prometheus data types.
    22  option (gogoproto.goproto_unkeyed_all) = false;
    23  option (gogoproto.goproto_unrecognized_all) = false;
    24  option (gogoproto.goproto_sizecache_all) = false;
    25  
    26  /// Store represents API against instance that stores XOR encoded values with label set metadata (e.g Prometheus metrics).
    27  service Store {
    28    /// Info returns meta information about a store e.g labels that makes that store unique as well as time range that is
    29    /// available.
    30    /// Deprecated. Use `thanos.info` instead.
    31    rpc Info(InfoRequest) returns (InfoResponse);
    32  
    33    /// Series streams each Series (Labels and chunk/downsampling chunk) for given label matchers and time range.
    34    ///
    35    /// Series should strictly stream full series after series, optionally split by time. This means that a single frame can contain
    36    /// partition of the single series, but once a new series is started to be streamed it means that no more data will
    37    /// be sent for previous one.
    38    /// Series has to be sorted.
    39    ///
    40    /// There is no requirements on chunk sorting, however it is recommended to have chunk sorted by chunk min time.
    41    /// This heavily optimizes the resource usage on Querier / Federated Queries.
    42    rpc Series(SeriesRequest) returns (stream SeriesResponse);
    43  
    44    /// LabelNames returns all label names constrained by the given matchers.
    45    rpc LabelNames(LabelNamesRequest) returns (LabelNamesResponse);
    46  
    47    /// LabelValues returns all label values for given label name.
    48    rpc LabelValues(LabelValuesRequest) returns (LabelValuesResponse);
    49  }
    50  
    51  /// WriteableStore represents API against instance that stores XOR encoded values with label set metadata (e.g Prometheus metrics).
    52  service WriteableStore {
    53    // WriteRequest allows you to write metrics to this store via remote write
    54    rpc RemoteWrite(WriteRequest) returns (WriteResponse) {}
    55  }
    56  
    57  message WriteResponse {
    58  }
    59  
    60  message WriteRequest {
    61    repeated prometheus_copy.TimeSeries timeseries = 1 [(gogoproto.nullable) = false];
    62    string tenant = 2;
    63    int64 replica = 3;
    64  }
    65  
    66  // Deprecated. Use `thanos.info` instead.
    67  message InfoRequest {}
    68  
    69  // Deprecated. Use `thanos.info` instead.
    70  enum StoreType {
    71    UNKNOWN = 0;
    72    QUERY = 1;
    73    RULE = 2;
    74    SIDECAR = 3;
    75    STORE = 4;
    76    RECEIVE = 5;
    77    // DEBUG represents some debug StoreAPI components e.g. thanos tools store-api-serve.
    78    DEBUG = 6;
    79  }
    80  
    81  // Deprecated. Use `thanos.info` instead.
    82  message InfoResponse {
    83    // Deprecated. Use label_sets instead.
    84    repeated Label labels = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/thanos-io/thanos/pkg/store/labelpb.ZLabel"];
    85    int64 min_time = 2;
    86    int64 max_time = 3;
    87    StoreType storeType = 4;
    88    // label_sets is an unsorted list of `ZLabelSet`s.
    89    repeated ZLabelSet label_sets = 5 [(gogoproto.nullable) = false];
    90  }
    91  
    92  message SeriesRequest {
    93    int64 min_time = 1;
    94    int64 max_time = 2;
    95    repeated LabelMatcher matchers = 3 [(gogoproto.nullable) = false];
    96  
    97    int64 max_resolution_window = 4;
    98    repeated Aggr aggregates = 5;
    99  
   100    // Deprecated. Use partial_response_strategy instead.
   101    bool partial_response_disabled = 6;
   102  
   103    // TODO(bwplotka): Move Thanos components to use strategy instead. Including QueryAPI.
   104    PartialResponseStrategy partial_response_strategy = 7;
   105  
   106    // skip_chunks controls whether sending chunks or not in series responses.
   107    bool skip_chunks = 8;
   108  
   109    // hints is an opaque data structure that can be used to carry additional information.
   110    // The content of this field and whether it's supported depends on the
   111    // implementation of a specific store.
   112    google.protobuf.Any hints = 9;
   113  
   114    // Query step size in milliseconds.
   115    // Deprecated: Use query_hints instead.
   116    int64 step = 10;
   117  
   118    // Range vector selector range in milliseconds.
   119    // Deprecated: Use query_hints instead.
   120    int64 range = 11;
   121  
   122    // query_hints are the hints coming from the PromQL engine when
   123    // requesting a storage.SeriesSet for a given expression.
   124    // As hints name suggest using those is best effort.
   125    QueryHints query_hints = 12;
   126  
   127    // shard_info is used by the querier to request a specific
   128    // shard of blocks instead of entire blocks.
   129    ShardInfo shard_info = 13;
   130  
   131    // without_replica_labels are replica labels which have to be excluded from series set results.
   132    // The sorting requirement has to be preserved, so series should be sorted without those labels.
   133    // If the requested label is NOT a replica label (labels that identify replication group) it should be not affected by
   134    // this setting (label should be included in sorting and response).
   135    // It is the server responsibility to detect and track what is replica label and what is not.
   136    // This allows faster deduplication by clients.
   137    // NOTE(bwplotka): thanos.info.store.supports_without_replica_labels field has to return true to let client knows
   138    // server supports it.
   139    repeated string without_replica_labels = 14;
   140  }
   141  
   142  // QueryHints represents hints from PromQL that might help to
   143  // pre-aggregate or prepare series for faster use by clients.
   144  // Analogous to storage.SelectHints plus additional info.
   145  // As "hints" name suggests all of the items here are best effort.
   146  message QueryHints {
   147    // Query step size in milliseconds.
   148    int64 step_millis = 1;
   149  
   150    // The surrounding function or aggregation.
   151    Func func = 2;
   152  
   153    // The grouping expression
   154    Grouping grouping = 4;
   155  
   156    // Range vector selector.
   157    Range range = 5;
   158  }
   159  
   160  // ShardInfo are the parameters used to shard series in Stores.
   161  message ShardInfo {
   162    // The index of the current shard.
   163    int64 shard_index = 1;
   164  
   165    // The total number of shards.
   166    int64 total_shards = 2;
   167  
   168    // Group by or without labels.
   169    bool by = 3;
   170  
   171    // Labels on which to partition series.
   172    repeated string labels = 4;
   173  }
   174  
   175  message Func {
   176    // The function or aggregation name
   177    string name = 1;
   178  }
   179  
   180  message Grouping {
   181    // Indicate whether it is without or by.
   182    bool by = 1;
   183  
   184    // List of label names used in the grouping.
   185    repeated string labels = 3;
   186  }
   187  
   188  message Range {
   189    int64 millis = 1;
   190  }
   191  
   192  enum Aggr {
   193    RAW = 0;
   194    COUNT = 1;
   195    SUM = 2;
   196    MIN = 3;
   197    MAX = 4;
   198    COUNTER = 5;
   199  }
   200  
   201  message SeriesResponse {
   202    oneof result {
   203      /// series contains 1 response series. The series labels are sorted by name.
   204      Series series = 1;
   205  
   206      /// warning is considered an information piece in place of series for warning purposes.
   207      /// It is used to warn store API user about suspicious cases or partial response (if enabled).
   208      string warning = 2;
   209  
   210      /// hints is an opaque data structure that can be used to carry additional information from
   211      /// the store. The content of this field and whether it's supported depends on the
   212      /// implementation of a specific store. It's also implementation specific if it's allowed that
   213      /// multiple SeriesResponse frames contain hints for a single Series() request and how should they
   214      /// be handled in such case (ie. merged vs keep the first/last one).
   215      google.protobuf.Any hints = 3;
   216    }
   217  }
   218  
   219  message LabelNamesRequest {
   220    bool partial_response_disabled = 1;
   221  
   222    // TODO(bwplotka): Move Thanos components to use strategy instead. Including QueryAPI.
   223    PartialResponseStrategy partial_response_strategy = 2;
   224  
   225    int64 start = 3;
   226  
   227    int64 end = 4;
   228  
   229    // hints is an opaque data structure that can be used to carry additional information.
   230    // The content of this field and whether it's supported depends on the
   231    // implementation of a specific store.
   232    google.protobuf.Any hints = 5;
   233  
   234    repeated LabelMatcher matchers = 6 [(gogoproto.nullable) = false];
   235  }
   236  
   237  message LabelNamesResponse {
   238    repeated string names = 1;
   239    repeated string warnings = 2;
   240  
   241    /// hints is an opaque data structure that can be used to carry additional information from
   242    /// the store. The content of this field and whether it's supported depends on the
   243    /// implementation of a specific store.
   244    google.protobuf.Any hints = 3;
   245  }
   246  
   247  message LabelValuesRequest {
   248    string label = 1;
   249  
   250    bool partial_response_disabled = 2;
   251  
   252    // TODO(bwplotka): Move Thanos components to use strategy instead. Including QueryAPI.
   253    PartialResponseStrategy partial_response_strategy = 3;
   254  
   255    int64 start = 4;
   256  
   257    int64 end = 5;
   258  
   259    // hints is an opaque data structure that can be used to carry additional information.
   260    // The content of this field and whether it's supported depends on the
   261    // implementation of a specific store.
   262    google.protobuf.Any hints = 6;
   263  
   264    repeated LabelMatcher matchers = 7 [(gogoproto.nullable) = false];
   265  }
   266  
   267  message LabelValuesResponse {
   268    repeated string values = 1;
   269    repeated string warnings = 2;
   270  
   271    /// hints is an opaque data structure that can be used to carry additional information from
   272    /// the store. The content of this field and whether it's supported depends on the
   273    /// implementation of a specific store.
   274    google.protobuf.Any hints = 3;
   275  }