github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/logproto/logproto.proto (about)

     1  syntax = "proto3";
     2  
     3  package logproto;
     4  
     5  import "github.com/gogo/protobuf/gogoproto/gogo.proto";
     6  import "google/protobuf/timestamp.proto";
     7  import "pkg/logqlmodel/stats/stats.proto";
     8  
     9  option go_package = "github.com/grafana/loki/pkg/logproto";
    10  
    11  service Pusher {
    12    rpc Push(PushRequest) returns (PushResponse) {}
    13  }
    14  
    15  service Querier {
    16    rpc Query(QueryRequest) returns (stream QueryResponse) {}
    17  
    18    rpc QuerySample(SampleQueryRequest) returns (stream SampleQueryResponse) {}
    19  
    20    rpc Label(LabelRequest) returns (LabelResponse) {}
    21  
    22    rpc Tail(TailRequest) returns (stream TailResponse) {}
    23  
    24    rpc Series(SeriesRequest) returns (SeriesResponse) {}
    25  
    26    rpc TailersCount(TailersCountRequest) returns (TailersCountResponse) {}
    27  
    28    rpc GetChunkIDs(GetChunkIDsRequest) returns (GetChunkIDsResponse) {}
    29  
    30    // Note: this MUST be the same as the variant defined in
    31    // indexgateway.proto on the IndexGateway service.
    32    rpc GetStats(IndexStatsRequest) returns (IndexStatsResponse) {}
    33  }
    34  
    35  service Ingester {
    36    rpc TransferChunks(stream TimeSeriesChunk) returns (TransferChunksResponse) {}
    37  }
    38  
    39  message PushRequest {
    40    repeated StreamAdapter streams = 1 [
    41      (gogoproto.jsontag) = "streams",
    42      (gogoproto.customtype) = "Stream"
    43    ];
    44  }
    45  
    46  message PushResponse {}
    47  
    48  message QueryRequest {
    49    string selector = 1;
    50    uint32 limit = 2;
    51    google.protobuf.Timestamp start = 3 [
    52      (gogoproto.stdtime) = true,
    53      (gogoproto.nullable) = false
    54    ];
    55    google.protobuf.Timestamp end = 4 [
    56      (gogoproto.stdtime) = true,
    57      (gogoproto.nullable) = false
    58    ];
    59    Direction direction = 5;
    60    reserved 6;
    61    repeated string shards = 7 [(gogoproto.jsontag) = "shards,omitempty"];
    62    repeated Delete deletes = 8;
    63  }
    64  
    65  message SampleQueryRequest {
    66    string selector = 1;
    67    google.protobuf.Timestamp start = 2 [
    68      (gogoproto.stdtime) = true,
    69      (gogoproto.nullable) = false
    70    ];
    71    google.protobuf.Timestamp end = 3 [
    72      (gogoproto.stdtime) = true,
    73      (gogoproto.nullable) = false
    74    ];
    75    repeated string shards = 4 [(gogoproto.jsontag) = "shards,omitempty"];
    76    repeated Delete deletes = 5;
    77  }
    78  
    79  message Delete {
    80    string selector = 1;
    81    int64 start = 2;
    82    int64 end = 3;
    83  }
    84  
    85  message QueryResponse {
    86    repeated StreamAdapter streams = 1 [
    87      (gogoproto.customtype) = "Stream",
    88      (gogoproto.nullable) = true
    89    ];
    90    stats.Ingester stats = 2 [(gogoproto.nullable) = false];
    91  }
    92  
    93  message SampleQueryResponse {
    94    repeated Series series = 1 [
    95      (gogoproto.customtype) = "Series",
    96      (gogoproto.nullable) = true
    97    ];
    98    stats.Ingester stats = 2 [(gogoproto.nullable) = false];
    99  }
   100  
   101  enum Direction {
   102    FORWARD = 0;
   103    BACKWARD = 1;
   104  }
   105  
   106  message LabelRequest {
   107    string name = 1;
   108    bool values = 2; // True to fetch label values, false for fetch labels names.
   109    google.protobuf.Timestamp start = 3 [
   110      (gogoproto.stdtime) = true,
   111      (gogoproto.nullable) = true
   112    ];
   113    google.protobuf.Timestamp end = 4 [
   114      (gogoproto.stdtime) = true,
   115      (gogoproto.nullable) = true
   116    ];
   117  }
   118  
   119  message LabelResponse {
   120    repeated string values = 1;
   121  }
   122  
   123  message StreamAdapter {
   124    string labels = 1 [(gogoproto.jsontag) = "labels"];
   125    repeated EntryAdapter entries = 2 [
   126      (gogoproto.nullable) = false,
   127      (gogoproto.jsontag) = "entries"
   128    ];
   129    // hash contains the original hash of the stream.
   130    uint64 hash = 3 [(gogoproto.jsontag) = "-"];
   131  }
   132  
   133  message EntryAdapter {
   134    google.protobuf.Timestamp timestamp = 1 [
   135      (gogoproto.stdtime) = true,
   136      (gogoproto.nullable) = false,
   137      (gogoproto.jsontag) = "ts"
   138    ];
   139    string line = 2 [(gogoproto.jsontag) = "line"];
   140  }
   141  
   142  message Sample {
   143    int64 timestamp = 1 [(gogoproto.jsontag) = "ts"];
   144    double value = 2 [(gogoproto.jsontag) = "value"];
   145    uint64 hash = 3 [(gogoproto.jsontag) = "hash"];
   146  }
   147  
   148  // LegacySample exists for backwards compatibility reasons and is deprecated. Do not use.
   149  message LegacySample {
   150    double value = 1;
   151    int64 timestamp_ms = 2;
   152  }
   153  
   154  message Series {
   155    string labels = 1 [(gogoproto.jsontag) = "labels"];
   156    repeated Sample samples = 2 [
   157      (gogoproto.nullable) = false,
   158      (gogoproto.jsontag) = "samples"
   159    ];
   160    uint64 streamHash = 3 [(gogoproto.jsontag) = "streamHash"];
   161  }
   162  
   163  message TailRequest {
   164    string query = 1;
   165    reserved 2;
   166    uint32 delayFor = 3;
   167    uint32 limit = 4;
   168    google.protobuf.Timestamp start = 5 [
   169      (gogoproto.stdtime) = true,
   170      (gogoproto.nullable) = false
   171    ];
   172  }
   173  
   174  message TailResponse {
   175    StreamAdapter stream = 1 [(gogoproto.customtype) = "Stream"];
   176    repeated DroppedStream droppedStreams = 2;
   177  }
   178  
   179  message SeriesRequest {
   180    google.protobuf.Timestamp start = 1 [
   181      (gogoproto.stdtime) = true,
   182      (gogoproto.nullable) = false
   183    ];
   184    google.protobuf.Timestamp end = 2 [
   185      (gogoproto.stdtime) = true,
   186      (gogoproto.nullable) = false
   187    ];
   188    repeated string groups = 3;
   189    repeated string shards = 4 [(gogoproto.jsontag) = "shards,omitempty"];
   190  }
   191  
   192  message SeriesResponse {
   193    repeated SeriesIdentifier series = 1 [(gogoproto.nullable) = false];
   194  }
   195  
   196  message SeriesIdentifier {
   197    map<string, string> labels = 1;
   198  }
   199  
   200  message DroppedStream {
   201    google.protobuf.Timestamp from = 1 [
   202      (gogoproto.stdtime) = true,
   203      (gogoproto.nullable) = false
   204    ];
   205    google.protobuf.Timestamp to = 2 [
   206      (gogoproto.stdtime) = true,
   207      (gogoproto.nullable) = false
   208    ];
   209    string labels = 3;
   210  }
   211  
   212  message TimeSeriesChunk {
   213    string from_ingester_id = 1;
   214    string user_id = 2;
   215    repeated LabelPair labels = 3;
   216    repeated Chunk chunks = 4;
   217  }
   218  
   219  message LabelPair {
   220    string name = 1;
   221    string value = 2;
   222  }
   223  
   224  // LegacyLabelPair exists for backwards compatibility reasons and is deprecated. Do not use.
   225  message LegacyLabelPair {
   226    bytes name = 1;
   227    bytes value = 2;
   228  }
   229  
   230  message Chunk {
   231    bytes data = 1;
   232  }
   233  
   234  message TransferChunksResponse {}
   235  
   236  message TailersCountRequest {}
   237  
   238  message TailersCountResponse {
   239    uint32 count = 1;
   240  }
   241  
   242  message GetChunkIDsRequest {
   243    string matchers = 1;
   244    google.protobuf.Timestamp start = 2 [
   245      (gogoproto.stdtime) = true,
   246      (gogoproto.nullable) = false
   247    ];
   248    google.protobuf.Timestamp end = 3 [
   249      (gogoproto.stdtime) = true,
   250      (gogoproto.nullable) = false
   251    ];
   252  }
   253  
   254  message GetChunkIDsResponse {
   255    repeated string chunkIDs = 1;
   256  }
   257  
   258  // ChunkRef contains the metadata to reference a Chunk.
   259  // It is embedded by the Chunk type itself and used to generate the Chunk
   260  // checksum. So it is imported to take care of the JSON representation of the
   261  // resulting Go struct.
   262  message ChunkRef {
   263    uint64 fingerprint = 1 [(gogoproto.jsontag) = "fingerprint"];
   264    string user_id = 2 [
   265      (gogoproto.customname) = "UserID",
   266      (gogoproto.jsontag) = "userID"
   267    ];
   268    int64 from = 3 [
   269      (gogoproto.jsontag) = "from",
   270      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   271      (gogoproto.nullable) = false
   272    ];
   273    int64 through = 4 [
   274      (gogoproto.jsontag) = "through",
   275      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   276      (gogoproto.nullable) = false
   277    ];
   278  
   279    // The checksum is not written to the external storage. We use crc32,
   280    // Castagnoli table. See http://www.evanjones.ca/crc32c.html.
   281    uint32 checksum = 5 [(gogoproto.jsontag) = "-"];
   282  }
   283  
   284  message LabelValuesForMetricNameRequest {
   285    string metric_name = 1;
   286    string label_name = 2;
   287    int64 from = 3 [
   288      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   289      (gogoproto.nullable) = false
   290    ];
   291    int64 through = 4 [
   292      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   293      (gogoproto.nullable) = false
   294    ];
   295    string matchers = 5;
   296  }
   297  
   298  message LabelNamesForMetricNameRequest {
   299    string metric_name = 1;
   300    int64 from = 2 [
   301      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   302      (gogoproto.nullable) = false
   303    ];
   304    int64 through = 3 [
   305      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   306      (gogoproto.nullable) = false
   307    ];
   308  }
   309  
   310  message GetChunkRefRequest {
   311    int64 from = 1 [
   312      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   313      (gogoproto.nullable) = false
   314    ];
   315    int64 through = 2 [
   316      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   317      (gogoproto.nullable) = false
   318    ];
   319    string matchers = 3;
   320  }
   321  
   322  message GetChunkRefResponse {
   323    repeated ChunkRef refs = 1;
   324  }
   325  
   326  message GetSeriesRequest {
   327    int64 from = 1 [
   328      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   329      (gogoproto.nullable) = false
   330    ];
   331    int64 through = 2 [
   332      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   333      (gogoproto.nullable) = false
   334    ];
   335    string matchers = 3;
   336  }
   337  
   338  message GetSeriesResponse {
   339    repeated IndexSeries series = 1 [(gogoproto.nullable) = false];
   340  }
   341  
   342  // Series calls to the TSDB Index
   343  message IndexSeries {
   344    repeated LabelPair labels = 1 [
   345      (gogoproto.nullable) = false,
   346      (gogoproto.customtype) = "LabelAdapter"
   347    ];
   348  }
   349  
   350  message QueryIndexResponse {
   351    string QueryKey = 1;
   352    repeated Row rows = 2;
   353  }
   354  
   355  message Row {
   356    bytes rangeValue = 1;
   357    bytes value = 2;
   358  }
   359  
   360  message QueryIndexRequest {
   361    repeated IndexQuery Queries = 1;
   362  }
   363  
   364  message IndexQuery {
   365    string tableName = 1;
   366    string hashValue = 2;
   367    bytes rangeValuePrefix = 3;
   368    bytes rangeValueStart = 4;
   369    bytes valueEqual = 5;
   370  }
   371  
   372  message IndexStatsRequest {
   373    int64 from = 1 [
   374      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   375      (gogoproto.nullable) = false
   376    ];
   377    int64 through = 2 [
   378      (gogoproto.customtype) = "github.com/prometheus/common/model.Time",
   379      (gogoproto.nullable) = false
   380    ];
   381    string matchers = 3;
   382    // TODO(owen-d): add shards to grpc calls so we don't have
   383    // to extract via labels
   384  }
   385  
   386  message IndexStatsResponse {
   387    uint64 streams = 1 [(gogoproto.jsontag) = "streams"];
   388    uint64 chunks = 2 [(gogoproto.jsontag) = "chunks"];
   389    uint64 bytes = 3 [(gogoproto.jsontag) = "bytes"];
   390    uint64 entries = 4 [(gogoproto.jsontag) = "entries"];
   391  }