Skip to content

Commit

Permalink
Added hints support to store protobuf
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Pracucci <marco@pracucci.com>
  • Loading branch information
pracucci committed Apr 22, 2020
1 parent 45a6bc4 commit 7c7d39e
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 66 deletions.
241 changes: 182 additions & 59 deletions pkg/store/storepb/rpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions pkg/store/storepb/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package thanos;
import "types.proto";
import "gogoproto/gogo.proto";
import "prompb/types.proto";
import "google/protobuf/any.proto";

option go_package = "storepb";

Expand Down Expand Up @@ -114,6 +115,11 @@ message SeriesRequest {

// skip_chunks controls whether sending chunks or not in series responses.
bool skip_chunks = 8;

// hints_enabled controls whether sending hints or not in the series responses. Hints
// are store implementation specific and used to carry information about how the series
// have been queried.
bool hints_enabled = 9;
}

enum Aggr {
Expand All @@ -132,6 +138,13 @@ message SeriesResponse {
/// warning is considered an information piece in place of series for warning purposes.
/// It is used to warn query customer about suspicious cases or partial response (if enabled).
string warning = 2;

/// hints in an opaque data structure that can be used to carry information about how the series
/// have been queried. The content of this field and whether it's supported depends on the
/// implementation of a specific store. It's also implementation specific if it's allowed that
/// multiple SeriesResponse frames contain hints for a single Series() request and how should they
/// be handled in such case (ie. merged vs keep the first/last one).
google.protobuf.Any hints = 3;
}
}

Expand Down
11 changes: 4 additions & 7 deletions scripts/genproto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ DIRS="pkg/store/storepb pkg/store/storepb/prompb"
echo "generating code"
for dir in ${DIRS}; do
pushd ${dir}
${PROTOC_BIN} --gogofast_out=plugins=grpc:. \
${PROTOC_BIN} --gogofast_out=\
Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\
Mprompb/types.proto=github.com/thanos-io/thanos/pkg/store/storepb/prompb,\
plugins=grpc:. \
-I=. \
-I="${GOGOPROTO_PATH}" \
*.proto

sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go
sed -i.bak -E 's/import _ \"google\/protobuf\"//g' *.pb.go
# Hacky hack.
sed -i.bak -E 's/prompb \"prompb\"/prompb \"github.com\/thanos-io\/thanos\/pkg\/store\/storepb\/prompb\"/g' *.pb.go

rm -f *.bak
${GOIMPORTS_BIN} -w *.pb.go
popd
done

0 comments on commit 7c7d39e

Please sign in to comment.