mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Merge pull request #3394 from krasi-georgiev/gogo-vs-golang-protobuf
replace golang/protobuf with gogo/protobuf
This commit is contained in:
commit
7ff9ea9ae3
2
NOTICE
2
NOTICE
|
@ -52,7 +52,7 @@ Copyright jQuery Foundation and other contributors
|
|||
Licensed under the MIT License
|
||||
|
||||
Go support for Protocol Buffers - Google's data interchange format
|
||||
http://github.com/golang/protobuf/
|
||||
http://github.com/gogo/protobuf/
|
||||
Copyright 2010 The Go Authors
|
||||
See source code for license details.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "prompb/rpc.proto",
|
||||
"title": "rpc.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"schemes": [
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/golang/snappy"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
|
|
|
@ -308,24 +308,6 @@ func (m *QueryResult) MarshalTo(dAtA []byte) (int, error) {
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Remote(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Remote(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintRemote(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
|
|
|
@ -1,25 +1,6 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: rpc.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package prompb is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
rpc.proto
|
||||
types.proto
|
||||
|
||||
It has these top-level messages:
|
||||
TSDBSnapshotRequest
|
||||
TSDBSnapshotResponse
|
||||
SeriesDeleteRequest
|
||||
SeriesDeleteResponse
|
||||
Sample
|
||||
TimeSeries
|
||||
Label
|
||||
Labels
|
||||
LabelMatcher
|
||||
*/
|
||||
package prompb
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
|
@ -45,12 +26,6 @@ var _ = fmt.Errorf
|
|||
var _ = math.Inf
|
||||
var _ = time.Kitchen
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type TSDBSnapshotRequest struct {
|
||||
}
|
||||
|
||||
|
@ -315,24 +290,6 @@ func (m *SeriesDeleteResponse) MarshalTo(dAtA []byte) (int, error) {
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Rpc(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Rpc(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintRpc(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Code generated by protoc-gen-grpc-gateway
|
||||
// source: prompb/rpc.proto
|
||||
// source: rpc.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
|
@ -13,7 +13,7 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"golang.org/x/net/context"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: types.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package prompb
|
||||
|
||||
|
@ -8,6 +7,8 @@ import proto "github.com/gogo/protobuf/proto"
|
|||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import encoding_binary "encoding/binary"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@ -189,7 +190,8 @@ func (m *Sample) MarshalTo(dAtA []byte) (int, error) {
|
|||
if m.Value != 0 {
|
||||
dAtA[i] = 0x9
|
||||
i++
|
||||
i = encodeFixed64Types(dAtA, i, uint64(math.Float64bits(float64(m.Value))))
|
||||
encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value))))
|
||||
i += 8
|
||||
}
|
||||
if m.Timestamp != 0 {
|
||||
dAtA[i] = 0x10
|
||||
|
@ -336,24 +338,6 @@ func (m *LabelMatcher) MarshalTo(dAtA []byte) (int, error) {
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Types(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Types(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
|
@ -486,15 +470,8 @@ func (m *Sample) Unmarshal(dAtA []byte) error {
|
|||
if (iNdEx + 8) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:]))
|
||||
iNdEx += 8
|
||||
v = uint64(dAtA[iNdEx-8])
|
||||
v |= uint64(dAtA[iNdEx-7]) << 8
|
||||
v |= uint64(dAtA[iNdEx-6]) << 16
|
||||
v |= uint64(dAtA[iNdEx-5]) << 24
|
||||
v |= uint64(dAtA[iNdEx-4]) << 32
|
||||
v |= uint64(dAtA[iNdEx-3]) << 40
|
||||
v |= uint64(dAtA[iNdEx-2]) << 48
|
||||
v |= uint64(dAtA[iNdEx-1]) << 56
|
||||
m.Value = float64(math.Float64frombits(v))
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
|
|
|
@ -31,20 +31,19 @@ for dir in ${DIRS}; do
|
|||
-I="${GRPC_GATEWAY_ROOT}/third_party/googleapis" \
|
||||
*.proto
|
||||
|
||||
protoc -I. \
|
||||
-I="${GOGOPROTO_PATH}" \
|
||||
-I="${PROM_PATH}" \
|
||||
-I="${GRPC_GATEWAY_ROOT}/third_party/googleapis" \
|
||||
--grpc-gateway_out=logtostderr=true:. \
|
||||
--swagger_out=logtostderr=true:../documentation/dev/api/ \
|
||||
rpc.proto
|
||||
mv ../documentation/dev/api/rpc.swagger.json ../documentation/dev/api/swagger.json
|
||||
|
||||
sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go
|
||||
sed -i.bak -E 's/import _ \"google\/protobuf\"//g' *.pb.go
|
||||
sed -i.bak -E 's/golang\/protobuf/gogo\/protobuf/g' *.go
|
||||
rm -f *.bak
|
||||
goimports -w *.pb.go
|
||||
popd
|
||||
done
|
||||
|
||||
protoc -I. \
|
||||
-I="${GOGOPROTO_PATH}" \
|
||||
-I="${PROM_PATH}" \
|
||||
-I="${GRPC_GATEWAY_ROOT}/third_party/googleapis" \
|
||||
--grpc-gateway_out=logtostderr=true:. \
|
||||
--swagger_out=logtostderr=true:./documentation/dev/api/ \
|
||||
prompb/rpc.proto
|
||||
|
||||
mv documentation/dev/api/prompb/rpc.swagger.json documentation/dev/api/swagger.json
|
||||
rm -rf documentation/dev/api/prompb
|
|
@ -23,7 +23,7 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/golang/snappy"
|
||||
"github.com/prometheus/common/model"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
|
|
2
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go
generated
vendored
2
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go
generated
vendored
|
@ -94,7 +94,7 @@ func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, e
|
|||
if len(pairs) == 0 {
|
||||
return ctx, nil
|
||||
}
|
||||
return metadata.NewContext(ctx, metadata.Pairs(pairs...)), nil
|
||||
return metadata.NewOutgoingContext(ctx, metadata.Pairs(pairs...)), nil
|
||||
}
|
||||
|
||||
// ServerMetadata consists of metadata sent from gRPC server.
|
||||
|
|
23
vendor/vendor.json
vendored
23
vendor/vendor.json
vendored
|
@ -608,25 +608,28 @@
|
|||
"revisionTime": "2017-06-07T03:48:29Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "/SPy/naO5hgJ9w7uWZurcUm2I88=",
|
||||
"origin": "github.com/cockroachdb/cockroach/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime",
|
||||
"checksumSHA1": "InNAv3jGuD6SW4qJDBtGQpj0oRI=",
|
||||
"path": "github.com/grpc-ecosystem/grpc-gateway/runtime",
|
||||
"revision": "2ad234c172af14e85f3be9546f6c64c768d4eccd",
|
||||
"revisionTime": "2017-04-04T23:42:07Z"
|
||||
"revision": "589b126116b5fc961939b3e156c29e4d9d58222f",
|
||||
"revisionTime": "2017-04-17T16:01:37Z",
|
||||
"version": "=v1.2.2",
|
||||
"versionExact": "v1.2.2"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "et8uiXNw6yM96U/UZgn2vKtyr3Q=",
|
||||
"origin": "github.com/cockroachdb/cockroach/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal",
|
||||
"path": "github.com/grpc-ecosystem/grpc-gateway/runtime/internal",
|
||||
"revision": "2ad234c172af14e85f3be9546f6c64c768d4eccd",
|
||||
"revisionTime": "2017-04-04T23:42:07Z"
|
||||
"revision": "589b126116b5fc961939b3e156c29e4d9d58222f",
|
||||
"revisionTime": "2017-04-17T16:01:37Z",
|
||||
"version": "=v1.2.2",
|
||||
"versionExact": "v1.2.2"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "vqiK5r5dntV7JNZ+ZsGlD0Samos=",
|
||||
"origin": "github.com/cockroachdb/cockroach/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities",
|
||||
"path": "github.com/grpc-ecosystem/grpc-gateway/utilities",
|
||||
"revision": "2ad234c172af14e85f3be9546f6c64c768d4eccd",
|
||||
"revisionTime": "2017-04-04T23:42:07Z"
|
||||
"revision": "589b126116b5fc961939b3e156c29e4d9d58222f",
|
||||
"revisionTime": "2017-04-17T16:01:37Z",
|
||||
"version": "=v1.2.2",
|
||||
"versionExact": "v1.2.2"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "/DReHn5j0caPm3thgFD9DmOmibQ=",
|
||||
|
|
Loading…
Reference in a new issue