Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added hints support to store protobuf #2502

Merged
merged 5 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ We use *breaking* word for marking changes that are not backward compatible (rel

- [#2501](https://github.com/thanos-io/thanos/pull/2501) Query: gracefully handle additional fields in `SeriesResponse` protobuf message that may be added in the future.

### Added

- [#2502](https://github.com/thanos-io/thanos/pull/2502) Added `hints` field to `SeriesResponse`. Hints in an opaque data structure that can be used to carry additional information from the store and its content is implementation specific.

### Changed

- [#2505](https://github.com/thanos.io/thanos/pull/2505) Store: remove obsolete `thanos_store_node_info` metric.
Expand Down
203 changes: 144 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.

8 changes: 8 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 @@ -132,6 +133,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 is an opaque data structure that can be used to carry additional information from
/// the store. 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