mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-12 16:44:05 -08:00
wip move off of gogoproto
Co-authored-by: Austin Cawley-Edwards <austin.cawley@gmail.com> Signed-off-by: Callum Styan <callumstyan@gmail.com>
This commit is contained in:
parent
97f9ad9d31
commit
842d221814
1
go.mod
1
go.mod
|
@ -107,6 +107,7 @@ require (
|
|||
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c // indirect
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1167,6 +1167,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp
|
|||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
|
||||
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA=
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
|
|
2030
prompb/remote.pb.go
2030
prompb/remote.pb.go
File diff suppressed because it is too large
Load diff
|
@ -14,17 +14,17 @@
|
|||
syntax = "proto3";
|
||||
package prometheus;
|
||||
|
||||
option go_package = "prompb";
|
||||
option go_package = "github.com/prometheus/prometheus/prompb";
|
||||
|
||||
import "types.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
// import "gogoproto/gogo.proto";
|
||||
|
||||
message WriteRequest {
|
||||
repeated prometheus.TimeSeries timeseries = 1 [(gogoproto.nullable) = false];
|
||||
repeated prometheus.TimeSeries timeseries = 1;
|
||||
// Cortex uses this field to determine the source of the write request.
|
||||
// We reserve it to avoid any compatibility issues.
|
||||
reserved 2;
|
||||
repeated prometheus.MetricMetadata metadata = 3 [(gogoproto.nullable) = false];
|
||||
repeated prometheus.MetricMetadata metadata = 3;
|
||||
}
|
||||
|
||||
// ReadRequest represents a remote read request.
|
||||
|
|
5159
prompb/types.pb.go
5159
prompb/types.pb.go
File diff suppressed because it is too large
Load diff
|
@ -14,9 +14,9 @@
|
|||
syntax = "proto3";
|
||||
package prometheus;
|
||||
|
||||
option go_package = "prompb";
|
||||
option go_package = "github.com/prometheus/prometheus/prompb";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
// import "gogoproto/gogo.proto";
|
||||
|
||||
message MetricMetadata {
|
||||
enum MetricType {
|
||||
|
@ -47,7 +47,7 @@ message Sample {
|
|||
|
||||
message Exemplar {
|
||||
// Optional, can be empty.
|
||||
repeated Label labels = 1 [(gogoproto.nullable) = false];
|
||||
repeated Label labels = 1;
|
||||
double value = 2;
|
||||
// timestamp is in ms format, see model/timestamp/timestamp.go for
|
||||
// conversion from time.Time to Prometheus timestamp.
|
||||
|
@ -88,7 +88,7 @@ message Histogram {
|
|||
}
|
||||
|
||||
// Negative Buckets.
|
||||
repeated BucketSpan negative_spans = 8 [(gogoproto.nullable) = false];
|
||||
repeated BucketSpan negative_spans = 8;
|
||||
// Use either "negative_deltas" or "negative_counts", the former for
|
||||
// regular histograms with integer counts, the latter for float
|
||||
// histograms.
|
||||
|
@ -96,7 +96,7 @@ message Histogram {
|
|||
repeated double negative_counts = 10; // Absolute count of each bucket.
|
||||
|
||||
// Positive Buckets.
|
||||
repeated BucketSpan positive_spans = 11 [(gogoproto.nullable) = false];
|
||||
repeated BucketSpan positive_spans = 11;
|
||||
// Use either "positive_deltas" or "positive_counts", the former for
|
||||
// regular histograms with integer counts, the latter for float
|
||||
// histograms.
|
||||
|
@ -123,10 +123,10 @@ message BucketSpan {
|
|||
message TimeSeries {
|
||||
// For a timeseries to be valid, and for the samples and exemplars
|
||||
// to be ingested by the remote system properly, the labels field is required.
|
||||
repeated Label labels = 1 [(gogoproto.nullable) = false];
|
||||
repeated Sample samples = 2 [(gogoproto.nullable) = false];
|
||||
repeated Exemplar exemplars = 3 [(gogoproto.nullable) = false];
|
||||
repeated Histogram histograms = 4 [(gogoproto.nullable) = false];
|
||||
repeated Label labels = 1;
|
||||
repeated Sample samples = 2;
|
||||
repeated Exemplar exemplars = 3;
|
||||
repeated Histogram histograms = 4;
|
||||
}
|
||||
|
||||
message Label {
|
||||
|
@ -135,7 +135,7 @@ message Label {
|
|||
}
|
||||
|
||||
message Labels {
|
||||
repeated Label labels = 1 [(gogoproto.nullable) = false];
|
||||
repeated Label labels = 1;
|
||||
}
|
||||
|
||||
// Matcher specifies a rule, which can match or set of labels or not.
|
||||
|
@ -181,7 +181,7 @@ message Chunk {
|
|||
// ChunkedSeries represents single, encoded time series.
|
||||
message ChunkedSeries {
|
||||
// Labels should be sorted.
|
||||
repeated Label labels = 1 [(gogoproto.nullable) = false];
|
||||
repeated Label labels = 1;
|
||||
// Chunks will be in start time order and may overlap.
|
||||
repeated Chunk chunks = 2 [(gogoproto.nullable) = false];
|
||||
repeated Chunk chunks = 2;
|
||||
}
|
||||
|
|
|
@ -10,24 +10,47 @@ if ! [[ "$0" =~ "scripts/genproto.sh" ]]; then
|
|||
exit 255
|
||||
fi
|
||||
|
||||
if ! [[ $(protoc --version) =~ "3.15.8" ]]; then
|
||||
echo "could not find protoc 3.15.8, is it installed + in PATH?"
|
||||
exit 255
|
||||
fi
|
||||
# if ! [[ $(protoc --version) =~ "3.15.8" ]]; then
|
||||
# echo "could not find protoc 3.15.8, is it installed + in PATH?"
|
||||
# exit 255
|
||||
# fi
|
||||
|
||||
# Since we run go install, go mod download, the go.sum will change.
|
||||
# Make a backup.
|
||||
cp go.sum go.sum.bak
|
||||
|
||||
INSTALL_PKGS="golang.org/x/tools/cmd/goimports github.com/gogo/protobuf/protoc-gen-gogofast github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger"
|
||||
for pkg in ${INSTALL_PKGS}; do
|
||||
GO111MODULE=on go install "$pkg"
|
||||
INSTALL_PKGS=(
|
||||
"golang.org/x/tools/cmd/goimports"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger"
|
||||
)
|
||||
for pkg in "${INSTALL_PKGS[@]}"; do
|
||||
echo "installing $pkg"
|
||||
done
|
||||
|
||||
GET_PKGS=(
|
||||
"google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0"
|
||||
"google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0"
|
||||
)
|
||||
for pkg in "${GET_PKGS[@]}"; do
|
||||
echo "getting $pkg"
|
||||
GO111MODULE=on go get "$pkg"
|
||||
done
|
||||
|
||||
|
||||
MAPPINGS=(
|
||||
"google/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor"
|
||||
)
|
||||
MAPPING_ARG=""
|
||||
for mapping in "${MAPPINGS[@]}"
|
||||
do
|
||||
MAPPING_ARG+="M$mapping"
|
||||
done
|
||||
|
||||
PROM_ROOT="${PWD}"
|
||||
PROM_PATH="${PROM_ROOT}/prompb"
|
||||
GOGOPROTO_ROOT="$(GO111MODULE=on go list -mod=readonly -f '{{ .Dir }}' -m github.com/gogo/protobuf)"
|
||||
GOGOPROTO_PATH="${GOGOPROTO_ROOT}:${GOGOPROTO_ROOT}/protobuf"
|
||||
# GOGOPROTO_ROOT="$(GO111MODULE=on go list -mod=readonly -f '{{ .Dir }}' -m github.com/gogo/protobuf)"
|
||||
# GOGOPROTO_PATH="${GOGOPROTO_ROOT}:${GOGOPROTO_ROOT}/protobuf"
|
||||
GRPC_GATEWAY_ROOT="$(GO111MODULE=on go list -mod=readonly -f '{{ .Dir }}' -m github.com/grpc-ecosystem/grpc-gateway)"
|
||||
|
||||
DIRS="prompb"
|
||||
|
@ -35,20 +58,25 @@ DIRS="prompb"
|
|||
echo "generating code"
|
||||
for dir in ${DIRS}; do
|
||||
pushd ${dir}
|
||||
protoc --gogofast_out=plugins=grpc:. -I=. \
|
||||
-I="${GOGOPROTO_PATH}" \
|
||||
protoc \
|
||||
--go_out="$MAPPING_ARG":. \
|
||||
--go_opt=paths=source_relative \
|
||||
--go-grpc_out="$MAPPING_ARG":. \
|
||||
--go-grpc_opt=paths=source_relative \
|
||||
-I=. \
|
||||
-I="${PROM_PATH}" \
|
||||
-I="${GRPC_GATEWAY_ROOT}/third_party/googleapis" \
|
||||
./*.proto
|
||||
protoc --gogofast_out=Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,paths=source_relative:. -I=. \
|
||||
-I="${GOGOPROTO_PATH}" \
|
||||
./io/prometheus/client/*.proto
|
||||
sed -i.bak -E 's/import _ \"github.com\/gogo\/protobuf\/gogoproto\"//g' -- *.pb.go
|
||||
sed -i.bak -E 's/import _ \"google\/protobuf\"//g' -- *.pb.go
|
||||
sed -i.bak -E 's/\t_ \"google\/protobuf\"//g' -- *.pb.go
|
||||
sed -i.bak -E 's/golang\/protobuf\/descriptor/gogo\/protobuf\/protoc-gen-gogo\/descriptor/g' -- *.go
|
||||
sed -i.bak -E 's/golang\/protobuf/gogo\/protobuf/g' -- *.go
|
||||
rm -f -- *.bak
|
||||
# protoc --gogofast_out=Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,paths=source_relative:. -I=. \
|
||||
# -I="${GOGOPROTO_PATH}" \
|
||||
# ./io/prometheus/client/*.proto
|
||||
# sed -i.bak -E 's/import _ \"github.com\/gogo\/protobuf\/gogoproto\"//g' -- *.pb.go
|
||||
# sed -i.bak -E 's/import _ \"google\/protobuf\"//g' -- *.pb.go
|
||||
# sed -i.bak -E 's/\t_ \"google\/protobuf\"//g' -- *.pb.go
|
||||
# sed -i.bak -E 's/golang\/protobuf\/descriptor/gogo\/protobuf\/protoc-gen-gogo\/descriptor/g' -- *.go
|
||||
# sed -i.bak -E 's/golang\/protobuf/gogo\/protobuf/g' -- *.go
|
||||
# rm -f -- *.bak
|
||||
rm -f ./*.bak
|
||||
goimports -w ./*.go ./io/prometheus/client/*.go
|
||||
popd
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue