From c0b27f7ad914ac41dd5c52c6cde97be548c50948 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 09:49:07 -0500 Subject: [PATCH 01/15] Fix protobuf compile process. --- Makefile | 2 +- contrib/proto.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ go.mod | 3 ++- go.sum | 4 ++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100755 contrib/proto.sh diff --git a/Makefile b/Makefile index fde55c98..bfe0ecb9 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ clean: .PHONY: proto proto: - scripts/proto.sh + contrib/proto.sh .PHONY: certs certs: diff --git a/contrib/proto.sh b/contrib/proto.sh new file mode 100755 index 00000000..9af7c769 --- /dev/null +++ b/contrib/proto.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# This script assumes that protoc is installed and available on the PATH. + +# Make sure the script fails fast. +set -eux + +SCRIPT_PATH=$(dirname "$0") # relative +REPO_ROOT=$(cd "${SCRIPT_PATH}/.." && pwd) # absolutized and normalized +SRC_DIR=$REPO_ROOT +PYTHON_DST_DIR=$REPO_ROOT/python/gubernator +GOLANG_DST_DIR=$REPO_ROOT + +# Build Golang stabs +go get google.golang.org/protobuf/cmd/protoc-gen-go +go install google.golang.org/protobuf/cmd/protoc-gen-go +go get google.golang.org/grpc/cmd/protoc-gen-go-grpc +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc + +mkdir -p "$GOLANG_DST_DIR" +go install google.golang.org/protobuf/cmd/protoc-gen-go +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc +echo "PATH=$PATH" +export PATH=$PATH:$(go env GOPATH)/bin +protoc -I=$SRC_DIR \ + -I=$SRC_DIR/googleapis \ + --go_out=$GOLANG_DST_DIR \ + --go_opt=paths=source_relative \ + --go-grpc_out=$GOLANG_DST_DIR \ + --go-grpc_opt=paths=source_relative \ + $SRC_DIR/*.proto + +# Build Python stabs +mkdir -p "$PYTHON_DST_DIR" +pip3 install grpcio +pip3 install grpcio-tools +python3 -m grpc.tools.protoc \ + -I=$SRC_DIR \ + -I=$SRC_DIR/googleapis \ + --python_out=$PYTHON_DST_DIR \ + --grpc_python_out=$PYTHON_DST_DIR \ + $SRC_DIR/*.proto +touch $PYTHON_DST_DIR/__init__.py diff --git a/go.mod b/go.mod index 0f5275c6..f77c41bd 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( golang.org/x/time v0.3.0 google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b google.golang.org/grpc v1.59.0 - google.golang.org/protobuf v1.31.0 + google.golang.org/protobuf v1.32.0 k8s.io/api v0.23.3 k8s.io/apimachinery v0.23.3 k8s.io/client-go v0.23.3 @@ -88,6 +88,7 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 3ff2e93e..8630cb13 100644 --- a/go.sum +++ b/go.sum @@ -826,6 +826,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= 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= @@ -841,6 +843,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From a6ccadcd6d3d75aac96fc6fe39e54dc4d2f37e74 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 11:24:16 -0500 Subject: [PATCH 02/15] Add `DRAIN_OVERLIMIT` behavior to protobuf. --- README.md | 28 +- gubernator.pb.go | 566 +++++++++++++++++------ gubernator.proto | 36 ++ gubernator_grpc.pb.go | 44 +- peers.pb.go | 9 +- peers_grpc.pb.go | 3 +- python/gubernator/gubernator_pb2.py | 52 ++- python/gubernator/gubernator_pb2_grpc.py | 33 ++ 8 files changed, 607 insertions(+), 164 deletions(-) diff --git a/README.md b/README.md index e60b5a9d..3fcf4023 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ rate_limits: limit: 100 # The duration of the rate limit in milliseconds duration: 1000 - # The algorithm used to calculate the rate limit + # The algorithm used to calculate the rate limit # 0 = Token Bucket # 1 = Leaky Bucket algorithm: 0 @@ -166,7 +166,7 @@ Given the following `Duration` values * 3 = Weeks * 4 = Months * 5 = Years - + Examples when using `Behavior = DURATION_IS_GREGORIAN` * If `Duration = 2` (Days) then the rate limit will reset to `Current = 0` at the end of the current day the rate limit was created. * If `Duration = 0` (Minutes) then the rate limit will reset to `Current = 0` at the end of the minute the rate limit was created. @@ -178,6 +178,28 @@ This will reset the rate limit as if created new on first use. When using Reset Remaining, the `Hits` field should be 0. +## Drain Overlimit Behavior +Users may add behavior `Behavior_DRAIN_OVERLIMIT` to the rate check request. A +`GetRateLimits` call drains the remaining counter on first overlimit event. Then, +successive `GetRateLimits` calls will return zero remaining counter and not any +residual value. + +This facilitates scenarios that require an overlimit event to stay overlimit +until the rate limit resets. This approach is necessary if a process must make +two rate checks, before and after a process, and the `Hit` amount is not known +until after the process. + +- Before process: Call `GetRateLimits` with `Hits=0` to check the value of + `Remaining` counter. If `Remaining` is zero, it's known + that the rate limit is depleted and the process can be aborted. +- After process: Call `GetRateLimits` with a user specified `Hits` value. If + the call returns overlimit, the process cannot be aborted because it had + already completed. Using `DRAIN_OVERLIMIT` behavior, the `Remaining` count + will be drained to zero. + +Once an overlimit occurs in the "After" step, successive processes will detect +the overlimit state in the "Before" step. + ## Gubernator as a library If you are using golang, you can use Gubernator as a library. This is useful if you wish to implement a rate limit service with your own company specific model @@ -346,4 +368,4 @@ Gubernator publishes Prometheus metrics for realtime monitoring. See [prometheus.md](docs/prometheus.md) for details. ## OpenTelemetry Tracing (OTEL) -Gubernator supports OpenTelemetry. See [tracing.md](docs/tracing.md) for details. \ No newline at end of file +Gubernator supports OpenTelemetry. See [tracing.md](docs/tracing.md) for details. diff --git a/gubernator.pb.go b/gubernator.pb.go index 1e902315..a1902f88 100644 --- a/gubernator.pb.go +++ b/gubernator.pb.go @@ -15,19 +15,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.7 +// protoc-gen-go v1.32.0 +// protoc v4.24.4 // source: gubernator.proto package gubernator import ( - reflect "reflect" - sync "sync" - _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -148,6 +147,10 @@ const ( // 'member-list' peer discovery. Also requires GUBER_DATA_CENTER to be set to different values on at // least 2 instances of Gubernator. Behavior_MULTI_REGION Behavior = 16 + // A GetRateLimits call drains the remaining counter on first overlimit + // event. Then, successive GetRateLimits calls will return zero remaining + // counter and not any residual value. + Behavior_DRAIN_OVERLIMIT Behavior = 32 ) // Enum value maps for Behavior. @@ -159,6 +162,7 @@ var ( 4: "DURATION_IS_GREGORIAN", 8: "RESET_REMAINING", 16: "MULTI_REGION", + 32: "DRAIN_OVERLIMIT", } Behavior_value = map[string]int32{ "BATCHING": 0, @@ -167,6 +171,7 @@ var ( "DURATION_IS_GREGORIAN": 4, "RESET_REMAINING": 8, "MULTI_REGION": 16, + "DRAIN_OVERLIMIT": 32, } ) @@ -339,6 +344,100 @@ func (x *GetRateLimitsResp) GetResponses() []*RateLimitResp { return nil } +type ClearRateLimitsReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Requests []*ClearRateLimitReq `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` +} + +func (x *ClearRateLimitsReq) Reset() { + *x = ClearRateLimitsReq{} + if protoimpl.UnsafeEnabled { + mi := &file_gubernator_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClearRateLimitsReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearRateLimitsReq) ProtoMessage() {} + +func (x *ClearRateLimitsReq) ProtoReflect() protoreflect.Message { + mi := &file_gubernator_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClearRateLimitsReq.ProtoReflect.Descriptor instead. +func (*ClearRateLimitsReq) Descriptor() ([]byte, []int) { + return file_gubernator_proto_rawDescGZIP(), []int{2} +} + +func (x *ClearRateLimitsReq) GetRequests() []*ClearRateLimitReq { + if x != nil { + return x.Requests + } + return nil +} + +type ClearRateLimitsResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Responses []*ClearRateLimitResp `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"` +} + +func (x *ClearRateLimitsResp) Reset() { + *x = ClearRateLimitsResp{} + if protoimpl.UnsafeEnabled { + mi := &file_gubernator_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClearRateLimitsResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearRateLimitsResp) ProtoMessage() {} + +func (x *ClearRateLimitsResp) ProtoReflect() protoreflect.Message { + mi := &file_gubernator_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClearRateLimitsResp.ProtoReflect.Descriptor instead. +func (*ClearRateLimitsResp) Descriptor() ([]byte, []int) { + return file_gubernator_proto_rawDescGZIP(), []int{3} +} + +func (x *ClearRateLimitsResp) GetResponses() []*ClearRateLimitResp { + if x != nil { + return x.Responses + } + return nil +} + type RateLimitReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -374,7 +473,7 @@ type RateLimitReq struct { func (x *RateLimitReq) Reset() { *x = RateLimitReq{} if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[2] + mi := &file_gubernator_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -387,7 +486,7 @@ func (x *RateLimitReq) String() string { func (*RateLimitReq) ProtoMessage() {} func (x *RateLimitReq) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[2] + mi := &file_gubernator_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -400,7 +499,7 @@ func (x *RateLimitReq) ProtoReflect() protoreflect.Message { // Deprecated: Use RateLimitReq.ProtoReflect.Descriptor instead. func (*RateLimitReq) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{2} + return file_gubernator_proto_rawDescGZIP(), []int{4} } func (x *RateLimitReq) GetName() string { @@ -488,7 +587,7 @@ type RateLimitResp struct { func (x *RateLimitResp) Reset() { *x = RateLimitResp{} if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[3] + mi := &file_gubernator_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -501,7 +600,7 @@ func (x *RateLimitResp) String() string { func (*RateLimitResp) ProtoMessage() {} func (x *RateLimitResp) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[3] + mi := &file_gubernator_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -514,7 +613,7 @@ func (x *RateLimitResp) ProtoReflect() protoreflect.Message { // Deprecated: Use RateLimitResp.ProtoReflect.Descriptor instead. func (*RateLimitResp) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{3} + return file_gubernator_proto_rawDescGZIP(), []int{5} } func (x *RateLimitResp) GetStatus() Status { @@ -559,6 +658,129 @@ func (x *RateLimitResp) GetMetadata() map[string]string { return nil } +type ClearRateLimitReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the rate limit IE: 'requests_per_second', 'gets_per_minute` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Uniquely identifies this rate limit IE: 'ip:10.2.10.7' or 'account:123445' + UniqueKey string `protobuf:"bytes,2,opt,name=unique_key,json=uniqueKey,proto3" json:"unique_key,omitempty"` +} + +func (x *ClearRateLimitReq) Reset() { + *x = ClearRateLimitReq{} + if protoimpl.UnsafeEnabled { + mi := &file_gubernator_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClearRateLimitReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearRateLimitReq) ProtoMessage() {} + +func (x *ClearRateLimitReq) ProtoReflect() protoreflect.Message { + mi := &file_gubernator_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClearRateLimitReq.ProtoReflect.Descriptor instead. +func (*ClearRateLimitReq) Descriptor() ([]byte, []int) { + return file_gubernator_proto_rawDescGZIP(), []int{6} +} + +func (x *ClearRateLimitReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ClearRateLimitReq) GetUniqueKey() string { + if x != nil { + return x.UniqueKey + } + return "" +} + +type ClearRateLimitResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The currently configured request limit (Identical to RateLimitRequest.rate_limit_config.limit). + Limit int64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` + // This is the time when the rate limit span will be reset, provided as a unix timestamp in milliseconds. + ResetTime int64 `protobuf:"varint,2,opt,name=reset_time,json=resetTime,proto3" json:"reset_time,omitempty"` + // Contains the error; If set all other values should be ignored + Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *ClearRateLimitResp) Reset() { + *x = ClearRateLimitResp{} + if protoimpl.UnsafeEnabled { + mi := &file_gubernator_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClearRateLimitResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearRateLimitResp) ProtoMessage() {} + +func (x *ClearRateLimitResp) ProtoReflect() protoreflect.Message { + mi := &file_gubernator_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClearRateLimitResp.ProtoReflect.Descriptor instead. +func (*ClearRateLimitResp) Descriptor() ([]byte, []int) { + return file_gubernator_proto_rawDescGZIP(), []int{7} +} + +func (x *ClearRateLimitResp) GetLimit() int64 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *ClearRateLimitResp) GetResetTime() int64 { + if x != nil { + return x.ResetTime + } + return 0 +} + +func (x *ClearRateLimitResp) GetError() string { + if x != nil { + return x.Error + } + return "" +} + type HealthCheckReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -568,7 +790,7 @@ type HealthCheckReq struct { func (x *HealthCheckReq) Reset() { *x = HealthCheckReq{} if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[4] + mi := &file_gubernator_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -581,7 +803,7 @@ func (x *HealthCheckReq) String() string { func (*HealthCheckReq) ProtoMessage() {} func (x *HealthCheckReq) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[4] + mi := &file_gubernator_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -594,7 +816,7 @@ func (x *HealthCheckReq) ProtoReflect() protoreflect.Message { // Deprecated: Use HealthCheckReq.ProtoReflect.Descriptor instead. func (*HealthCheckReq) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{4} + return file_gubernator_proto_rawDescGZIP(), []int{8} } type HealthCheckResp struct { @@ -613,7 +835,7 @@ type HealthCheckResp struct { func (x *HealthCheckResp) Reset() { *x = HealthCheckResp{} if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[5] + mi := &file_gubernator_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -626,7 +848,7 @@ func (x *HealthCheckResp) String() string { func (*HealthCheckResp) ProtoMessage() {} func (x *HealthCheckResp) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[5] + mi := &file_gubernator_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -639,7 +861,7 @@ func (x *HealthCheckResp) ProtoReflect() protoreflect.Message { // Deprecated: Use HealthCheckResp.ProtoReflect.Descriptor instead. func (*HealthCheckResp) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{5} + return file_gubernator_proto_rawDescGZIP(), []int{9} } func (x *HealthCheckResp) GetStatus() string { @@ -679,89 +901,119 @@ var file_gubernator_proto_rawDesc = []byte{ 0x70, 0x12, 0x3a, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x22, 0x8e, 0x03, - 0x0a, 0x0c, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, + 0x73, 0x70, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x22, 0x52, 0x0a, + 0x12, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x12, 0x3c, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, + 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x73, 0x22, 0x56, 0x0a, 0x13, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, + 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3f, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x62, + 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x43, 0x6c, 0x65, 0x61, + 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x52, 0x09, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x22, 0x8e, 0x03, 0x0a, 0x0c, 0x52, 0x61, + 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, + 0x04, 0x68, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x68, 0x69, 0x74, + 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, + 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, + 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x33, 0x0a, 0x08, 0x62, + 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, + 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x42, 0x65, + 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x52, 0x08, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, + 0x12, 0x14, 0x0a, 0x05, 0x62, 0x75, 0x72, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x05, 0x62, 0x75, 0x72, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, + 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, + 0x69, 0x74, 0x52, 0x65, 0x71, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, + 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xac, 0x02, 0x0a, 0x0d, 0x52, + 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x70, + 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, + 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x12, + 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x12, 0x46, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, + 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x46, 0x0a, 0x11, 0x43, 0x6c, 0x65, + 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4b, 0x65, - 0x79, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x04, 0x68, 0x69, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, - 0x69, 0x74, 0x68, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, - 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, - 0x69, 0x74, 0x68, 0x6d, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, - 0x33, 0x0a, 0x08, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, - 0x72, 0x2e, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x52, 0x08, 0x62, 0x65, 0x68, 0x61, - 0x76, 0x69, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x75, 0x72, 0x73, 0x74, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x75, 0x72, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, - 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, - 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xac, - 0x02, 0x0a, 0x0d, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x2d, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, - 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, - 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, - 0x69, 0x6e, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x69, 0x6d, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x73, 0x65, 0x74, 0x54, 0x69, - 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x46, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x62, 0x2e, - 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x10, 0x0a, - 0x0e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x22, - 0x62, 0x0a, 0x0f, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x70, 0x65, 0x65, 0x72, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x2a, 0x2f, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, - 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, - 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x45, 0x41, 0x4b, 0x59, 0x5f, 0x42, 0x55, 0x43, 0x4b, - 0x45, 0x54, 0x10, 0x01, 0x2a, 0x77, 0x0a, 0x08, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, - 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41, 0x54, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0f, - 0x0a, 0x0b, 0x4e, 0x4f, 0x5f, 0x42, 0x41, 0x54, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, - 0x0a, 0x0a, 0x06, 0x47, 0x4c, 0x4f, 0x42, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x44, - 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x5f, 0x47, 0x52, 0x45, 0x47, 0x4f, - 0x52, 0x49, 0x41, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x52, 0x45, 0x53, 0x45, 0x54, 0x5f, - 0x52, 0x45, 0x4d, 0x41, 0x49, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x4d, - 0x55, 0x4c, 0x54, 0x49, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x10, 0x2a, 0x29, 0x0a, - 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x44, 0x45, 0x52, - 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x56, 0x45, 0x52, - 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x10, 0x01, 0x32, 0xdd, 0x01, 0x0a, 0x02, 0x56, 0x31, 0x12, - 0x70, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, - 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, - 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x1a, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, - 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x11, 0x2f, 0x76, 0x31, - 0x2f, 0x47, 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x3a, 0x01, - 0x2a, 0x12, 0x65, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, - 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, - 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x22, - 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x22, 0x5a, 0x1d, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x61, 0x69, 0x6c, 0x67, 0x75, 0x6e, 0x2f, 0x67, - 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x80, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x22, 0x5f, 0x0a, 0x12, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, + 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1d, 0x0a, + 0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x72, 0x65, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x22, 0x10, 0x0a, 0x0e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x52, 0x65, 0x71, 0x22, 0x62, 0x0a, 0x0f, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x65, 0x65, + 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x70, + 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x2f, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, + 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x42, + 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x45, 0x41, 0x4b, 0x59, + 0x5f, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x01, 0x2a, 0x8c, 0x01, 0x0a, 0x08, 0x42, 0x65, + 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41, 0x54, 0x43, 0x48, 0x49, + 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x5f, 0x42, 0x41, 0x54, 0x43, 0x48, + 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x4c, 0x4f, 0x42, 0x41, 0x4c, 0x10, + 0x02, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, + 0x5f, 0x47, 0x52, 0x45, 0x47, 0x4f, 0x52, 0x49, 0x41, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, + 0x52, 0x45, 0x53, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x4d, 0x41, 0x49, 0x4e, 0x49, 0x4e, 0x47, 0x10, + 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, + 0x4e, 0x10, 0x10, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x52, 0x41, 0x49, 0x4e, 0x5f, 0x4f, 0x56, 0x45, + 0x52, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x10, 0x20, 0x2a, 0x29, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, 0x49, + 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x56, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, 0x49, + 0x54, 0x10, 0x01, 0x32, 0xd7, 0x02, 0x0a, 0x02, 0x56, 0x31, 0x12, 0x70, 0x0a, 0x0d, 0x47, 0x65, + 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x62, + 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x20, 0x2e, 0x70, + 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1c, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x78, 0x0a, 0x0f, + 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, + 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, + 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, + 0x6f, 0x72, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x3a, 0x01, + 0x2a, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, + 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x76, + 0x31, 0x2f, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x22, 0x5a, + 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x61, 0x69, 0x6c, + 0x67, 0x75, 0x6e, 0x2f, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x80, 0x01, + 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -777,37 +1029,45 @@ func file_gubernator_proto_rawDescGZIP() []byte { } var file_gubernator_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_gubernator_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_gubernator_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_gubernator_proto_goTypes = []interface{}{ - (Algorithm)(0), // 0: pb.gubernator.Algorithm - (Behavior)(0), // 1: pb.gubernator.Behavior - (Status)(0), // 2: pb.gubernator.Status - (*GetRateLimitsReq)(nil), // 3: pb.gubernator.GetRateLimitsReq - (*GetRateLimitsResp)(nil), // 4: pb.gubernator.GetRateLimitsResp - (*RateLimitReq)(nil), // 5: pb.gubernator.RateLimitReq - (*RateLimitResp)(nil), // 6: pb.gubernator.RateLimitResp - (*HealthCheckReq)(nil), // 7: pb.gubernator.HealthCheckReq - (*HealthCheckResp)(nil), // 8: pb.gubernator.HealthCheckResp - nil, // 9: pb.gubernator.RateLimitReq.MetadataEntry - nil, // 10: pb.gubernator.RateLimitResp.MetadataEntry + (Algorithm)(0), // 0: pb.gubernator.Algorithm + (Behavior)(0), // 1: pb.gubernator.Behavior + (Status)(0), // 2: pb.gubernator.Status + (*GetRateLimitsReq)(nil), // 3: pb.gubernator.GetRateLimitsReq + (*GetRateLimitsResp)(nil), // 4: pb.gubernator.GetRateLimitsResp + (*ClearRateLimitsReq)(nil), // 5: pb.gubernator.ClearRateLimitsReq + (*ClearRateLimitsResp)(nil), // 6: pb.gubernator.ClearRateLimitsResp + (*RateLimitReq)(nil), // 7: pb.gubernator.RateLimitReq + (*RateLimitResp)(nil), // 8: pb.gubernator.RateLimitResp + (*ClearRateLimitReq)(nil), // 9: pb.gubernator.ClearRateLimitReq + (*ClearRateLimitResp)(nil), // 10: pb.gubernator.ClearRateLimitResp + (*HealthCheckReq)(nil), // 11: pb.gubernator.HealthCheckReq + (*HealthCheckResp)(nil), // 12: pb.gubernator.HealthCheckResp + nil, // 13: pb.gubernator.RateLimitReq.MetadataEntry + nil, // 14: pb.gubernator.RateLimitResp.MetadataEntry } var file_gubernator_proto_depIdxs = []int32{ - 5, // 0: pb.gubernator.GetRateLimitsReq.requests:type_name -> pb.gubernator.RateLimitReq - 6, // 1: pb.gubernator.GetRateLimitsResp.responses:type_name -> pb.gubernator.RateLimitResp - 0, // 2: pb.gubernator.RateLimitReq.algorithm:type_name -> pb.gubernator.Algorithm - 1, // 3: pb.gubernator.RateLimitReq.behavior:type_name -> pb.gubernator.Behavior - 9, // 4: pb.gubernator.RateLimitReq.metadata:type_name -> pb.gubernator.RateLimitReq.MetadataEntry - 2, // 5: pb.gubernator.RateLimitResp.status:type_name -> pb.gubernator.Status - 10, // 6: pb.gubernator.RateLimitResp.metadata:type_name -> pb.gubernator.RateLimitResp.MetadataEntry - 3, // 7: pb.gubernator.V1.GetRateLimits:input_type -> pb.gubernator.GetRateLimitsReq - 7, // 8: pb.gubernator.V1.HealthCheck:input_type -> pb.gubernator.HealthCheckReq - 4, // 9: pb.gubernator.V1.GetRateLimits:output_type -> pb.gubernator.GetRateLimitsResp - 8, // 10: pb.gubernator.V1.HealthCheck:output_type -> pb.gubernator.HealthCheckResp - 9, // [9:11] is the sub-list for method output_type - 7, // [7:9] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 7, // 0: pb.gubernator.GetRateLimitsReq.requests:type_name -> pb.gubernator.RateLimitReq + 8, // 1: pb.gubernator.GetRateLimitsResp.responses:type_name -> pb.gubernator.RateLimitResp + 9, // 2: pb.gubernator.ClearRateLimitsReq.requests:type_name -> pb.gubernator.ClearRateLimitReq + 10, // 3: pb.gubernator.ClearRateLimitsResp.responses:type_name -> pb.gubernator.ClearRateLimitResp + 0, // 4: pb.gubernator.RateLimitReq.algorithm:type_name -> pb.gubernator.Algorithm + 1, // 5: pb.gubernator.RateLimitReq.behavior:type_name -> pb.gubernator.Behavior + 13, // 6: pb.gubernator.RateLimitReq.metadata:type_name -> pb.gubernator.RateLimitReq.MetadataEntry + 2, // 7: pb.gubernator.RateLimitResp.status:type_name -> pb.gubernator.Status + 14, // 8: pb.gubernator.RateLimitResp.metadata:type_name -> pb.gubernator.RateLimitResp.MetadataEntry + 3, // 9: pb.gubernator.V1.GetRateLimits:input_type -> pb.gubernator.GetRateLimitsReq + 5, // 10: pb.gubernator.V1.ClearRateLimits:input_type -> pb.gubernator.ClearRateLimitsReq + 11, // 11: pb.gubernator.V1.HealthCheck:input_type -> pb.gubernator.HealthCheckReq + 4, // 12: pb.gubernator.V1.GetRateLimits:output_type -> pb.gubernator.GetRateLimitsResp + 6, // 13: pb.gubernator.V1.ClearRateLimits:output_type -> pb.gubernator.ClearRateLimitsResp + 12, // 14: pb.gubernator.V1.HealthCheck:output_type -> pb.gubernator.HealthCheckResp + 12, // [12:15] is the sub-list for method output_type + 9, // [9:12] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_gubernator_proto_init() } @@ -841,7 +1101,7 @@ func file_gubernator_proto_init() { } } file_gubernator_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimitReq); i { + switch v := v.(*ClearRateLimitsReq); i { case 0: return &v.state case 1: @@ -853,7 +1113,7 @@ func file_gubernator_proto_init() { } } file_gubernator_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimitResp); i { + switch v := v.(*ClearRateLimitsResp); i { case 0: return &v.state case 1: @@ -865,7 +1125,7 @@ func file_gubernator_proto_init() { } } file_gubernator_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheckReq); i { + switch v := v.(*RateLimitReq); i { case 0: return &v.state case 1: @@ -877,6 +1137,54 @@ func file_gubernator_proto_init() { } } file_gubernator_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RateLimitResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gubernator_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClearRateLimitReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gubernator_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClearRateLimitResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gubernator_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheckReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gubernator_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HealthCheckResp); i { case 0: return &v.state @@ -895,7 +1203,7 @@ func file_gubernator_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_gubernator_proto_rawDesc, NumEnums: 3, - NumMessages: 8, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/gubernator.proto b/gubernator.proto index c8f237e8..ea84ba9a 100644 --- a/gubernator.proto +++ b/gubernator.proto @@ -34,6 +34,12 @@ service V1 { }; } + rpc ClearRateLimits (ClearRateLimitsReq) returns (ClearRateLimitsResp) { + option (google.api.http) = { + post: "/v1/ClearRateLimits" + body: "*" + }; + } // This method is for round trip benchmarking and can be used by // the client to determine connectivity to the server @@ -54,6 +60,14 @@ message GetRateLimitsResp { repeated RateLimitResp responses = 1; } +message ClearRateLimitsReq { + repeated ClearRateLimitReq requests = 1; +} + +message ClearRateLimitsResp { + repeated ClearRateLimitResp responses = 1; +} + enum Algorithm { // Token bucket algorithm https://en.wikipedia.org/wiki/Token_bucket TOKEN_BUCKET = 0; @@ -127,6 +141,11 @@ enum Behavior { // least 2 instances of Gubernator. MULTI_REGION = 16; + // A GetRateLimits call drains the remaining counter on first overlimit + // event. Then, successive GetRateLimits calls will return zero remaining + // counter and not any residual value. + DRAIN_OVERLIMIT = 32; + // TODO: Add support for LOCAL. Which would force the rate limit to be handled by the local instance } @@ -186,6 +205,23 @@ message RateLimitResp { map metadata = 6; } +message ClearRateLimitReq { + // The name of the rate limit IE: 'requests_per_second', 'gets_per_minute` + string name = 1; + + // Uniquely identifies this rate limit IE: 'ip:10.2.10.7' or 'account:123445' + string unique_key = 2; +} + +message ClearRateLimitResp { + // The currently configured request limit (Identical to RateLimitRequest.rate_limit_config.limit). + int64 limit = 1; + // This is the time when the rate limit span will be reset, provided as a unix timestamp in milliseconds. + int64 reset_time = 2; + // Contains the error; If set all other values should be ignored + string error = 3; +} + message HealthCheckReq {} message HealthCheckResp { // Valid entries are 'healthy' or 'unhealthy' diff --git a/gubernator_grpc.pb.go b/gubernator_grpc.pb.go index 20b4c442..e07fad44 100644 --- a/gubernator_grpc.pb.go +++ b/gubernator_grpc.pb.go @@ -16,14 +16,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.7 +// - protoc v4.24.4 // source: gubernator.proto package gubernator import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -35,8 +34,9 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - V1_GetRateLimits_FullMethodName = "/pb.gubernator.V1/GetRateLimits" - V1_HealthCheck_FullMethodName = "/pb.gubernator.V1/HealthCheck" + V1_GetRateLimits_FullMethodName = "/pb.gubernator.V1/GetRateLimits" + V1_ClearRateLimits_FullMethodName = "/pb.gubernator.V1/ClearRateLimits" + V1_HealthCheck_FullMethodName = "/pb.gubernator.V1/HealthCheck" ) // V1Client is the client API for V1 service. @@ -45,6 +45,7 @@ const ( type V1Client interface { // Given a list of rate limit requests, return the rate limits of each. GetRateLimits(ctx context.Context, in *GetRateLimitsReq, opts ...grpc.CallOption) (*GetRateLimitsResp, error) + ClearRateLimits(ctx context.Context, in *ClearRateLimitsReq, opts ...grpc.CallOption) (*ClearRateLimitsResp, error) // This method is for round trip benchmarking and can be used by // the client to determine connectivity to the server HealthCheck(ctx context.Context, in *HealthCheckReq, opts ...grpc.CallOption) (*HealthCheckResp, error) @@ -67,6 +68,15 @@ func (c *v1Client) GetRateLimits(ctx context.Context, in *GetRateLimitsReq, opts return out, nil } +func (c *v1Client) ClearRateLimits(ctx context.Context, in *ClearRateLimitsReq, opts ...grpc.CallOption) (*ClearRateLimitsResp, error) { + out := new(ClearRateLimitsResp) + err := c.cc.Invoke(ctx, V1_ClearRateLimits_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *v1Client) HealthCheck(ctx context.Context, in *HealthCheckReq, opts ...grpc.CallOption) (*HealthCheckResp, error) { out := new(HealthCheckResp) err := c.cc.Invoke(ctx, V1_HealthCheck_FullMethodName, in, out, opts...) @@ -82,6 +92,7 @@ func (c *v1Client) HealthCheck(ctx context.Context, in *HealthCheckReq, opts ... type V1Server interface { // Given a list of rate limit requests, return the rate limits of each. GetRateLimits(context.Context, *GetRateLimitsReq) (*GetRateLimitsResp, error) + ClearRateLimits(context.Context, *ClearRateLimitsReq) (*ClearRateLimitsResp, error) // This method is for round trip benchmarking and can be used by // the client to determine connectivity to the server HealthCheck(context.Context, *HealthCheckReq) (*HealthCheckResp, error) @@ -95,6 +106,9 @@ type UnimplementedV1Server struct { func (UnimplementedV1Server) GetRateLimits(context.Context, *GetRateLimitsReq) (*GetRateLimitsResp, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRateLimits not implemented") } +func (UnimplementedV1Server) ClearRateLimits(context.Context, *ClearRateLimitsReq) (*ClearRateLimitsResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearRateLimits not implemented") +} func (UnimplementedV1Server) HealthCheck(context.Context, *HealthCheckReq) (*HealthCheckResp, error) { return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") } @@ -129,6 +143,24 @@ func _V1_GetRateLimits_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _V1_ClearRateLimits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearRateLimitsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(V1Server).ClearRateLimits(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: V1_ClearRateLimits_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(V1Server).ClearRateLimits(ctx, req.(*ClearRateLimitsReq)) + } + return interceptor(ctx, in, info, handler) +} + func _V1_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(HealthCheckReq) if err := dec(in); err != nil { @@ -158,6 +190,10 @@ var V1_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetRateLimits", Handler: _V1_GetRateLimits_Handler, }, + { + MethodName: "ClearRateLimits", + Handler: _V1_ClearRateLimits_Handler, + }, { MethodName: "HealthCheck", Handler: _V1_HealthCheck_Handler, diff --git a/peers.pb.go b/peers.pb.go index 597cd02a..f825f32c 100644 --- a/peers.pb.go +++ b/peers.pb.go @@ -15,18 +15,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.7 +// protoc-gen-go v1.32.0 +// protoc v4.24.4 // source: peers.proto package gubernator import ( - reflect "reflect" - sync "sync" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( diff --git a/peers_grpc.pb.go b/peers_grpc.pb.go index 355c43d6..ed722062 100644 --- a/peers_grpc.pb.go +++ b/peers_grpc.pb.go @@ -16,14 +16,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.7 +// - protoc v4.24.4 // source: peers.proto package gubernator import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/python/gubernator/gubernator_pb2.py b/python/gubernator/gubernator_pb2.py index ed3b2695..76247b83 100644 --- a/python/gubernator/gubernator_pb2.py +++ b/python/gubernator/gubernator_pb2.py @@ -14,7 +14,7 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10gubernator.proto\x12\rpb.gubernator\x1a\x1cgoogle/api/annotations.proto\"A\n\x10GetRateLimitsReq\x12-\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReq\"D\n\x11GetRateLimitsResp\x12/\n\tresponses\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitResp\"\xb4\x02\n\x0cRateLimitReq\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nunique_key\x18\x02 \x01(\t\x12\x0c\n\x04hits\x18\x03 \x01(\x03\x12\r\n\x05limit\x18\x04 \x01(\x03\x12\x10\n\x08\x64uration\x18\x05 \x01(\x03\x12+\n\talgorithm\x18\x06 \x01(\x0e\x32\x18.pb.gubernator.Algorithm\x12)\n\x08\x62\x65havior\x18\x07 \x01(\x0e\x32\x17.pb.gubernator.Behavior\x12\r\n\x05\x62urst\x18\x08 \x01(\x03\x12;\n\x08metadata\x18\t \x03(\x0b\x32).pb.gubernator.RateLimitReq.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xea\x01\n\rRateLimitResp\x12%\n\x06status\x18\x01 \x01(\x0e\x32\x15.pb.gubernator.Status\x12\r\n\x05limit\x18\x02 \x01(\x03\x12\x11\n\tremaining\x18\x03 \x01(\x03\x12\x12\n\nreset_time\x18\x04 \x01(\x03\x12\r\n\x05\x65rror\x18\x05 \x01(\t\x12<\n\x08metadata\x18\x06 \x03(\x0b\x32*.pb.gubernator.RateLimitResp.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x10\n\x0eHealthCheckReq\"F\n\x0fHealthCheckResp\x12\x0e\n\x06status\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x12\n\npeer_count\x18\x03 \x01(\x05*/\n\tAlgorithm\x12\x10\n\x0cTOKEN_BUCKET\x10\x00\x12\x10\n\x0cLEAKY_BUCKET\x10\x01*w\n\x08\x42\x65havior\x12\x0c\n\x08\x42\x41TCHING\x10\x00\x12\x0f\n\x0bNO_BATCHING\x10\x01\x12\n\n\x06GLOBAL\x10\x02\x12\x19\n\x15\x44URATION_IS_GREGORIAN\x10\x04\x12\x13\n\x0fRESET_REMAINING\x10\x08\x12\x10\n\x0cMULTI_REGION\x10\x10*)\n\x06Status\x12\x0f\n\x0bUNDER_LIMIT\x10\x00\x12\x0e\n\nOVER_LIMIT\x10\x01\x32\xdd\x01\n\x02V1\x12p\n\rGetRateLimits\x12\x1f.pb.gubernator.GetRateLimitsReq\x1a .pb.gubernator.GetRateLimitsResp\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/v1/GetRateLimits:\x01*\x12\x65\n\x0bHealthCheck\x12\x1d.pb.gubernator.HealthCheckReq\x1a\x1e.pb.gubernator.HealthCheckResp\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/HealthCheckB\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10gubernator.proto\x12\rpb.gubernator\x1a\x1cgoogle/api/annotations.proto\"A\n\x10GetRateLimitsReq\x12-\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReq\"D\n\x11GetRateLimitsResp\x12/\n\tresponses\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitResp\"H\n\x12\x43learRateLimitsReq\x12\x32\n\x08requests\x18\x01 \x03(\x0b\x32 .pb.gubernator.ClearRateLimitReq\"K\n\x13\x43learRateLimitsResp\x12\x34\n\tresponses\x18\x01 \x03(\x0b\x32!.pb.gubernator.ClearRateLimitResp\"\xb4\x02\n\x0cRateLimitReq\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nunique_key\x18\x02 \x01(\t\x12\x0c\n\x04hits\x18\x03 \x01(\x03\x12\r\n\x05limit\x18\x04 \x01(\x03\x12\x10\n\x08\x64uration\x18\x05 \x01(\x03\x12+\n\talgorithm\x18\x06 \x01(\x0e\x32\x18.pb.gubernator.Algorithm\x12)\n\x08\x62\x65havior\x18\x07 \x01(\x0e\x32\x17.pb.gubernator.Behavior\x12\r\n\x05\x62urst\x18\x08 \x01(\x03\x12;\n\x08metadata\x18\t \x03(\x0b\x32).pb.gubernator.RateLimitReq.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xea\x01\n\rRateLimitResp\x12%\n\x06status\x18\x01 \x01(\x0e\x32\x15.pb.gubernator.Status\x12\r\n\x05limit\x18\x02 \x01(\x03\x12\x11\n\tremaining\x18\x03 \x01(\x03\x12\x12\n\nreset_time\x18\x04 \x01(\x03\x12\r\n\x05\x65rror\x18\x05 \x01(\t\x12<\n\x08metadata\x18\x06 \x03(\x0b\x32*.pb.gubernator.RateLimitResp.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"5\n\x11\x43learRateLimitReq\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nunique_key\x18\x02 \x01(\t\"F\n\x12\x43learRateLimitResp\x12\r\n\x05limit\x18\x01 \x01(\x03\x12\x12\n\nreset_time\x18\x02 \x01(\x03\x12\r\n\x05\x65rror\x18\x03 \x01(\t\"\x10\n\x0eHealthCheckReq\"F\n\x0fHealthCheckResp\x12\x0e\n\x06status\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x12\n\npeer_count\x18\x03 \x01(\x05*/\n\tAlgorithm\x12\x10\n\x0cTOKEN_BUCKET\x10\x00\x12\x10\n\x0cLEAKY_BUCKET\x10\x01*\x8c\x01\n\x08\x42\x65havior\x12\x0c\n\x08\x42\x41TCHING\x10\x00\x12\x0f\n\x0bNO_BATCHING\x10\x01\x12\n\n\x06GLOBAL\x10\x02\x12\x19\n\x15\x44URATION_IS_GREGORIAN\x10\x04\x12\x13\n\x0fRESET_REMAINING\x10\x08\x12\x10\n\x0cMULTI_REGION\x10\x10\x12\x13\n\x0f\x44RAIN_OVERLIMIT\x10 *)\n\x06Status\x12\x0f\n\x0bUNDER_LIMIT\x10\x00\x12\x0e\n\nOVER_LIMIT\x10\x01\x32\xd7\x02\n\x02V1\x12p\n\rGetRateLimits\x12\x1f.pb.gubernator.GetRateLimitsReq\x1a .pb.gubernator.GetRateLimitsResp\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/v1/GetRateLimits:\x01*\x12x\n\x0f\x43learRateLimits\x12!.pb.gubernator.ClearRateLimitsReq\x1a\".pb.gubernator.ClearRateLimitsResp\"\x1e\x82\xd3\xe4\x93\x02\x18\"\x13/v1/ClearRateLimits:\x01*\x12\x65\n\x0bHealthCheck\x12\x1d.pb.gubernator.HealthCheckReq\x1a\x1e.pb.gubernator.HealthCheckResp\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/HealthCheckB\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'gubernator_pb2', globals()) @@ -28,30 +28,40 @@ _RATELIMITRESP_METADATAENTRY._serialized_options = b'8\001' _V1.methods_by_name['GetRateLimits']._options = None _V1.methods_by_name['GetRateLimits']._serialized_options = b'\202\323\344\223\002\026\"\021/v1/GetRateLimits:\001*' + _V1.methods_by_name['ClearRateLimits']._options = None + _V1.methods_by_name['ClearRateLimits']._serialized_options = b'\202\323\344\223\002\030\"\023/v1/ClearRateLimits:\001*' _V1.methods_by_name['HealthCheck']._options = None _V1.methods_by_name['HealthCheck']._serialized_options = b'\202\323\344\223\002\021\022\017/v1/HealthCheck' - _ALGORITHM._serialized_start=840 - _ALGORITHM._serialized_end=887 - _BEHAVIOR._serialized_start=889 - _BEHAVIOR._serialized_end=1008 - _STATUS._serialized_start=1010 - _STATUS._serialized_end=1051 + _ALGORITHM._serialized_start=1118 + _ALGORITHM._serialized_end=1165 + _BEHAVIOR._serialized_start=1168 + _BEHAVIOR._serialized_end=1308 + _STATUS._serialized_start=1310 + _STATUS._serialized_end=1351 _GETRATELIMITSREQ._serialized_start=65 _GETRATELIMITSREQ._serialized_end=130 _GETRATELIMITSRESP._serialized_start=132 _GETRATELIMITSRESP._serialized_end=200 - _RATELIMITREQ._serialized_start=203 - _RATELIMITREQ._serialized_end=511 - _RATELIMITREQ_METADATAENTRY._serialized_start=464 - _RATELIMITREQ_METADATAENTRY._serialized_end=511 - _RATELIMITRESP._serialized_start=514 - _RATELIMITRESP._serialized_end=748 - _RATELIMITRESP_METADATAENTRY._serialized_start=464 - _RATELIMITRESP_METADATAENTRY._serialized_end=511 - _HEALTHCHECKREQ._serialized_start=750 - _HEALTHCHECKREQ._serialized_end=766 - _HEALTHCHECKRESP._serialized_start=768 - _HEALTHCHECKRESP._serialized_end=838 - _V1._serialized_start=1054 - _V1._serialized_end=1275 + _CLEARRATELIMITSREQ._serialized_start=202 + _CLEARRATELIMITSREQ._serialized_end=274 + _CLEARRATELIMITSRESP._serialized_start=276 + _CLEARRATELIMITSRESP._serialized_end=351 + _RATELIMITREQ._serialized_start=354 + _RATELIMITREQ._serialized_end=662 + _RATELIMITREQ_METADATAENTRY._serialized_start=615 + _RATELIMITREQ_METADATAENTRY._serialized_end=662 + _RATELIMITRESP._serialized_start=665 + _RATELIMITRESP._serialized_end=899 + _RATELIMITRESP_METADATAENTRY._serialized_start=615 + _RATELIMITRESP_METADATAENTRY._serialized_end=662 + _CLEARRATELIMITREQ._serialized_start=901 + _CLEARRATELIMITREQ._serialized_end=954 + _CLEARRATELIMITRESP._serialized_start=956 + _CLEARRATELIMITRESP._serialized_end=1026 + _HEALTHCHECKREQ._serialized_start=1028 + _HEALTHCHECKREQ._serialized_end=1044 + _HEALTHCHECKRESP._serialized_start=1046 + _HEALTHCHECKRESP._serialized_end=1116 + _V1._serialized_start=1354 + _V1._serialized_end=1697 # @@protoc_insertion_point(module_scope) diff --git a/python/gubernator/gubernator_pb2_grpc.py b/python/gubernator/gubernator_pb2_grpc.py index 02dd7792..5ceb8747 100644 --- a/python/gubernator/gubernator_pb2_grpc.py +++ b/python/gubernator/gubernator_pb2_grpc.py @@ -19,6 +19,11 @@ def __init__(self, channel): request_serializer=gubernator__pb2.GetRateLimitsReq.SerializeToString, response_deserializer=gubernator__pb2.GetRateLimitsResp.FromString, ) + self.ClearRateLimits = channel.unary_unary( + '/pb.gubernator.V1/ClearRateLimits', + request_serializer=gubernator__pb2.ClearRateLimitsReq.SerializeToString, + response_deserializer=gubernator__pb2.ClearRateLimitsResp.FromString, + ) self.HealthCheck = channel.unary_unary( '/pb.gubernator.V1/HealthCheck', request_serializer=gubernator__pb2.HealthCheckReq.SerializeToString, @@ -36,6 +41,12 @@ def GetRateLimits(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def ClearRateLimits(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def HealthCheck(self, request, context): """This method is for round trip benchmarking and can be used by the client to determine connectivity to the server @@ -52,6 +63,11 @@ def add_V1Servicer_to_server(servicer, server): request_deserializer=gubernator__pb2.GetRateLimitsReq.FromString, response_serializer=gubernator__pb2.GetRateLimitsResp.SerializeToString, ), + 'ClearRateLimits': grpc.unary_unary_rpc_method_handler( + servicer.ClearRateLimits, + request_deserializer=gubernator__pb2.ClearRateLimitsReq.FromString, + response_serializer=gubernator__pb2.ClearRateLimitsResp.SerializeToString, + ), 'HealthCheck': grpc.unary_unary_rpc_method_handler( servicer.HealthCheck, request_deserializer=gubernator__pb2.HealthCheckReq.FromString, @@ -84,6 +100,23 @@ def GetRateLimits(request, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod + def ClearRateLimits(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/pb.gubernator.V1/ClearRateLimits', + gubernator__pb2.ClearRateLimitsReq.SerializeToString, + gubernator__pb2.ClearRateLimitsResp.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod def HealthCheck(request, target, From 770ccf2b9a9cdda2a3fcb44b970f297acdb4a00d Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 11:24:39 -0500 Subject: [PATCH 03/15] Implement `DRAIN_OVERLIMIT` behavior. --- algorithms.go | 10 +++++++ functional_test.go | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/algorithms.go b/algorithms.go index c7e6315c..eedd47f0 100644 --- a/algorithms.go +++ b/algorithms.go @@ -181,6 +181,11 @@ func tokenBucket(ctx context.Context, s Store, c Cache, r *RateLimitReq) (resp * trace.SpanFromContext(ctx).AddEvent("Over the limit") metricOverLimitCounter.Add(1) rl.Status = Status_OVER_LIMIT + if HasBehavior(r.Behavior, Behavior_DRAIN_OVERLIMIT) { + // DRAIN_OVERLIMIT behavior drains the remaining counter. + t.Remaining = 0 + rl.Remaining = 0 + } return rl, nil } @@ -394,6 +399,11 @@ func leakyBucket(ctx context.Context, s Store, c Cache, r *RateLimitReq) (resp * if r.Hits > int64(b.Remaining) { metricOverLimitCounter.Add(1) rl.Status = Status_OVER_LIMIT + if HasBehavior(r.Behavior, Behavior_DRAIN_OVERLIMIT) { + // DRAIN_OVERLIMIT behavior drains the remaining counter. + b.Remaining = 0 + rl.Remaining = 0 + } return rl, nil } diff --git a/functional_test.go b/functional_test.go index 6225fc3e..a7223536 100644 --- a/functional_test.go +++ b/functional_test.go @@ -37,6 +37,14 @@ import ( json "google.golang.org/protobuf/encoding/protojson" ) +var algos = []struct{ + Name string + Algorithm guber.Algorithm +}{ + {Name: "Token bucket", Algorithm: guber.Algorithm_TOKEN_BUCKET}, + {Name: "Leaky bucket", Algorithm: guber.Algorithm_LEAKY_BUCKET}, +} + // Setup and shutdown the mock gubernator cluster for the entire test suite func TestMain(m *testing.M) { if err := cluster.StartWith([]guber.PeerInfo{ @@ -363,6 +371,72 @@ func TestTokenBucketNegativeHits(t *testing.T) { } } +func TestDrainOverlimit(t *testing.T) { + defer clock.Freeze(clock.Now()).Unfreeze() + client, errs := guber.DialV1Server(cluster.PeerAt(0).GRPCAddress, nil) + require.Nil(t, errs) + + tests := []struct { + Name string + Hits int64 + Remaining int64 + Status guber.Status + }{ + { + Name: "check remaining before hit", + Hits: 0, + Remaining: 10, + Status: guber.Status_UNDER_LIMIT, + }, { + Name: "first hit", + Hits: 1, + Remaining: 9, + Status: guber.Status_UNDER_LIMIT, + }, { + Name: "overlimit hit", + Hits: 100, + Remaining: 0, + Status: guber.Status_OVER_LIMIT, + }, { + Name: "check remaining", + Hits: 0, + Remaining: 0, + Status: guber.Status_UNDER_LIMIT, + }, + } + + for idx, algoCase := range algos { + t.Run(algoCase.Name, func(t *testing.T) { + for _, test := range tests { + ctx := context.Background() + t.Run(test.Name, func(t *testing.T) { + resp, err := client.GetRateLimits(ctx, &guber.GetRateLimitsReq{ + Requests: []*guber.RateLimitReq{ + { + Name: "test_drain_overlimit", + UniqueKey: fmt.Sprintf("account:1234:%d", idx), + Algorithm: algoCase.Algorithm, + Behavior: guber.Behavior_DRAIN_OVERLIMIT, + Duration: guber.Second * 30, + Hits: test.Hits, + Limit: 10, + }, + }, + }) + require.NoError(t, err) + require.Len(t, resp.Responses, 1) + + rl := resp.Responses[0] + assert.Equal(t, test.Status, rl.Status) + assert.Equal(t, test.Remaining, rl.Remaining) + assert.Equal(t, int64(10), rl.Limit) + assert.NotZero(t, rl.ResetTime) + }) + } + }) + } +} + func TestLeakyBucket(t *testing.T) { defer clock.Freeze(clock.Now()).Unfreeze() From d784e493d9b158671c1394eae6cc6f6b57ba7e39 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 11:28:55 -0500 Subject: [PATCH 04/15] Fix lint error. --- functional_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functional_test.go b/functional_test.go index a7223536..37f787ad 100644 --- a/functional_test.go +++ b/functional_test.go @@ -37,8 +37,8 @@ import ( json "google.golang.org/protobuf/encoding/protojson" ) -var algos = []struct{ - Name string +var algos = []struct { + Name string Algorithm guber.Algorithm }{ {Name: "Token bucket", Algorithm: guber.Algorithm_TOKEN_BUCKET}, From acfcbcbeeb2d5e69dad28219a0ca90f3917c7c8c Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 11:32:29 -0500 Subject: [PATCH 05/15] Update golangci-lint. --- .github/workflows/lint.yaml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 80090b0c..40905596 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -6,7 +6,7 @@ on: pull_request: env: - GOLANGCI_LINT_VERSION: v1.54.2 + GOLANGCI_LINT_VERSION: v1.55.2 jobs: lint: diff --git a/Makefile b/Makefile index bfe0ecb9..57537447 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION=$(shell cat version) LDFLAGS="-X main.Version=$(VERSION)" GOLANGCI_LINT = $(GOPATH)/bin/golangci-lint -GOLANGCI_LINT_VERSION = 1.54.2 +GOLANGCI_LINT_VERSION = 1.55.2 $(GOLANGCI_LINT): curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION) From 0a3869c3f4fa95973e443367ab11a8a5461e5029 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 11:33:23 -0500 Subject: [PATCH 06/15] go mod tidy --- go.mod | 11 ++++++++++- go.sum | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index f77c41bd..3e2b61b9 100644 --- a/go.mod +++ b/go.mod @@ -24,6 +24,7 @@ require ( go.opentelemetry.io/otel/trace v1.21.0 golang.org/x/net v0.18.0 golang.org/x/time v0.3.0 + google.golang.org/api v0.126.0 google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.32.0 @@ -34,6 +35,8 @@ require ( ) require ( + cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect github.com/armon/go-metrics v0.4.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect @@ -44,10 +47,15 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/btree v1.1.1 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.1.0 // indirect + github.com/google/s2a-go v0.1.4 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect + github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/googleapis/gnostic v0.5.5 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect @@ -69,6 +77,7 @@ require ( github.com/uptrace/opentelemetry-go-extra/otelutil v0.2.1 // indirect go.etcd.io/etcd/api/v3 v3.5.5 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect + go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect @@ -79,6 +88,7 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.21.0 // indirect + golang.org/x/crypto v0.15.0 // indirect golang.org/x/mod v0.8.0 // indirect golang.org/x/oauth2 v0.12.0 // indirect golang.org/x/sys v0.14.0 // indirect @@ -88,7 +98,6 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 8630cb13..353112a1 100644 --- a/go.sum +++ b/go.sum @@ -18,7 +18,6 @@ cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmW cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -26,7 +25,9 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= +cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -90,7 +91,10 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -157,6 +161,7 @@ github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -221,10 +226,17 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= +github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= +github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= +github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= @@ -399,6 +411,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= @@ -411,6 +424,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/etcd/api/v3 v3.5.5 h1:BX4JIbQ7hl7+jL+g+2j5UAr0o1bctCm6/Ct+ArBGkf0= go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8= go.etcd.io/etcd/client/pkg/v3 v3.5.5 h1:9S0JUVvmrVl7wCF39iTQthdaaNIiAaQbmK75ogO6GU8= @@ -424,6 +438,8 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= @@ -467,6 +483,10 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -502,6 +522,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -546,9 +567,11 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -578,6 +601,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -639,7 +663,9 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= @@ -657,6 +683,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -719,6 +746,7 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -747,6 +775,8 @@ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34q google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= +google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -824,10 +854,9 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= 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= @@ -841,8 +870,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= From 148f5b67046e1bbfcf448ec85f9a2a7f9c15da78 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 14:10:14 -0500 Subject: [PATCH 07/15] Fix holster requirement. --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3e2b61b9..abb3159f 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 github.com/hashicorp/memberlist v0.5.0 github.com/mailgun/errors v0.1.5 - github.com/mailgun/holster/v4 v4.16.2-0.20231121154636-69040cb71a3b + github.com/mailgun/holster/v4 v4.16.3 github.com/miekg/dns v1.1.50 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.13.0 diff --git a/go.sum b/go.sum index 353112a1..90c8650a 100644 --- a/go.sum +++ b/go.sum @@ -303,8 +303,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailgun/errors v0.1.5 h1:riRpZqfUKTdc8saXvoEg2tYkbRyZESU1KvQ3UxPbdus= github.com/mailgun/errors v0.1.5/go.mod h1:lw+Nh4r/aoUTz6uK915FdfZJo3yq60gPiflFHNpK4NQ= -github.com/mailgun/holster/v4 v4.16.2-0.20231121154636-69040cb71a3b h1:ohMhrwmmA4JbXNukFpriztFWEVLlMuL90Cssg2Vl2TU= -github.com/mailgun/holster/v4 v4.16.2-0.20231121154636-69040cb71a3b/go.mod h1:phAg61z7LZ1PBfedyt2GXkGSlHhuVKK9AcVJO+Cm0/U= +github.com/mailgun/holster/v4 v4.16.3 h1:YMTkDoaFV83ViSaFuAfiyIvzrHJD1UNw7RjNv6J3Kfg= +github.com/mailgun/holster/v4 v4.16.3/go.mod h1:phAg61z7LZ1PBfedyt2GXkGSlHhuVKK9AcVJO+Cm0/U= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= From 8db85a4d0d9db3a0873c2bb43976864e507246b9 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 14:23:29 -0500 Subject: [PATCH 08/15] Fix go mod tidy. --- go.mod | 1 + go.sum | 2 ++ tools.go | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tools.go diff --git a/go.mod b/go.mod index abb3159f..113d4e31 100644 --- a/go.mod +++ b/go.mod @@ -27,6 +27,7 @@ require ( google.golang.org/api v0.126.0 google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b google.golang.org/grpc v1.59.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 google.golang.org/protobuf v1.32.0 k8s.io/api v0.23.3 k8s.io/apimachinery v0.23.3 diff --git a/go.sum b/go.sum index 90c8650a..a145afc5 100644 --- a/go.sum +++ b/go.sum @@ -857,6 +857,8 @@ google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzI google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= 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= diff --git a/tools.go b/tools.go new file mode 100644 index 00000000..4db554ff --- /dev/null +++ b/tools.go @@ -0,0 +1,18 @@ +//go:build tools + +package gubernator + +import ( + _ "cloud.google.com/go/compute" + _ "cloud.google.com/go/compute/metadata" + _ "github.com/golang/groupcache" + _ "github.com/google/s2a-go" + _ "github.com/google/uuid" + _ "github.com/googleapis/enterprise-certificate-proxy" + _ "github.com/googleapis/gax-go" + _ "go.opencensus.io" + _ "golang.org/x/crypto" + _ "google.golang.org/api" + _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" + _ "google.golang.org/protobuf/cmd/protoc-gen-go" +) From 120884e1abd2791e369f23c4fb7fd7eed1757061 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 14:39:19 -0500 Subject: [PATCH 09/15] Move protobuf compile to `buf` tool. --- Makefile | 3 +- contrib/proto.sh | 42 ------------ go.mod | 11 ---- go.sum | 35 +--------- gubernator.pb.go | 2 +- gubernator_grpc.pb.go | 8 +-- peers.pb.go | 2 +- peers_grpc.pb.go | 8 +-- python/gubernator/gubernator_pb2.py | 99 +++++++++++++++-------------- python/gubernator/peers_pb2.py | 39 ++++++------ tools.go | 18 ------ 11 files changed, 81 insertions(+), 186 deletions(-) delete mode 100755 contrib/proto.sh delete mode 100644 tools.go diff --git a/Makefile b/Makefile index 57537447..713cd3f0 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,8 @@ clean: .PHONY: proto proto: - contrib/proto.sh + # Install buf: https://buf.build/docs/installation + buf generate .PHONY: certs certs: diff --git a/contrib/proto.sh b/contrib/proto.sh deleted file mode 100755 index 9af7c769..00000000 --- a/contrib/proto.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# This script assumes that protoc is installed and available on the PATH. - -# Make sure the script fails fast. -set -eux - -SCRIPT_PATH=$(dirname "$0") # relative -REPO_ROOT=$(cd "${SCRIPT_PATH}/.." && pwd) # absolutized and normalized -SRC_DIR=$REPO_ROOT -PYTHON_DST_DIR=$REPO_ROOT/python/gubernator -GOLANG_DST_DIR=$REPO_ROOT - -# Build Golang stabs -go get google.golang.org/protobuf/cmd/protoc-gen-go -go install google.golang.org/protobuf/cmd/protoc-gen-go -go get google.golang.org/grpc/cmd/protoc-gen-go-grpc -go install google.golang.org/grpc/cmd/protoc-gen-go-grpc - -mkdir -p "$GOLANG_DST_DIR" -go install google.golang.org/protobuf/cmd/protoc-gen-go -go install google.golang.org/grpc/cmd/protoc-gen-go-grpc -echo "PATH=$PATH" -export PATH=$PATH:$(go env GOPATH)/bin -protoc -I=$SRC_DIR \ - -I=$SRC_DIR/googleapis \ - --go_out=$GOLANG_DST_DIR \ - --go_opt=paths=source_relative \ - --go-grpc_out=$GOLANG_DST_DIR \ - --go-grpc_opt=paths=source_relative \ - $SRC_DIR/*.proto - -# Build Python stabs -mkdir -p "$PYTHON_DST_DIR" -pip3 install grpcio -pip3 install grpcio-tools -python3 -m grpc.tools.protoc \ - -I=$SRC_DIR \ - -I=$SRC_DIR/googleapis \ - --python_out=$PYTHON_DST_DIR \ - --grpc_python_out=$PYTHON_DST_DIR \ - $SRC_DIR/*.proto -touch $PYTHON_DST_DIR/__init__.py diff --git a/go.mod b/go.mod index 113d4e31..e32b4cd3 100644 --- a/go.mod +++ b/go.mod @@ -24,10 +24,8 @@ require ( go.opentelemetry.io/otel/trace v1.21.0 golang.org/x/net v0.18.0 golang.org/x/time v0.3.0 - google.golang.org/api v0.126.0 google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b google.golang.org/grpc v1.59.0 - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 google.golang.org/protobuf v1.32.0 k8s.io/api v0.23.3 k8s.io/apimachinery v0.23.3 @@ -36,8 +34,6 @@ require ( ) require ( - cloud.google.com/go/compute v1.23.0 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect github.com/armon/go-metrics v0.4.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect @@ -48,15 +44,10 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/btree v1.1.1 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.1.0 // indirect - github.com/google/s2a-go v0.1.4 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/googleapis/gnostic v0.5.5 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect @@ -78,7 +69,6 @@ require ( github.com/uptrace/opentelemetry-go-extra/otelutil v0.2.1 // indirect go.etcd.io/etcd/api/v3 v3.5.5 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect - go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect @@ -89,7 +79,6 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/crypto v0.15.0 // indirect golang.org/x/mod v0.8.0 // indirect golang.org/x/oauth2 v0.12.0 // indirect golang.org/x/sys v0.14.0 // indirect diff --git a/go.sum b/go.sum index a145afc5..9b2e3287 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +18,7 @@ cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmW cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -25,9 +26,7 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -91,10 +90,7 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -161,7 +157,6 @@ github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -226,17 +221,10 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= @@ -411,7 +399,6 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= @@ -424,7 +411,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/etcd/api/v3 v3.5.5 h1:BX4JIbQ7hl7+jL+g+2j5UAr0o1bctCm6/Ct+ArBGkf0= go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8= go.etcd.io/etcd/client/pkg/v3 v3.5.5 h1:9S0JUVvmrVl7wCF39iTQthdaaNIiAaQbmK75ogO6GU8= @@ -438,8 +424,6 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= @@ -483,10 +467,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -522,7 +502,6 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -567,11 +546,9 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -601,7 +578,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -663,9 +639,7 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= @@ -683,7 +657,6 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -746,7 +719,6 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -775,8 +747,6 @@ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34q google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -854,11 +824,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= 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= diff --git a/gubernator.pb.go b/gubernator.pb.go index a1902f88..dcdeec31 100644 --- a/gubernator.pb.go +++ b/gubernator.pb.go @@ -16,7 +16,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.32.0 -// protoc v4.24.4 +// protoc (unknown) // source: gubernator.proto package gubernator diff --git a/gubernator_grpc.pb.go b/gubernator_grpc.pb.go index e07fad44..7fc5b622 100644 --- a/gubernator_grpc.pb.go +++ b/gubernator_grpc.pb.go @@ -16,7 +16,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc (unknown) // source: gubernator.proto package gubernator @@ -87,7 +87,7 @@ func (c *v1Client) HealthCheck(ctx context.Context, in *HealthCheckReq, opts ... } // V1Server is the server API for V1 service. -// All implementations must embed UnimplementedV1Server +// All implementations should embed UnimplementedV1Server // for forward compatibility type V1Server interface { // Given a list of rate limit requests, return the rate limits of each. @@ -96,10 +96,9 @@ type V1Server interface { // This method is for round trip benchmarking and can be used by // the client to determine connectivity to the server HealthCheck(context.Context, *HealthCheckReq) (*HealthCheckResp, error) - mustEmbedUnimplementedV1Server() } -// UnimplementedV1Server must be embedded to have forward compatible implementations. +// UnimplementedV1Server should be embedded to have forward compatible implementations. type UnimplementedV1Server struct { } @@ -112,7 +111,6 @@ func (UnimplementedV1Server) ClearRateLimits(context.Context, *ClearRateLimitsRe func (UnimplementedV1Server) HealthCheck(context.Context, *HealthCheckReq) (*HealthCheckResp, error) { return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") } -func (UnimplementedV1Server) mustEmbedUnimplementedV1Server() {} // UnsafeV1Server may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to V1Server will diff --git a/peers.pb.go b/peers.pb.go index f825f32c..a805b29a 100644 --- a/peers.pb.go +++ b/peers.pb.go @@ -16,7 +16,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.32.0 -// protoc v4.24.4 +// protoc (unknown) // source: peers.proto package gubernator diff --git a/peers_grpc.pb.go b/peers_grpc.pb.go index ed722062..33db74af 100644 --- a/peers_grpc.pb.go +++ b/peers_grpc.pb.go @@ -16,7 +16,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc (unknown) // source: peers.proto package gubernator @@ -75,17 +75,16 @@ func (c *peersV1Client) UpdatePeerGlobals(ctx context.Context, in *UpdatePeerGlo } // PeersV1Server is the server API for PeersV1 service. -// All implementations must embed UnimplementedPeersV1Server +// All implementations should embed UnimplementedPeersV1Server // for forward compatibility type PeersV1Server interface { // Used by peers to relay batches of requests to an authoritative peer GetPeerRateLimits(context.Context, *GetPeerRateLimitsReq) (*GetPeerRateLimitsResp, error) // Used by peers send global rate limit updates to other peers UpdatePeerGlobals(context.Context, *UpdatePeerGlobalsReq) (*UpdatePeerGlobalsResp, error) - mustEmbedUnimplementedPeersV1Server() } -// UnimplementedPeersV1Server must be embedded to have forward compatible implementations. +// UnimplementedPeersV1Server should be embedded to have forward compatible implementations. type UnimplementedPeersV1Server struct { } @@ -95,7 +94,6 @@ func (UnimplementedPeersV1Server) GetPeerRateLimits(context.Context, *GetPeerRat func (UnimplementedPeersV1Server) UpdatePeerGlobals(context.Context, *UpdatePeerGlobalsReq) (*UpdatePeerGlobalsResp, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdatePeerGlobals not implemented") } -func (UnimplementedPeersV1Server) mustEmbedUnimplementedPeersV1Server() {} // UnsafePeersV1Server may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PeersV1Server will diff --git a/python/gubernator/gubernator_pb2.py b/python/gubernator/gubernator_pb2.py index 76247b83..c77ccba9 100644 --- a/python/gubernator/gubernator_pb2.py +++ b/python/gubernator/gubernator_pb2.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: gubernator.proto +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" -from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -14,54 +15,54 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10gubernator.proto\x12\rpb.gubernator\x1a\x1cgoogle/api/annotations.proto\"A\n\x10GetRateLimitsReq\x12-\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReq\"D\n\x11GetRateLimitsResp\x12/\n\tresponses\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitResp\"H\n\x12\x43learRateLimitsReq\x12\x32\n\x08requests\x18\x01 \x03(\x0b\x32 .pb.gubernator.ClearRateLimitReq\"K\n\x13\x43learRateLimitsResp\x12\x34\n\tresponses\x18\x01 \x03(\x0b\x32!.pb.gubernator.ClearRateLimitResp\"\xb4\x02\n\x0cRateLimitReq\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nunique_key\x18\x02 \x01(\t\x12\x0c\n\x04hits\x18\x03 \x01(\x03\x12\r\n\x05limit\x18\x04 \x01(\x03\x12\x10\n\x08\x64uration\x18\x05 \x01(\x03\x12+\n\talgorithm\x18\x06 \x01(\x0e\x32\x18.pb.gubernator.Algorithm\x12)\n\x08\x62\x65havior\x18\x07 \x01(\x0e\x32\x17.pb.gubernator.Behavior\x12\r\n\x05\x62urst\x18\x08 \x01(\x03\x12;\n\x08metadata\x18\t \x03(\x0b\x32).pb.gubernator.RateLimitReq.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xea\x01\n\rRateLimitResp\x12%\n\x06status\x18\x01 \x01(\x0e\x32\x15.pb.gubernator.Status\x12\r\n\x05limit\x18\x02 \x01(\x03\x12\x11\n\tremaining\x18\x03 \x01(\x03\x12\x12\n\nreset_time\x18\x04 \x01(\x03\x12\r\n\x05\x65rror\x18\x05 \x01(\t\x12<\n\x08metadata\x18\x06 \x03(\x0b\x32*.pb.gubernator.RateLimitResp.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"5\n\x11\x43learRateLimitReq\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nunique_key\x18\x02 \x01(\t\"F\n\x12\x43learRateLimitResp\x12\r\n\x05limit\x18\x01 \x01(\x03\x12\x12\n\nreset_time\x18\x02 \x01(\x03\x12\r\n\x05\x65rror\x18\x03 \x01(\t\"\x10\n\x0eHealthCheckReq\"F\n\x0fHealthCheckResp\x12\x0e\n\x06status\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x12\n\npeer_count\x18\x03 \x01(\x05*/\n\tAlgorithm\x12\x10\n\x0cTOKEN_BUCKET\x10\x00\x12\x10\n\x0cLEAKY_BUCKET\x10\x01*\x8c\x01\n\x08\x42\x65havior\x12\x0c\n\x08\x42\x41TCHING\x10\x00\x12\x0f\n\x0bNO_BATCHING\x10\x01\x12\n\n\x06GLOBAL\x10\x02\x12\x19\n\x15\x44URATION_IS_GREGORIAN\x10\x04\x12\x13\n\x0fRESET_REMAINING\x10\x08\x12\x10\n\x0cMULTI_REGION\x10\x10\x12\x13\n\x0f\x44RAIN_OVERLIMIT\x10 *)\n\x06Status\x12\x0f\n\x0bUNDER_LIMIT\x10\x00\x12\x0e\n\nOVER_LIMIT\x10\x01\x32\xd7\x02\n\x02V1\x12p\n\rGetRateLimits\x12\x1f.pb.gubernator.GetRateLimitsReq\x1a .pb.gubernator.GetRateLimitsResp\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/v1/GetRateLimits:\x01*\x12x\n\x0f\x43learRateLimits\x12!.pb.gubernator.ClearRateLimitsReq\x1a\".pb.gubernator.ClearRateLimitsResp\"\x1e\x82\xd3\xe4\x93\x02\x18\"\x13/v1/ClearRateLimits:\x01*\x12\x65\n\x0bHealthCheck\x12\x1d.pb.gubernator.HealthCheckReq\x1a\x1e.pb.gubernator.HealthCheckResp\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/HealthCheckB\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10gubernator.proto\x12\rpb.gubernator\x1a\x1cgoogle/api/annotations.proto\"K\n\x10GetRateLimitsReq\x12\x37\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReqR\x08requests\"O\n\x11GetRateLimitsResp\x12:\n\tresponses\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitRespR\tresponses\"R\n\x12\x43learRateLimitsReq\x12<\n\x08requests\x18\x01 \x03(\x0b\x32 .pb.gubernator.ClearRateLimitReqR\x08requests\"V\n\x13\x43learRateLimitsResp\x12?\n\tresponses\x18\x01 \x03(\x0b\x32!.pb.gubernator.ClearRateLimitRespR\tresponses\"\x8e\x03\n\x0cRateLimitReq\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n\nunique_key\x18\x02 \x01(\tR\tuniqueKey\x12\x12\n\x04hits\x18\x03 \x01(\x03R\x04hits\x12\x14\n\x05limit\x18\x04 \x01(\x03R\x05limit\x12\x1a\n\x08\x64uration\x18\x05 \x01(\x03R\x08\x64uration\x12\x36\n\talgorithm\x18\x06 \x01(\x0e\x32\x18.pb.gubernator.AlgorithmR\talgorithm\x12\x33\n\x08\x62\x65havior\x18\x07 \x01(\x0e\x32\x17.pb.gubernator.BehaviorR\x08\x62\x65havior\x12\x14\n\x05\x62urst\x18\x08 \x01(\x03R\x05\x62urst\x12\x45\n\x08metadata\x18\t \x03(\x0b\x32).pb.gubernator.RateLimitReq.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\xac\x02\n\rRateLimitResp\x12-\n\x06status\x18\x01 \x01(\x0e\x32\x15.pb.gubernator.StatusR\x06status\x12\x14\n\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x1c\n\tremaining\x18\x03 \x01(\x03R\tremaining\x12\x1d\n\nreset_time\x18\x04 \x01(\x03R\tresetTime\x12\x14\n\x05\x65rror\x18\x05 \x01(\tR\x05\x65rror\x12\x46\n\x08metadata\x18\x06 \x03(\x0b\x32*.pb.gubernator.RateLimitResp.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"F\n\x11\x43learRateLimitReq\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n\nunique_key\x18\x02 \x01(\tR\tuniqueKey\"_\n\x12\x43learRateLimitResp\x12\x14\n\x05limit\x18\x01 \x01(\x03R\x05limit\x12\x1d\n\nreset_time\x18\x02 \x01(\x03R\tresetTime\x12\x14\n\x05\x65rror\x18\x03 \x01(\tR\x05\x65rror\"\x10\n\x0eHealthCheckReq\"b\n\x0fHealthCheckResp\x12\x16\n\x06status\x18\x01 \x01(\tR\x06status\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12\x1d\n\npeer_count\x18\x03 \x01(\x05R\tpeerCount*/\n\tAlgorithm\x12\x10\n\x0cTOKEN_BUCKET\x10\x00\x12\x10\n\x0cLEAKY_BUCKET\x10\x01*\x8c\x01\n\x08\x42\x65havior\x12\x0c\n\x08\x42\x41TCHING\x10\x00\x12\x0f\n\x0bNO_BATCHING\x10\x01\x12\n\n\x06GLOBAL\x10\x02\x12\x19\n\x15\x44URATION_IS_GREGORIAN\x10\x04\x12\x13\n\x0fRESET_REMAINING\x10\x08\x12\x10\n\x0cMULTI_REGION\x10\x10\x12\x13\n\x0f\x44RAIN_OVERLIMIT\x10 *)\n\x06Status\x12\x0f\n\x0bUNDER_LIMIT\x10\x00\x12\x0e\n\nOVER_LIMIT\x10\x01\x32\xd7\x02\n\x02V1\x12p\n\rGetRateLimits\x12\x1f.pb.gubernator.GetRateLimitsReq\x1a .pb.gubernator.GetRateLimitsResp\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/v1/GetRateLimits:\x01*\x12x\n\x0f\x43learRateLimits\x12!.pb.gubernator.ClearRateLimitsReq\x1a\".pb.gubernator.ClearRateLimitsResp\"\x1e\x82\xd3\xe4\x93\x02\x18\"\x13/v1/ClearRateLimits:\x01*\x12\x65\n\x0bHealthCheck\x12\x1d.pb.gubernator.HealthCheckReq\x1a\x1e.pb.gubernator.HealthCheckResp\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/HealthCheckB\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'gubernator_pb2', globals()) +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'gubernator_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'Z\035github.com/mailgun/gubernator\200\001\001' - _RATELIMITREQ_METADATAENTRY._options = None - _RATELIMITREQ_METADATAENTRY._serialized_options = b'8\001' - _RATELIMITRESP_METADATAENTRY._options = None - _RATELIMITRESP_METADATAENTRY._serialized_options = b'8\001' - _V1.methods_by_name['GetRateLimits']._options = None - _V1.methods_by_name['GetRateLimits']._serialized_options = b'\202\323\344\223\002\026\"\021/v1/GetRateLimits:\001*' - _V1.methods_by_name['ClearRateLimits']._options = None - _V1.methods_by_name['ClearRateLimits']._serialized_options = b'\202\323\344\223\002\030\"\023/v1/ClearRateLimits:\001*' - _V1.methods_by_name['HealthCheck']._options = None - _V1.methods_by_name['HealthCheck']._serialized_options = b'\202\323\344\223\002\021\022\017/v1/HealthCheck' - _ALGORITHM._serialized_start=1118 - _ALGORITHM._serialized_end=1165 - _BEHAVIOR._serialized_start=1168 - _BEHAVIOR._serialized_end=1308 - _STATUS._serialized_start=1310 - _STATUS._serialized_end=1351 - _GETRATELIMITSREQ._serialized_start=65 - _GETRATELIMITSREQ._serialized_end=130 - _GETRATELIMITSRESP._serialized_start=132 - _GETRATELIMITSRESP._serialized_end=200 - _CLEARRATELIMITSREQ._serialized_start=202 - _CLEARRATELIMITSREQ._serialized_end=274 - _CLEARRATELIMITSRESP._serialized_start=276 - _CLEARRATELIMITSRESP._serialized_end=351 - _RATELIMITREQ._serialized_start=354 - _RATELIMITREQ._serialized_end=662 - _RATELIMITREQ_METADATAENTRY._serialized_start=615 - _RATELIMITREQ_METADATAENTRY._serialized_end=662 - _RATELIMITRESP._serialized_start=665 - _RATELIMITRESP._serialized_end=899 - _RATELIMITRESP_METADATAENTRY._serialized_start=615 - _RATELIMITRESP_METADATAENTRY._serialized_end=662 - _CLEARRATELIMITREQ._serialized_start=901 - _CLEARRATELIMITREQ._serialized_end=954 - _CLEARRATELIMITRESP._serialized_start=956 - _CLEARRATELIMITRESP._serialized_end=1026 - _HEALTHCHECKREQ._serialized_start=1028 - _HEALTHCHECKREQ._serialized_end=1044 - _HEALTHCHECKRESP._serialized_start=1046 - _HEALTHCHECKRESP._serialized_end=1116 - _V1._serialized_start=1354 - _V1._serialized_end=1697 + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'Z\035github.com/mailgun/gubernator\200\001\001' + _globals['_RATELIMITREQ_METADATAENTRY']._options = None + _globals['_RATELIMITREQ_METADATAENTRY']._serialized_options = b'8\001' + _globals['_RATELIMITRESP_METADATAENTRY']._options = None + _globals['_RATELIMITRESP_METADATAENTRY']._serialized_options = b'8\001' + _globals['_V1'].methods_by_name['GetRateLimits']._options = None + _globals['_V1'].methods_by_name['GetRateLimits']._serialized_options = b'\202\323\344\223\002\026\"\021/v1/GetRateLimits:\001*' + _globals['_V1'].methods_by_name['ClearRateLimits']._options = None + _globals['_V1'].methods_by_name['ClearRateLimits']._serialized_options = b'\202\323\344\223\002\030\"\023/v1/ClearRateLimits:\001*' + _globals['_V1'].methods_by_name['HealthCheck']._options = None + _globals['_V1'].methods_by_name['HealthCheck']._serialized_options = b'\202\323\344\223\002\021\022\017/v1/HealthCheck' + _globals['_ALGORITHM']._serialized_start=1386 + _globals['_ALGORITHM']._serialized_end=1433 + _globals['_BEHAVIOR']._serialized_start=1436 + _globals['_BEHAVIOR']._serialized_end=1576 + _globals['_STATUS']._serialized_start=1578 + _globals['_STATUS']._serialized_end=1619 + _globals['_GETRATELIMITSREQ']._serialized_start=65 + _globals['_GETRATELIMITSREQ']._serialized_end=140 + _globals['_GETRATELIMITSRESP']._serialized_start=142 + _globals['_GETRATELIMITSRESP']._serialized_end=221 + _globals['_CLEARRATELIMITSREQ']._serialized_start=223 + _globals['_CLEARRATELIMITSREQ']._serialized_end=305 + _globals['_CLEARRATELIMITSRESP']._serialized_start=307 + _globals['_CLEARRATELIMITSRESP']._serialized_end=393 + _globals['_RATELIMITREQ']._serialized_start=396 + _globals['_RATELIMITREQ']._serialized_end=794 + _globals['_RATELIMITREQ_METADATAENTRY']._serialized_start=735 + _globals['_RATELIMITREQ_METADATAENTRY']._serialized_end=794 + _globals['_RATELIMITRESP']._serialized_start=797 + _globals['_RATELIMITRESP']._serialized_end=1097 + _globals['_RATELIMITRESP_METADATAENTRY']._serialized_start=735 + _globals['_RATELIMITRESP_METADATAENTRY']._serialized_end=794 + _globals['_CLEARRATELIMITREQ']._serialized_start=1099 + _globals['_CLEARRATELIMITREQ']._serialized_end=1169 + _globals['_CLEARRATELIMITRESP']._serialized_start=1171 + _globals['_CLEARRATELIMITRESP']._serialized_end=1266 + _globals['_HEALTHCHECKREQ']._serialized_start=1268 + _globals['_HEALTHCHECKREQ']._serialized_end=1284 + _globals['_HEALTHCHECKRESP']._serialized_start=1286 + _globals['_HEALTHCHECKRESP']._serialized_end=1384 + _globals['_V1']._serialized_start=1622 + _globals['_V1']._serialized_end=1965 # @@protoc_insertion_point(module_scope) diff --git a/python/gubernator/peers_pb2.py b/python/gubernator/peers_pb2.py index 98ade704..53b40758 100644 --- a/python/gubernator/peers_pb2.py +++ b/python/gubernator/peers_pb2.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: peers.proto +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" -from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -14,24 +15,24 @@ import gubernator_pb2 as gubernator__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0bpeers.proto\x12\rpb.gubernator\x1a\x10gubernator.proto\"E\n\x14GetPeerRateLimitsReq\x12-\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReq\"J\n\x15GetPeerRateLimitsResp\x12\x31\n\x0brate_limits\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitResp\"H\n\x14UpdatePeerGlobalsReq\x12\x30\n\x07globals\x18\x01 \x03(\x0b\x32\x1f.pb.gubernator.UpdatePeerGlobal\"z\n\x10UpdatePeerGlobal\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x06status\x18\x02 \x01(\x0b\x32\x1c.pb.gubernator.RateLimitResp\x12+\n\talgorithm\x18\x03 \x01(\x0e\x32\x18.pb.gubernator.Algorithm\"\x17\n\x15UpdatePeerGlobalsResp2\xcd\x01\n\x07PeersV1\x12`\n\x11GetPeerRateLimits\x12#.pb.gubernator.GetPeerRateLimitsReq\x1a$.pb.gubernator.GetPeerRateLimitsResp\"\x00\x12`\n\x11UpdatePeerGlobals\x12#.pb.gubernator.UpdatePeerGlobalsReq\x1a$.pb.gubernator.UpdatePeerGlobalsResp\"\x00\x42\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0bpeers.proto\x12\rpb.gubernator\x1a\x10gubernator.proto\"O\n\x14GetPeerRateLimitsReq\x12\x37\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReqR\x08requests\"V\n\x15GetPeerRateLimitsResp\x12=\n\x0brate_limits\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitRespR\nrateLimits\"Q\n\x14UpdatePeerGlobalsReq\x12\x39\n\x07globals\x18\x01 \x03(\x0b\x32\x1f.pb.gubernator.UpdatePeerGlobalR\x07globals\"\x92\x01\n\x10UpdatePeerGlobal\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x34\n\x06status\x18\x02 \x01(\x0b\x32\x1c.pb.gubernator.RateLimitRespR\x06status\x12\x36\n\talgorithm\x18\x03 \x01(\x0e\x32\x18.pb.gubernator.AlgorithmR\talgorithm\"\x17\n\x15UpdatePeerGlobalsResp2\xcd\x01\n\x07PeersV1\x12`\n\x11GetPeerRateLimits\x12#.pb.gubernator.GetPeerRateLimitsReq\x1a$.pb.gubernator.GetPeerRateLimitsResp\"\x00\x12`\n\x11UpdatePeerGlobals\x12#.pb.gubernator.UpdatePeerGlobalsReq\x1a$.pb.gubernator.UpdatePeerGlobalsResp\"\x00\x42\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'peers_pb2', globals()) +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'peers_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'Z\035github.com/mailgun/gubernator\200\001\001' - _GETPEERRATELIMITSREQ._serialized_start=48 - _GETPEERRATELIMITSREQ._serialized_end=117 - _GETPEERRATELIMITSRESP._serialized_start=119 - _GETPEERRATELIMITSRESP._serialized_end=193 - _UPDATEPEERGLOBALSREQ._serialized_start=195 - _UPDATEPEERGLOBALSREQ._serialized_end=267 - _UPDATEPEERGLOBAL._serialized_start=269 - _UPDATEPEERGLOBAL._serialized_end=391 - _UPDATEPEERGLOBALSRESP._serialized_start=393 - _UPDATEPEERGLOBALSRESP._serialized_end=416 - _PEERSV1._serialized_start=419 - _PEERSV1._serialized_end=624 + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'Z\035github.com/mailgun/gubernator\200\001\001' + _globals['_GETPEERRATELIMITSREQ']._serialized_start=48 + _globals['_GETPEERRATELIMITSREQ']._serialized_end=127 + _globals['_GETPEERRATELIMITSRESP']._serialized_start=129 + _globals['_GETPEERRATELIMITSRESP']._serialized_end=215 + _globals['_UPDATEPEERGLOBALSREQ']._serialized_start=217 + _globals['_UPDATEPEERGLOBALSREQ']._serialized_end=298 + _globals['_UPDATEPEERGLOBAL']._serialized_start=301 + _globals['_UPDATEPEERGLOBAL']._serialized_end=447 + _globals['_UPDATEPEERGLOBALSRESP']._serialized_start=449 + _globals['_UPDATEPEERGLOBALSRESP']._serialized_end=472 + _globals['_PEERSV1']._serialized_start=475 + _globals['_PEERSV1']._serialized_end=680 # @@protoc_insertion_point(module_scope) diff --git a/tools.go b/tools.go deleted file mode 100644 index 4db554ff..00000000 --- a/tools.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build tools - -package gubernator - -import ( - _ "cloud.google.com/go/compute" - _ "cloud.google.com/go/compute/metadata" - _ "github.com/golang/groupcache" - _ "github.com/google/s2a-go" - _ "github.com/google/uuid" - _ "github.com/googleapis/enterprise-certificate-proxy" - _ "github.com/googleapis/gax-go" - _ "go.opencensus.io" - _ "golang.org/x/crypto" - _ "google.golang.org/api" - _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" - _ "google.golang.org/protobuf/cmd/protoc-gen-go" -) From ed7f198fa6960f72b89c79da9a95c84065248d25 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 14:50:55 -0500 Subject: [PATCH 10/15] Update .gitignore. --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 976cfb4f..1e85679c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,8 @@ .vscode/ __pycache__ *.pyc -gubernator.egg-info/ .DS_Store *.iml -googleapis/ coverage.out coverage.html /gubernator From 0ce98a7076a68dfe49e4095f15bf05ad8a10cd36 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 15:46:55 -0500 Subject: [PATCH 11/15] Implement `ForceDrainOverlimit` config option. --- config.go | 4 +++- gubernator.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index c46e2fa3..dd8e0eaa 100644 --- a/config.go +++ b/config.go @@ -62,8 +62,10 @@ type BehaviorConfig struct { GlobalTimeout time.Duration // The max number of global updates we can batch into a single peer request GlobalBatchLimit int - // ForceGlobal forces global mode on all rate limit checks. + // ForceGlobal forces global behavior on all rate limit checks. ForceGlobal bool + // ForceDrainOverlimit forces drain overlimit behavior on all rate limit checks. + ForceDrainOverlimit bool // Number of concurrent requests that will be made to peers. Defaults to 100 GlobalPeerRequestsConcurrency int diff --git a/gubernator.go b/gubernator.go index 59c26eca..56305a8b 100644 --- a/gubernator.go +++ b/gubernator.go @@ -225,6 +225,9 @@ func (s *V1Instance) GetRateLimits(ctx context.Context, r *GetRateLimitsReq) (*G if s.conf.Behaviors.ForceGlobal { SetBehavior(&req.Behavior, Behavior_GLOBAL, true) } + if s.conf.Behaviors.ForceDrainOverlimit { + SetBehavior(&req.Behavior, Behavior_DRAIN_OVERLIMIT, true) + } peer, err = s.GetPeer(ctx, key) if err != nil { From 341b8bc91b5672f803dfea39f870f970f0a26d50 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 15:57:02 -0500 Subject: [PATCH 12/15] Refactor `DRAIN_OVERLIMIT` to `DRAIN_OVER_LIMIT`. --- README.md | 20 ++++----- algorithms.go | 8 ++-- config.go | 4 +- functional_test.go | 8 ++-- gubernator.go | 4 +- gubernator.pb.go | 64 ++++++++++++++--------------- gubernator.proto | 4 +- python/gubernator/gubernator_pb2.py | 12 +++--- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 3fcf4023..733a217a 100644 --- a/README.md +++ b/README.md @@ -178,13 +178,13 @@ This will reset the rate limit as if created new on first use. When using Reset Remaining, the `Hits` field should be 0. -## Drain Overlimit Behavior -Users may add behavior `Behavior_DRAIN_OVERLIMIT` to the rate check request. A -`GetRateLimits` call drains the remaining counter on first overlimit event. Then, -successive `GetRateLimits` calls will return zero remaining counter and not any -residual value. +## Drain Over Limit Behavior +Users may add behavior `Behavior_DRAIN_OVER_LIMIT` to the rate check request. +A `GetRateLimits` call drains the remaining counter on first over limit event. +Then, successive `GetRateLimits` calls will return zero remaining counter and +not any residual value. -This facilitates scenarios that require an overlimit event to stay overlimit +This facilitates scenarios that require an over limit event to stay over limit until the rate limit resets. This approach is necessary if a process must make two rate checks, before and after a process, and the `Hit` amount is not known until after the process. @@ -193,12 +193,12 @@ until after the process. `Remaining` counter. If `Remaining` is zero, it's known that the rate limit is depleted and the process can be aborted. - After process: Call `GetRateLimits` with a user specified `Hits` value. If - the call returns overlimit, the process cannot be aborted because it had - already completed. Using `DRAIN_OVERLIMIT` behavior, the `Remaining` count + the call returns over limit, the process cannot be aborted because it had + already completed. Using `DRAIN_OVER_LIMIT` behavior, the `Remaining` count will be drained to zero. -Once an overlimit occurs in the "After" step, successive processes will detect -the overlimit state in the "Before" step. +Once an over limit occurs in the "After" step, successive processes will detect +the over limit state in the "Before" step. ## Gubernator as a library If you are using golang, you can use Gubernator as a library. This is useful if diff --git a/algorithms.go b/algorithms.go index eedd47f0..1fb8f9dd 100644 --- a/algorithms.go +++ b/algorithms.go @@ -181,8 +181,8 @@ func tokenBucket(ctx context.Context, s Store, c Cache, r *RateLimitReq) (resp * trace.SpanFromContext(ctx).AddEvent("Over the limit") metricOverLimitCounter.Add(1) rl.Status = Status_OVER_LIMIT - if HasBehavior(r.Behavior, Behavior_DRAIN_OVERLIMIT) { - // DRAIN_OVERLIMIT behavior drains the remaining counter. + if HasBehavior(r.Behavior, Behavior_DRAIN_OVER_LIMIT) { + // DRAIN_OVER_LIMIT behavior drains the remaining counter. t.Remaining = 0 rl.Remaining = 0 } @@ -399,8 +399,8 @@ func leakyBucket(ctx context.Context, s Store, c Cache, r *RateLimitReq) (resp * if r.Hits > int64(b.Remaining) { metricOverLimitCounter.Add(1) rl.Status = Status_OVER_LIMIT - if HasBehavior(r.Behavior, Behavior_DRAIN_OVERLIMIT) { - // DRAIN_OVERLIMIT behavior drains the remaining counter. + if HasBehavior(r.Behavior, Behavior_DRAIN_OVER_LIMIT) { + // DRAIN_OVER_LIMIT behavior drains the remaining counter. b.Remaining = 0 rl.Remaining = 0 } diff --git a/config.go b/config.go index dd8e0eaa..9248f1e4 100644 --- a/config.go +++ b/config.go @@ -64,8 +64,8 @@ type BehaviorConfig struct { GlobalBatchLimit int // ForceGlobal forces global behavior on all rate limit checks. ForceGlobal bool - // ForceDrainOverlimit forces drain overlimit behavior on all rate limit checks. - ForceDrainOverlimit bool + // ForceDrainOverLimit forces "drain over limit" behavior on all rate limit checks. + ForceDrainOverLimit bool // Number of concurrent requests that will be made to peers. Defaults to 100 GlobalPeerRequestsConcurrency int diff --git a/functional_test.go b/functional_test.go index 37f787ad..4abd2e25 100644 --- a/functional_test.go +++ b/functional_test.go @@ -371,7 +371,7 @@ func TestTokenBucketNegativeHits(t *testing.T) { } } -func TestDrainOverlimit(t *testing.T) { +func TestDrainOverLimit(t *testing.T) { defer clock.Freeze(clock.Now()).Unfreeze() client, errs := guber.DialV1Server(cluster.PeerAt(0).GRPCAddress, nil) require.Nil(t, errs) @@ -393,7 +393,7 @@ func TestDrainOverlimit(t *testing.T) { Remaining: 9, Status: guber.Status_UNDER_LIMIT, }, { - Name: "overlimit hit", + Name: "over limit hit", Hits: 100, Remaining: 0, Status: guber.Status_OVER_LIMIT, @@ -413,10 +413,10 @@ func TestDrainOverlimit(t *testing.T) { resp, err := client.GetRateLimits(ctx, &guber.GetRateLimitsReq{ Requests: []*guber.RateLimitReq{ { - Name: "test_drain_overlimit", + Name: "test_drain_over_limit", UniqueKey: fmt.Sprintf("account:1234:%d", idx), Algorithm: algoCase.Algorithm, - Behavior: guber.Behavior_DRAIN_OVERLIMIT, + Behavior: guber.Behavior_DRAIN_OVER_LIMIT, Duration: guber.Second * 30, Hits: test.Hits, Limit: 10, diff --git a/gubernator.go b/gubernator.go index 56305a8b..bd8e9e08 100644 --- a/gubernator.go +++ b/gubernator.go @@ -225,8 +225,8 @@ func (s *V1Instance) GetRateLimits(ctx context.Context, r *GetRateLimitsReq) (*G if s.conf.Behaviors.ForceGlobal { SetBehavior(&req.Behavior, Behavior_GLOBAL, true) } - if s.conf.Behaviors.ForceDrainOverlimit { - SetBehavior(&req.Behavior, Behavior_DRAIN_OVERLIMIT, true) + if s.conf.Behaviors.ForceDrainOverLimit { + SetBehavior(&req.Behavior, Behavior_DRAIN_OVER_LIMIT, true) } peer, err = s.GetPeer(ctx, key) diff --git a/gubernator.pb.go b/gubernator.pb.go index dcdeec31..1c05c82f 100644 --- a/gubernator.pb.go +++ b/gubernator.pb.go @@ -147,10 +147,10 @@ const ( // 'member-list' peer discovery. Also requires GUBER_DATA_CENTER to be set to different values on at // least 2 instances of Gubernator. Behavior_MULTI_REGION Behavior = 16 - // A GetRateLimits call drains the remaining counter on first overlimit + // A GetRateLimits call drains the remaining counter on first over limit // event. Then, successive GetRateLimits calls will return zero remaining // counter and not any residual value. - Behavior_DRAIN_OVERLIMIT Behavior = 32 + Behavior_DRAIN_OVER_LIMIT Behavior = 32 ) // Enum value maps for Behavior. @@ -162,7 +162,7 @@ var ( 4: "DURATION_IS_GREGORIAN", 8: "RESET_REMAINING", 16: "MULTI_REGION", - 32: "DRAIN_OVERLIMIT", + 32: "DRAIN_OVER_LIMIT", } Behavior_value = map[string]int32{ "BATCHING": 0, @@ -171,7 +171,7 @@ var ( "DURATION_IS_GREGORIAN": 4, "RESET_REMAINING": 8, "MULTI_REGION": 16, - "DRAIN_OVERLIMIT": 32, + "DRAIN_OVER_LIMIT": 32, } ) @@ -977,7 +977,7 @@ var file_gubernator_proto_rawDesc = []byte{ 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x2f, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x45, 0x41, 0x4b, 0x59, - 0x5f, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x01, 0x2a, 0x8c, 0x01, 0x0a, 0x08, 0x42, 0x65, + 0x5f, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x01, 0x2a, 0x8d, 0x01, 0x0a, 0x08, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41, 0x54, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x5f, 0x42, 0x41, 0x54, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x4c, 0x4f, 0x42, 0x41, 0x4c, 0x10, @@ -985,35 +985,35 @@ var file_gubernator_proto_rawDesc = []byte{ 0x5f, 0x47, 0x52, 0x45, 0x47, 0x4f, 0x52, 0x49, 0x41, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x52, 0x45, 0x53, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x4d, 0x41, 0x49, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, - 0x4e, 0x10, 0x10, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x52, 0x41, 0x49, 0x4e, 0x5f, 0x4f, 0x56, 0x45, - 0x52, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x10, 0x20, 0x2a, 0x29, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, 0x49, - 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x56, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, 0x49, - 0x54, 0x10, 0x01, 0x32, 0xd7, 0x02, 0x0a, 0x02, 0x56, 0x31, 0x12, 0x70, 0x0a, 0x0d, 0x47, 0x65, - 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x62, - 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x20, 0x2e, 0x70, + 0x4e, 0x10, 0x10, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x52, 0x41, 0x49, 0x4e, 0x5f, 0x4f, 0x56, 0x45, + 0x52, 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x10, 0x20, 0x2a, 0x29, 0x0a, 0x06, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, + 0x49, 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x56, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, + 0x49, 0x54, 0x10, 0x01, 0x32, 0xd7, 0x02, 0x0a, 0x02, 0x56, 0x31, 0x12, 0x70, 0x0a, 0x0d, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x65, 0x74, - 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1c, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x78, 0x0a, 0x0f, - 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, - 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, - 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, - 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, - 0x6f, 0x72, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, - 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x3a, 0x01, - 0x2a, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, - 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, + 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x20, 0x2e, + 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x65, + 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, + 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x78, 0x0a, + 0x0f, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, + 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, + 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, + 0x74, 0x6f, 0x72, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, + 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x3a, + 0x01, 0x2a, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, + 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, + 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, - 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x52, 0x65, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x76, - 0x31, 0x2f, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x22, 0x5a, - 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x61, 0x69, 0x6c, - 0x67, 0x75, 0x6e, 0x2f, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x80, 0x01, - 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6b, 0x52, 0x65, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, + 0x76, 0x31, 0x2f, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x22, + 0x5a, 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x61, 0x69, + 0x6c, 0x67, 0x75, 0x6e, 0x2f, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x80, + 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/gubernator.proto b/gubernator.proto index ea84ba9a..4d9df8b4 100644 --- a/gubernator.proto +++ b/gubernator.proto @@ -141,10 +141,10 @@ enum Behavior { // least 2 instances of Gubernator. MULTI_REGION = 16; - // A GetRateLimits call drains the remaining counter on first overlimit + // A GetRateLimits call drains the remaining counter on first over limit // event. Then, successive GetRateLimits calls will return zero remaining // counter and not any residual value. - DRAIN_OVERLIMIT = 32; + DRAIN_OVER_LIMIT = 32; // TODO: Add support for LOCAL. Which would force the rate limit to be handled by the local instance } diff --git a/python/gubernator/gubernator_pb2.py b/python/gubernator/gubernator_pb2.py index c77ccba9..984875dc 100644 --- a/python/gubernator/gubernator_pb2.py +++ b/python/gubernator/gubernator_pb2.py @@ -15,7 +15,7 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10gubernator.proto\x12\rpb.gubernator\x1a\x1cgoogle/api/annotations.proto\"K\n\x10GetRateLimitsReq\x12\x37\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReqR\x08requests\"O\n\x11GetRateLimitsResp\x12:\n\tresponses\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitRespR\tresponses\"R\n\x12\x43learRateLimitsReq\x12<\n\x08requests\x18\x01 \x03(\x0b\x32 .pb.gubernator.ClearRateLimitReqR\x08requests\"V\n\x13\x43learRateLimitsResp\x12?\n\tresponses\x18\x01 \x03(\x0b\x32!.pb.gubernator.ClearRateLimitRespR\tresponses\"\x8e\x03\n\x0cRateLimitReq\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n\nunique_key\x18\x02 \x01(\tR\tuniqueKey\x12\x12\n\x04hits\x18\x03 \x01(\x03R\x04hits\x12\x14\n\x05limit\x18\x04 \x01(\x03R\x05limit\x12\x1a\n\x08\x64uration\x18\x05 \x01(\x03R\x08\x64uration\x12\x36\n\talgorithm\x18\x06 \x01(\x0e\x32\x18.pb.gubernator.AlgorithmR\talgorithm\x12\x33\n\x08\x62\x65havior\x18\x07 \x01(\x0e\x32\x17.pb.gubernator.BehaviorR\x08\x62\x65havior\x12\x14\n\x05\x62urst\x18\x08 \x01(\x03R\x05\x62urst\x12\x45\n\x08metadata\x18\t \x03(\x0b\x32).pb.gubernator.RateLimitReq.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\xac\x02\n\rRateLimitResp\x12-\n\x06status\x18\x01 \x01(\x0e\x32\x15.pb.gubernator.StatusR\x06status\x12\x14\n\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x1c\n\tremaining\x18\x03 \x01(\x03R\tremaining\x12\x1d\n\nreset_time\x18\x04 \x01(\x03R\tresetTime\x12\x14\n\x05\x65rror\x18\x05 \x01(\tR\x05\x65rror\x12\x46\n\x08metadata\x18\x06 \x03(\x0b\x32*.pb.gubernator.RateLimitResp.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"F\n\x11\x43learRateLimitReq\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n\nunique_key\x18\x02 \x01(\tR\tuniqueKey\"_\n\x12\x43learRateLimitResp\x12\x14\n\x05limit\x18\x01 \x01(\x03R\x05limit\x12\x1d\n\nreset_time\x18\x02 \x01(\x03R\tresetTime\x12\x14\n\x05\x65rror\x18\x03 \x01(\tR\x05\x65rror\"\x10\n\x0eHealthCheckReq\"b\n\x0fHealthCheckResp\x12\x16\n\x06status\x18\x01 \x01(\tR\x06status\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12\x1d\n\npeer_count\x18\x03 \x01(\x05R\tpeerCount*/\n\tAlgorithm\x12\x10\n\x0cTOKEN_BUCKET\x10\x00\x12\x10\n\x0cLEAKY_BUCKET\x10\x01*\x8c\x01\n\x08\x42\x65havior\x12\x0c\n\x08\x42\x41TCHING\x10\x00\x12\x0f\n\x0bNO_BATCHING\x10\x01\x12\n\n\x06GLOBAL\x10\x02\x12\x19\n\x15\x44URATION_IS_GREGORIAN\x10\x04\x12\x13\n\x0fRESET_REMAINING\x10\x08\x12\x10\n\x0cMULTI_REGION\x10\x10\x12\x13\n\x0f\x44RAIN_OVERLIMIT\x10 *)\n\x06Status\x12\x0f\n\x0bUNDER_LIMIT\x10\x00\x12\x0e\n\nOVER_LIMIT\x10\x01\x32\xd7\x02\n\x02V1\x12p\n\rGetRateLimits\x12\x1f.pb.gubernator.GetRateLimitsReq\x1a .pb.gubernator.GetRateLimitsResp\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/v1/GetRateLimits:\x01*\x12x\n\x0f\x43learRateLimits\x12!.pb.gubernator.ClearRateLimitsReq\x1a\".pb.gubernator.ClearRateLimitsResp\"\x1e\x82\xd3\xe4\x93\x02\x18\"\x13/v1/ClearRateLimits:\x01*\x12\x65\n\x0bHealthCheck\x12\x1d.pb.gubernator.HealthCheckReq\x1a\x1e.pb.gubernator.HealthCheckResp\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/HealthCheckB\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10gubernator.proto\x12\rpb.gubernator\x1a\x1cgoogle/api/annotations.proto\"K\n\x10GetRateLimitsReq\x12\x37\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReqR\x08requests\"O\n\x11GetRateLimitsResp\x12:\n\tresponses\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitRespR\tresponses\"R\n\x12\x43learRateLimitsReq\x12<\n\x08requests\x18\x01 \x03(\x0b\x32 .pb.gubernator.ClearRateLimitReqR\x08requests\"V\n\x13\x43learRateLimitsResp\x12?\n\tresponses\x18\x01 \x03(\x0b\x32!.pb.gubernator.ClearRateLimitRespR\tresponses\"\x8e\x03\n\x0cRateLimitReq\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n\nunique_key\x18\x02 \x01(\tR\tuniqueKey\x12\x12\n\x04hits\x18\x03 \x01(\x03R\x04hits\x12\x14\n\x05limit\x18\x04 \x01(\x03R\x05limit\x12\x1a\n\x08\x64uration\x18\x05 \x01(\x03R\x08\x64uration\x12\x36\n\talgorithm\x18\x06 \x01(\x0e\x32\x18.pb.gubernator.AlgorithmR\talgorithm\x12\x33\n\x08\x62\x65havior\x18\x07 \x01(\x0e\x32\x17.pb.gubernator.BehaviorR\x08\x62\x65havior\x12\x14\n\x05\x62urst\x18\x08 \x01(\x03R\x05\x62urst\x12\x45\n\x08metadata\x18\t \x03(\x0b\x32).pb.gubernator.RateLimitReq.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\xac\x02\n\rRateLimitResp\x12-\n\x06status\x18\x01 \x01(\x0e\x32\x15.pb.gubernator.StatusR\x06status\x12\x14\n\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x1c\n\tremaining\x18\x03 \x01(\x03R\tremaining\x12\x1d\n\nreset_time\x18\x04 \x01(\x03R\tresetTime\x12\x14\n\x05\x65rror\x18\x05 \x01(\tR\x05\x65rror\x12\x46\n\x08metadata\x18\x06 \x03(\x0b\x32*.pb.gubernator.RateLimitResp.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"F\n\x11\x43learRateLimitReq\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n\nunique_key\x18\x02 \x01(\tR\tuniqueKey\"_\n\x12\x43learRateLimitResp\x12\x14\n\x05limit\x18\x01 \x01(\x03R\x05limit\x12\x1d\n\nreset_time\x18\x02 \x01(\x03R\tresetTime\x12\x14\n\x05\x65rror\x18\x03 \x01(\tR\x05\x65rror\"\x10\n\x0eHealthCheckReq\"b\n\x0fHealthCheckResp\x12\x16\n\x06status\x18\x01 \x01(\tR\x06status\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12\x1d\n\npeer_count\x18\x03 \x01(\x05R\tpeerCount*/\n\tAlgorithm\x12\x10\n\x0cTOKEN_BUCKET\x10\x00\x12\x10\n\x0cLEAKY_BUCKET\x10\x01*\x8d\x01\n\x08\x42\x65havior\x12\x0c\n\x08\x42\x41TCHING\x10\x00\x12\x0f\n\x0bNO_BATCHING\x10\x01\x12\n\n\x06GLOBAL\x10\x02\x12\x19\n\x15\x44URATION_IS_GREGORIAN\x10\x04\x12\x13\n\x0fRESET_REMAINING\x10\x08\x12\x10\n\x0cMULTI_REGION\x10\x10\x12\x14\n\x10\x44RAIN_OVER_LIMIT\x10 *)\n\x06Status\x12\x0f\n\x0bUNDER_LIMIT\x10\x00\x12\x0e\n\nOVER_LIMIT\x10\x01\x32\xd7\x02\n\x02V1\x12p\n\rGetRateLimits\x12\x1f.pb.gubernator.GetRateLimitsReq\x1a .pb.gubernator.GetRateLimitsResp\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/v1/GetRateLimits:\x01*\x12x\n\x0f\x43learRateLimits\x12!.pb.gubernator.ClearRateLimitsReq\x1a\".pb.gubernator.ClearRateLimitsResp\"\x1e\x82\xd3\xe4\x93\x02\x18\"\x13/v1/ClearRateLimits:\x01*\x12\x65\n\x0bHealthCheck\x12\x1d.pb.gubernator.HealthCheckReq\x1a\x1e.pb.gubernator.HealthCheckResp\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/HealthCheckB\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -36,9 +36,9 @@ _globals['_ALGORITHM']._serialized_start=1386 _globals['_ALGORITHM']._serialized_end=1433 _globals['_BEHAVIOR']._serialized_start=1436 - _globals['_BEHAVIOR']._serialized_end=1576 - _globals['_STATUS']._serialized_start=1578 - _globals['_STATUS']._serialized_end=1619 + _globals['_BEHAVIOR']._serialized_end=1577 + _globals['_STATUS']._serialized_start=1579 + _globals['_STATUS']._serialized_end=1620 _globals['_GETRATELIMITSREQ']._serialized_start=65 _globals['_GETRATELIMITSREQ']._serialized_end=140 _globals['_GETRATELIMITSRESP']._serialized_start=142 @@ -63,6 +63,6 @@ _globals['_HEALTHCHECKREQ']._serialized_end=1284 _globals['_HEALTHCHECKRESP']._serialized_start=1286 _globals['_HEALTHCHECKRESP']._serialized_end=1384 - _globals['_V1']._serialized_start=1622 - _globals['_V1']._serialized_end=1965 + _globals['_V1']._serialized_start=1623 + _globals['_V1']._serialized_end=1966 # @@protoc_insertion_point(module_scope) From 36159923a489f746693d2e333491f69363b81f49 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 16:27:51 -0500 Subject: [PATCH 13/15] Revert `ForceDrainOverLimit` change. --- config.go | 2 -- gubernator.go | 3 --- 2 files changed, 5 deletions(-) diff --git a/config.go b/config.go index 9248f1e4..14c9b592 100644 --- a/config.go +++ b/config.go @@ -64,8 +64,6 @@ type BehaviorConfig struct { GlobalBatchLimit int // ForceGlobal forces global behavior on all rate limit checks. ForceGlobal bool - // ForceDrainOverLimit forces "drain over limit" behavior on all rate limit checks. - ForceDrainOverLimit bool // Number of concurrent requests that will be made to peers. Defaults to 100 GlobalPeerRequestsConcurrency int diff --git a/gubernator.go b/gubernator.go index bd8e9e08..59c26eca 100644 --- a/gubernator.go +++ b/gubernator.go @@ -225,9 +225,6 @@ func (s *V1Instance) GetRateLimits(ctx context.Context, r *GetRateLimitsReq) (*G if s.conf.Behaviors.ForceGlobal { SetBehavior(&req.Behavior, Behavior_GLOBAL, true) } - if s.conf.Behaviors.ForceDrainOverLimit { - SetBehavior(&req.Behavior, Behavior_DRAIN_OVER_LIMIT, true) - } peer, err = s.GetPeer(ctx, key) if err != nil { From b61278908fbee1b8b1b51e2f7ec10e37efebf5ab Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 4 Jan 2024 16:30:08 -0500 Subject: [PATCH 14/15] Remove unused proto code. --- gubernator.pb.go | 550 +++++------------------ gubernator.proto | 32 -- gubernator_grpc.pb.go | 41 +- python/gubernator/gubernator_pb2.py | 52 +-- python/gubernator/gubernator_pb2_grpc.py | 33 -- 5 files changed, 147 insertions(+), 561 deletions(-) diff --git a/gubernator.pb.go b/gubernator.pb.go index 1c05c82f..1ae28afa 100644 --- a/gubernator.pb.go +++ b/gubernator.pb.go @@ -344,100 +344,6 @@ func (x *GetRateLimitsResp) GetResponses() []*RateLimitResp { return nil } -type ClearRateLimitsReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Requests []*ClearRateLimitReq `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` -} - -func (x *ClearRateLimitsReq) Reset() { - *x = ClearRateLimitsReq{} - if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClearRateLimitsReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClearRateLimitsReq) ProtoMessage() {} - -func (x *ClearRateLimitsReq) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClearRateLimitsReq.ProtoReflect.Descriptor instead. -func (*ClearRateLimitsReq) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{2} -} - -func (x *ClearRateLimitsReq) GetRequests() []*ClearRateLimitReq { - if x != nil { - return x.Requests - } - return nil -} - -type ClearRateLimitsResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Responses []*ClearRateLimitResp `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"` -} - -func (x *ClearRateLimitsResp) Reset() { - *x = ClearRateLimitsResp{} - if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClearRateLimitsResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClearRateLimitsResp) ProtoMessage() {} - -func (x *ClearRateLimitsResp) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClearRateLimitsResp.ProtoReflect.Descriptor instead. -func (*ClearRateLimitsResp) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{3} -} - -func (x *ClearRateLimitsResp) GetResponses() []*ClearRateLimitResp { - if x != nil { - return x.Responses - } - return nil -} - type RateLimitReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -473,7 +379,7 @@ type RateLimitReq struct { func (x *RateLimitReq) Reset() { *x = RateLimitReq{} if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[4] + mi := &file_gubernator_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -486,7 +392,7 @@ func (x *RateLimitReq) String() string { func (*RateLimitReq) ProtoMessage() {} func (x *RateLimitReq) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[4] + mi := &file_gubernator_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -499,7 +405,7 @@ func (x *RateLimitReq) ProtoReflect() protoreflect.Message { // Deprecated: Use RateLimitReq.ProtoReflect.Descriptor instead. func (*RateLimitReq) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{4} + return file_gubernator_proto_rawDescGZIP(), []int{2} } func (x *RateLimitReq) GetName() string { @@ -587,7 +493,7 @@ type RateLimitResp struct { func (x *RateLimitResp) Reset() { *x = RateLimitResp{} if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[5] + mi := &file_gubernator_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -600,7 +506,7 @@ func (x *RateLimitResp) String() string { func (*RateLimitResp) ProtoMessage() {} func (x *RateLimitResp) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[5] + mi := &file_gubernator_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -613,7 +519,7 @@ func (x *RateLimitResp) ProtoReflect() protoreflect.Message { // Deprecated: Use RateLimitResp.ProtoReflect.Descriptor instead. func (*RateLimitResp) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{5} + return file_gubernator_proto_rawDescGZIP(), []int{3} } func (x *RateLimitResp) GetStatus() Status { @@ -658,129 +564,6 @@ func (x *RateLimitResp) GetMetadata() map[string]string { return nil } -type ClearRateLimitReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the rate limit IE: 'requests_per_second', 'gets_per_minute` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Uniquely identifies this rate limit IE: 'ip:10.2.10.7' or 'account:123445' - UniqueKey string `protobuf:"bytes,2,opt,name=unique_key,json=uniqueKey,proto3" json:"unique_key,omitempty"` -} - -func (x *ClearRateLimitReq) Reset() { - *x = ClearRateLimitReq{} - if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClearRateLimitReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClearRateLimitReq) ProtoMessage() {} - -func (x *ClearRateLimitReq) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClearRateLimitReq.ProtoReflect.Descriptor instead. -func (*ClearRateLimitReq) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{6} -} - -func (x *ClearRateLimitReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ClearRateLimitReq) GetUniqueKey() string { - if x != nil { - return x.UniqueKey - } - return "" -} - -type ClearRateLimitResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The currently configured request limit (Identical to RateLimitRequest.rate_limit_config.limit). - Limit int64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` - // This is the time when the rate limit span will be reset, provided as a unix timestamp in milliseconds. - ResetTime int64 `protobuf:"varint,2,opt,name=reset_time,json=resetTime,proto3" json:"reset_time,omitempty"` - // Contains the error; If set all other values should be ignored - Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *ClearRateLimitResp) Reset() { - *x = ClearRateLimitResp{} - if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClearRateLimitResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClearRateLimitResp) ProtoMessage() {} - -func (x *ClearRateLimitResp) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClearRateLimitResp.ProtoReflect.Descriptor instead. -func (*ClearRateLimitResp) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{7} -} - -func (x *ClearRateLimitResp) GetLimit() int64 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *ClearRateLimitResp) GetResetTime() int64 { - if x != nil { - return x.ResetTime - } - return 0 -} - -func (x *ClearRateLimitResp) GetError() string { - if x != nil { - return x.Error - } - return "" -} - type HealthCheckReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -790,7 +573,7 @@ type HealthCheckReq struct { func (x *HealthCheckReq) Reset() { *x = HealthCheckReq{} if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[8] + mi := &file_gubernator_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -803,7 +586,7 @@ func (x *HealthCheckReq) String() string { func (*HealthCheckReq) ProtoMessage() {} func (x *HealthCheckReq) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[8] + mi := &file_gubernator_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -816,7 +599,7 @@ func (x *HealthCheckReq) ProtoReflect() protoreflect.Message { // Deprecated: Use HealthCheckReq.ProtoReflect.Descriptor instead. func (*HealthCheckReq) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{8} + return file_gubernator_proto_rawDescGZIP(), []int{4} } type HealthCheckResp struct { @@ -835,7 +618,7 @@ type HealthCheckResp struct { func (x *HealthCheckResp) Reset() { *x = HealthCheckResp{} if protoimpl.UnsafeEnabled { - mi := &file_gubernator_proto_msgTypes[9] + mi := &file_gubernator_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -848,7 +631,7 @@ func (x *HealthCheckResp) String() string { func (*HealthCheckResp) ProtoMessage() {} func (x *HealthCheckResp) ProtoReflect() protoreflect.Message { - mi := &file_gubernator_proto_msgTypes[9] + mi := &file_gubernator_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -861,7 +644,7 @@ func (x *HealthCheckResp) ProtoReflect() protoreflect.Message { // Deprecated: Use HealthCheckResp.ProtoReflect.Descriptor instead. func (*HealthCheckResp) Descriptor() ([]byte, []int) { - return file_gubernator_proto_rawDescGZIP(), []int{9} + return file_gubernator_proto_rawDescGZIP(), []int{5} } func (x *HealthCheckResp) GetStatus() string { @@ -901,119 +684,90 @@ var file_gubernator_proto_rawDesc = []byte{ 0x70, 0x12, 0x3a, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x22, 0x52, 0x0a, - 0x12, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, - 0x52, 0x65, 0x71, 0x12, 0x3c, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, - 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x73, 0x22, 0x56, 0x0a, 0x13, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3f, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x62, - 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x43, 0x6c, 0x65, 0x61, - 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x52, 0x09, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x22, 0x8e, 0x03, 0x0a, 0x0c, 0x52, 0x61, - 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, - 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, - 0x04, 0x68, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x68, 0x69, 0x74, - 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, - 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, - 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x33, 0x0a, 0x08, 0x62, - 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, - 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x42, 0x65, - 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x52, 0x08, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, - 0x12, 0x14, 0x0a, 0x05, 0x62, 0x75, 0x72, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x05, 0x62, 0x75, 0x72, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, - 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x52, 0x65, 0x71, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, - 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xac, 0x02, 0x0a, 0x0d, 0x52, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x70, - 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, - 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x12, - 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x12, 0x46, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, - 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x46, 0x0a, 0x11, 0x43, 0x6c, 0x65, - 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, + 0x73, 0x70, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x22, 0x8e, 0x03, + 0x0a, 0x0c, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4b, 0x65, - 0x79, 0x22, 0x5f, 0x0a, 0x12, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1d, 0x0a, - 0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x72, 0x65, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x22, 0x10, 0x0a, 0x0e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x52, 0x65, 0x71, 0x22, 0x62, 0x0a, 0x0f, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x65, 0x65, - 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x70, - 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x2f, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, - 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x42, - 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x45, 0x41, 0x4b, 0x59, - 0x5f, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x01, 0x2a, 0x8d, 0x01, 0x0a, 0x08, 0x42, 0x65, - 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41, 0x54, 0x43, 0x48, 0x49, - 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x5f, 0x42, 0x41, 0x54, 0x43, 0x48, - 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x4c, 0x4f, 0x42, 0x41, 0x4c, 0x10, - 0x02, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, - 0x5f, 0x47, 0x52, 0x45, 0x47, 0x4f, 0x52, 0x49, 0x41, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, - 0x52, 0x45, 0x53, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x4d, 0x41, 0x49, 0x4e, 0x49, 0x4e, 0x47, 0x10, - 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, - 0x4e, 0x10, 0x10, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x52, 0x41, 0x49, 0x4e, 0x5f, 0x4f, 0x56, 0x45, - 0x52, 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x10, 0x20, 0x2a, 0x29, 0x0a, 0x06, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, - 0x49, 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x56, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, - 0x49, 0x54, 0x10, 0x01, 0x32, 0xd7, 0x02, 0x0a, 0x02, 0x56, 0x31, 0x12, 0x70, 0x0a, 0x0d, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x70, - 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x65, 0x74, - 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x20, 0x2e, - 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x65, - 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, - 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, - 0x47, 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x78, 0x0a, - 0x0f, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, - 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, - 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, - 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, - 0x74, 0x6f, 0x72, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x3a, - 0x01, 0x2a, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x52, 0x61, 0x74, - 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, + 0x79, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x04, 0x68, 0x69, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, + 0x69, 0x74, 0x68, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, + 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, + 0x69, 0x74, 0x68, 0x6d, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, + 0x33, 0x0a, 0x08, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, + 0x72, 0x2e, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x52, 0x08, 0x62, 0x65, 0x68, 0x61, + 0x76, 0x69, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x75, 0x72, 0x73, 0x74, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x75, 0x72, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, + 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, + 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xac, + 0x02, 0x0a, 0x0d, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x2d, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, + 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, + 0x69, 0x6e, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x73, 0x65, 0x74, 0x54, 0x69, + 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x46, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x62, 0x2e, + 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x10, 0x0a, + 0x0e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x22, + 0x62, 0x0a, 0x0f, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x70, 0x65, 0x65, 0x72, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x2a, 0x2f, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, + 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, + 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x45, 0x41, 0x4b, 0x59, 0x5f, 0x42, 0x55, 0x43, 0x4b, + 0x45, 0x54, 0x10, 0x01, 0x2a, 0x8d, 0x01, 0x0a, 0x08, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, + 0x72, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41, 0x54, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, + 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x5f, 0x42, 0x41, 0x54, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x10, 0x01, + 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x4c, 0x4f, 0x42, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, + 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x5f, 0x47, 0x52, 0x45, 0x47, + 0x4f, 0x52, 0x49, 0x41, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x52, 0x45, 0x53, 0x45, 0x54, + 0x5f, 0x52, 0x45, 0x4d, 0x41, 0x49, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, + 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x4f, 0x4e, 0x10, 0x10, 0x12, 0x14, + 0x0a, 0x10, 0x44, 0x52, 0x41, 0x49, 0x4e, 0x5f, 0x4f, 0x56, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, + 0x49, 0x54, 0x10, 0x20, 0x2a, 0x29, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0f, + 0x0a, 0x0b, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x10, 0x00, 0x12, + 0x0e, 0x0a, 0x0a, 0x4f, 0x56, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x10, 0x01, 0x32, + 0xdd, 0x01, 0x0a, 0x02, 0x56, 0x31, 0x12, 0x70, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x52, 0x61, 0x74, + 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, + 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, + 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x74, 0x65, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x47, 0x65, 0x74, 0x52, 0x61, + 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, + 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x75, 0x62, 0x65, 0x72, - 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x52, 0x65, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, - 0x76, 0x31, 0x2f, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x22, - 0x5a, 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x61, 0x69, - 0x6c, 0x67, 0x75, 0x6e, 0x2f, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x80, - 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, + 0x2f, 0x76, 0x31, 0x2f, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, + 0x22, 0x5a, 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x61, + 0x69, 0x6c, 0x67, 0x75, 0x6e, 0x2f, 0x67, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x6f, 0x72, + 0x80, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1029,45 +783,37 @@ func file_gubernator_proto_rawDescGZIP() []byte { } var file_gubernator_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_gubernator_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_gubernator_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_gubernator_proto_goTypes = []interface{}{ - (Algorithm)(0), // 0: pb.gubernator.Algorithm - (Behavior)(0), // 1: pb.gubernator.Behavior - (Status)(0), // 2: pb.gubernator.Status - (*GetRateLimitsReq)(nil), // 3: pb.gubernator.GetRateLimitsReq - (*GetRateLimitsResp)(nil), // 4: pb.gubernator.GetRateLimitsResp - (*ClearRateLimitsReq)(nil), // 5: pb.gubernator.ClearRateLimitsReq - (*ClearRateLimitsResp)(nil), // 6: pb.gubernator.ClearRateLimitsResp - (*RateLimitReq)(nil), // 7: pb.gubernator.RateLimitReq - (*RateLimitResp)(nil), // 8: pb.gubernator.RateLimitResp - (*ClearRateLimitReq)(nil), // 9: pb.gubernator.ClearRateLimitReq - (*ClearRateLimitResp)(nil), // 10: pb.gubernator.ClearRateLimitResp - (*HealthCheckReq)(nil), // 11: pb.gubernator.HealthCheckReq - (*HealthCheckResp)(nil), // 12: pb.gubernator.HealthCheckResp - nil, // 13: pb.gubernator.RateLimitReq.MetadataEntry - nil, // 14: pb.gubernator.RateLimitResp.MetadataEntry + (Algorithm)(0), // 0: pb.gubernator.Algorithm + (Behavior)(0), // 1: pb.gubernator.Behavior + (Status)(0), // 2: pb.gubernator.Status + (*GetRateLimitsReq)(nil), // 3: pb.gubernator.GetRateLimitsReq + (*GetRateLimitsResp)(nil), // 4: pb.gubernator.GetRateLimitsResp + (*RateLimitReq)(nil), // 5: pb.gubernator.RateLimitReq + (*RateLimitResp)(nil), // 6: pb.gubernator.RateLimitResp + (*HealthCheckReq)(nil), // 7: pb.gubernator.HealthCheckReq + (*HealthCheckResp)(nil), // 8: pb.gubernator.HealthCheckResp + nil, // 9: pb.gubernator.RateLimitReq.MetadataEntry + nil, // 10: pb.gubernator.RateLimitResp.MetadataEntry } var file_gubernator_proto_depIdxs = []int32{ - 7, // 0: pb.gubernator.GetRateLimitsReq.requests:type_name -> pb.gubernator.RateLimitReq - 8, // 1: pb.gubernator.GetRateLimitsResp.responses:type_name -> pb.gubernator.RateLimitResp - 9, // 2: pb.gubernator.ClearRateLimitsReq.requests:type_name -> pb.gubernator.ClearRateLimitReq - 10, // 3: pb.gubernator.ClearRateLimitsResp.responses:type_name -> pb.gubernator.ClearRateLimitResp - 0, // 4: pb.gubernator.RateLimitReq.algorithm:type_name -> pb.gubernator.Algorithm - 1, // 5: pb.gubernator.RateLimitReq.behavior:type_name -> pb.gubernator.Behavior - 13, // 6: pb.gubernator.RateLimitReq.metadata:type_name -> pb.gubernator.RateLimitReq.MetadataEntry - 2, // 7: pb.gubernator.RateLimitResp.status:type_name -> pb.gubernator.Status - 14, // 8: pb.gubernator.RateLimitResp.metadata:type_name -> pb.gubernator.RateLimitResp.MetadataEntry - 3, // 9: pb.gubernator.V1.GetRateLimits:input_type -> pb.gubernator.GetRateLimitsReq - 5, // 10: pb.gubernator.V1.ClearRateLimits:input_type -> pb.gubernator.ClearRateLimitsReq - 11, // 11: pb.gubernator.V1.HealthCheck:input_type -> pb.gubernator.HealthCheckReq - 4, // 12: pb.gubernator.V1.GetRateLimits:output_type -> pb.gubernator.GetRateLimitsResp - 6, // 13: pb.gubernator.V1.ClearRateLimits:output_type -> pb.gubernator.ClearRateLimitsResp - 12, // 14: pb.gubernator.V1.HealthCheck:output_type -> pb.gubernator.HealthCheckResp - 12, // [12:15] is the sub-list for method output_type - 9, // [9:12] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 5, // 0: pb.gubernator.GetRateLimitsReq.requests:type_name -> pb.gubernator.RateLimitReq + 6, // 1: pb.gubernator.GetRateLimitsResp.responses:type_name -> pb.gubernator.RateLimitResp + 0, // 2: pb.gubernator.RateLimitReq.algorithm:type_name -> pb.gubernator.Algorithm + 1, // 3: pb.gubernator.RateLimitReq.behavior:type_name -> pb.gubernator.Behavior + 9, // 4: pb.gubernator.RateLimitReq.metadata:type_name -> pb.gubernator.RateLimitReq.MetadataEntry + 2, // 5: pb.gubernator.RateLimitResp.status:type_name -> pb.gubernator.Status + 10, // 6: pb.gubernator.RateLimitResp.metadata:type_name -> pb.gubernator.RateLimitResp.MetadataEntry + 3, // 7: pb.gubernator.V1.GetRateLimits:input_type -> pb.gubernator.GetRateLimitsReq + 7, // 8: pb.gubernator.V1.HealthCheck:input_type -> pb.gubernator.HealthCheckReq + 4, // 9: pb.gubernator.V1.GetRateLimits:output_type -> pb.gubernator.GetRateLimitsResp + 8, // 10: pb.gubernator.V1.HealthCheck:output_type -> pb.gubernator.HealthCheckResp + 9, // [9:11] is the sub-list for method output_type + 7, // [7:9] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_gubernator_proto_init() } @@ -1101,30 +847,6 @@ func file_gubernator_proto_init() { } } file_gubernator_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClearRateLimitsReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gubernator_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClearRateLimitsResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gubernator_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RateLimitReq); i { case 0: return &v.state @@ -1136,7 +858,7 @@ func file_gubernator_proto_init() { return nil } } - file_gubernator_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_gubernator_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RateLimitResp); i { case 0: return &v.state @@ -1148,31 +870,7 @@ func file_gubernator_proto_init() { return nil } } - file_gubernator_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClearRateLimitReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gubernator_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClearRateLimitResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gubernator_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_gubernator_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HealthCheckReq); i { case 0: return &v.state @@ -1184,7 +882,7 @@ func file_gubernator_proto_init() { return nil } } - file_gubernator_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_gubernator_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HealthCheckResp); i { case 0: return &v.state @@ -1203,7 +901,7 @@ func file_gubernator_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_gubernator_proto_rawDesc, NumEnums: 3, - NumMessages: 12, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/gubernator.proto b/gubernator.proto index 4d9df8b4..5fd040df 100644 --- a/gubernator.proto +++ b/gubernator.proto @@ -34,13 +34,6 @@ service V1 { }; } - rpc ClearRateLimits (ClearRateLimitsReq) returns (ClearRateLimitsResp) { - option (google.api.http) = { - post: "/v1/ClearRateLimits" - body: "*" - }; - } - // This method is for round trip benchmarking and can be used by // the client to determine connectivity to the server rpc HealthCheck (HealthCheckReq) returns (HealthCheckResp) { @@ -60,14 +53,6 @@ message GetRateLimitsResp { repeated RateLimitResp responses = 1; } -message ClearRateLimitsReq { - repeated ClearRateLimitReq requests = 1; -} - -message ClearRateLimitsResp { - repeated ClearRateLimitResp responses = 1; -} - enum Algorithm { // Token bucket algorithm https://en.wikipedia.org/wiki/Token_bucket TOKEN_BUCKET = 0; @@ -205,23 +190,6 @@ message RateLimitResp { map metadata = 6; } -message ClearRateLimitReq { - // The name of the rate limit IE: 'requests_per_second', 'gets_per_minute` - string name = 1; - - // Uniquely identifies this rate limit IE: 'ip:10.2.10.7' or 'account:123445' - string unique_key = 2; -} - -message ClearRateLimitResp { - // The currently configured request limit (Identical to RateLimitRequest.rate_limit_config.limit). - int64 limit = 1; - // This is the time when the rate limit span will be reset, provided as a unix timestamp in milliseconds. - int64 reset_time = 2; - // Contains the error; If set all other values should be ignored - string error = 3; -} - message HealthCheckReq {} message HealthCheckResp { // Valid entries are 'healthy' or 'unhealthy' diff --git a/gubernator_grpc.pb.go b/gubernator_grpc.pb.go index 7fc5b622..209b75aa 100644 --- a/gubernator_grpc.pb.go +++ b/gubernator_grpc.pb.go @@ -34,9 +34,8 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - V1_GetRateLimits_FullMethodName = "/pb.gubernator.V1/GetRateLimits" - V1_ClearRateLimits_FullMethodName = "/pb.gubernator.V1/ClearRateLimits" - V1_HealthCheck_FullMethodName = "/pb.gubernator.V1/HealthCheck" + V1_GetRateLimits_FullMethodName = "/pb.gubernator.V1/GetRateLimits" + V1_HealthCheck_FullMethodName = "/pb.gubernator.V1/HealthCheck" ) // V1Client is the client API for V1 service. @@ -45,7 +44,6 @@ const ( type V1Client interface { // Given a list of rate limit requests, return the rate limits of each. GetRateLimits(ctx context.Context, in *GetRateLimitsReq, opts ...grpc.CallOption) (*GetRateLimitsResp, error) - ClearRateLimits(ctx context.Context, in *ClearRateLimitsReq, opts ...grpc.CallOption) (*ClearRateLimitsResp, error) // This method is for round trip benchmarking and can be used by // the client to determine connectivity to the server HealthCheck(ctx context.Context, in *HealthCheckReq, opts ...grpc.CallOption) (*HealthCheckResp, error) @@ -68,15 +66,6 @@ func (c *v1Client) GetRateLimits(ctx context.Context, in *GetRateLimitsReq, opts return out, nil } -func (c *v1Client) ClearRateLimits(ctx context.Context, in *ClearRateLimitsReq, opts ...grpc.CallOption) (*ClearRateLimitsResp, error) { - out := new(ClearRateLimitsResp) - err := c.cc.Invoke(ctx, V1_ClearRateLimits_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *v1Client) HealthCheck(ctx context.Context, in *HealthCheckReq, opts ...grpc.CallOption) (*HealthCheckResp, error) { out := new(HealthCheckResp) err := c.cc.Invoke(ctx, V1_HealthCheck_FullMethodName, in, out, opts...) @@ -92,7 +81,6 @@ func (c *v1Client) HealthCheck(ctx context.Context, in *HealthCheckReq, opts ... type V1Server interface { // Given a list of rate limit requests, return the rate limits of each. GetRateLimits(context.Context, *GetRateLimitsReq) (*GetRateLimitsResp, error) - ClearRateLimits(context.Context, *ClearRateLimitsReq) (*ClearRateLimitsResp, error) // This method is for round trip benchmarking and can be used by // the client to determine connectivity to the server HealthCheck(context.Context, *HealthCheckReq) (*HealthCheckResp, error) @@ -105,9 +93,6 @@ type UnimplementedV1Server struct { func (UnimplementedV1Server) GetRateLimits(context.Context, *GetRateLimitsReq) (*GetRateLimitsResp, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRateLimits not implemented") } -func (UnimplementedV1Server) ClearRateLimits(context.Context, *ClearRateLimitsReq) (*ClearRateLimitsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClearRateLimits not implemented") -} func (UnimplementedV1Server) HealthCheck(context.Context, *HealthCheckReq) (*HealthCheckResp, error) { return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") } @@ -141,24 +126,6 @@ func _V1_GetRateLimits_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -func _V1_ClearRateLimits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ClearRateLimitsReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(V1Server).ClearRateLimits(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: V1_ClearRateLimits_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(V1Server).ClearRateLimits(ctx, req.(*ClearRateLimitsReq)) - } - return interceptor(ctx, in, info, handler) -} - func _V1_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(HealthCheckReq) if err := dec(in); err != nil { @@ -188,10 +155,6 @@ var V1_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetRateLimits", Handler: _V1_GetRateLimits_Handler, }, - { - MethodName: "ClearRateLimits", - Handler: _V1_ClearRateLimits_Handler, - }, { MethodName: "HealthCheck", Handler: _V1_HealthCheck_Handler, diff --git a/python/gubernator/gubernator_pb2.py b/python/gubernator/gubernator_pb2.py index 984875dc..cefa90ce 100644 --- a/python/gubernator/gubernator_pb2.py +++ b/python/gubernator/gubernator_pb2.py @@ -15,7 +15,7 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10gubernator.proto\x12\rpb.gubernator\x1a\x1cgoogle/api/annotations.proto\"K\n\x10GetRateLimitsReq\x12\x37\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReqR\x08requests\"O\n\x11GetRateLimitsResp\x12:\n\tresponses\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitRespR\tresponses\"R\n\x12\x43learRateLimitsReq\x12<\n\x08requests\x18\x01 \x03(\x0b\x32 .pb.gubernator.ClearRateLimitReqR\x08requests\"V\n\x13\x43learRateLimitsResp\x12?\n\tresponses\x18\x01 \x03(\x0b\x32!.pb.gubernator.ClearRateLimitRespR\tresponses\"\x8e\x03\n\x0cRateLimitReq\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n\nunique_key\x18\x02 \x01(\tR\tuniqueKey\x12\x12\n\x04hits\x18\x03 \x01(\x03R\x04hits\x12\x14\n\x05limit\x18\x04 \x01(\x03R\x05limit\x12\x1a\n\x08\x64uration\x18\x05 \x01(\x03R\x08\x64uration\x12\x36\n\talgorithm\x18\x06 \x01(\x0e\x32\x18.pb.gubernator.AlgorithmR\talgorithm\x12\x33\n\x08\x62\x65havior\x18\x07 \x01(\x0e\x32\x17.pb.gubernator.BehaviorR\x08\x62\x65havior\x12\x14\n\x05\x62urst\x18\x08 \x01(\x03R\x05\x62urst\x12\x45\n\x08metadata\x18\t \x03(\x0b\x32).pb.gubernator.RateLimitReq.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\xac\x02\n\rRateLimitResp\x12-\n\x06status\x18\x01 \x01(\x0e\x32\x15.pb.gubernator.StatusR\x06status\x12\x14\n\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x1c\n\tremaining\x18\x03 \x01(\x03R\tremaining\x12\x1d\n\nreset_time\x18\x04 \x01(\x03R\tresetTime\x12\x14\n\x05\x65rror\x18\x05 \x01(\tR\x05\x65rror\x12\x46\n\x08metadata\x18\x06 \x03(\x0b\x32*.pb.gubernator.RateLimitResp.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"F\n\x11\x43learRateLimitReq\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n\nunique_key\x18\x02 \x01(\tR\tuniqueKey\"_\n\x12\x43learRateLimitResp\x12\x14\n\x05limit\x18\x01 \x01(\x03R\x05limit\x12\x1d\n\nreset_time\x18\x02 \x01(\x03R\tresetTime\x12\x14\n\x05\x65rror\x18\x03 \x01(\tR\x05\x65rror\"\x10\n\x0eHealthCheckReq\"b\n\x0fHealthCheckResp\x12\x16\n\x06status\x18\x01 \x01(\tR\x06status\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12\x1d\n\npeer_count\x18\x03 \x01(\x05R\tpeerCount*/\n\tAlgorithm\x12\x10\n\x0cTOKEN_BUCKET\x10\x00\x12\x10\n\x0cLEAKY_BUCKET\x10\x01*\x8d\x01\n\x08\x42\x65havior\x12\x0c\n\x08\x42\x41TCHING\x10\x00\x12\x0f\n\x0bNO_BATCHING\x10\x01\x12\n\n\x06GLOBAL\x10\x02\x12\x19\n\x15\x44URATION_IS_GREGORIAN\x10\x04\x12\x13\n\x0fRESET_REMAINING\x10\x08\x12\x10\n\x0cMULTI_REGION\x10\x10\x12\x14\n\x10\x44RAIN_OVER_LIMIT\x10 *)\n\x06Status\x12\x0f\n\x0bUNDER_LIMIT\x10\x00\x12\x0e\n\nOVER_LIMIT\x10\x01\x32\xd7\x02\n\x02V1\x12p\n\rGetRateLimits\x12\x1f.pb.gubernator.GetRateLimitsReq\x1a .pb.gubernator.GetRateLimitsResp\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/v1/GetRateLimits:\x01*\x12x\n\x0f\x43learRateLimits\x12!.pb.gubernator.ClearRateLimitsReq\x1a\".pb.gubernator.ClearRateLimitsResp\"\x1e\x82\xd3\xe4\x93\x02\x18\"\x13/v1/ClearRateLimits:\x01*\x12\x65\n\x0bHealthCheck\x12\x1d.pb.gubernator.HealthCheckReq\x1a\x1e.pb.gubernator.HealthCheckResp\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/HealthCheckB\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10gubernator.proto\x12\rpb.gubernator\x1a\x1cgoogle/api/annotations.proto\"K\n\x10GetRateLimitsReq\x12\x37\n\x08requests\x18\x01 \x03(\x0b\x32\x1b.pb.gubernator.RateLimitReqR\x08requests\"O\n\x11GetRateLimitsResp\x12:\n\tresponses\x18\x01 \x03(\x0b\x32\x1c.pb.gubernator.RateLimitRespR\tresponses\"\x8e\x03\n\x0cRateLimitReq\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n\nunique_key\x18\x02 \x01(\tR\tuniqueKey\x12\x12\n\x04hits\x18\x03 \x01(\x03R\x04hits\x12\x14\n\x05limit\x18\x04 \x01(\x03R\x05limit\x12\x1a\n\x08\x64uration\x18\x05 \x01(\x03R\x08\x64uration\x12\x36\n\talgorithm\x18\x06 \x01(\x0e\x32\x18.pb.gubernator.AlgorithmR\talgorithm\x12\x33\n\x08\x62\x65havior\x18\x07 \x01(\x0e\x32\x17.pb.gubernator.BehaviorR\x08\x62\x65havior\x12\x14\n\x05\x62urst\x18\x08 \x01(\x03R\x05\x62urst\x12\x45\n\x08metadata\x18\t \x03(\x0b\x32).pb.gubernator.RateLimitReq.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\xac\x02\n\rRateLimitResp\x12-\n\x06status\x18\x01 \x01(\x0e\x32\x15.pb.gubernator.StatusR\x06status\x12\x14\n\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x1c\n\tremaining\x18\x03 \x01(\x03R\tremaining\x12\x1d\n\nreset_time\x18\x04 \x01(\x03R\tresetTime\x12\x14\n\x05\x65rror\x18\x05 \x01(\tR\x05\x65rror\x12\x46\n\x08metadata\x18\x06 \x03(\x0b\x32*.pb.gubernator.RateLimitResp.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\x10\n\x0eHealthCheckReq\"b\n\x0fHealthCheckResp\x12\x16\n\x06status\x18\x01 \x01(\tR\x06status\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12\x1d\n\npeer_count\x18\x03 \x01(\x05R\tpeerCount*/\n\tAlgorithm\x12\x10\n\x0cTOKEN_BUCKET\x10\x00\x12\x10\n\x0cLEAKY_BUCKET\x10\x01*\x8d\x01\n\x08\x42\x65havior\x12\x0c\n\x08\x42\x41TCHING\x10\x00\x12\x0f\n\x0bNO_BATCHING\x10\x01\x12\n\n\x06GLOBAL\x10\x02\x12\x19\n\x15\x44URATION_IS_GREGORIAN\x10\x04\x12\x13\n\x0fRESET_REMAINING\x10\x08\x12\x10\n\x0cMULTI_REGION\x10\x10\x12\x14\n\x10\x44RAIN_OVER_LIMIT\x10 *)\n\x06Status\x12\x0f\n\x0bUNDER_LIMIT\x10\x00\x12\x0e\n\nOVER_LIMIT\x10\x01\x32\xdd\x01\n\x02V1\x12p\n\rGetRateLimits\x12\x1f.pb.gubernator.GetRateLimitsReq\x1a .pb.gubernator.GetRateLimitsResp\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/v1/GetRateLimits:\x01*\x12\x65\n\x0bHealthCheck\x12\x1d.pb.gubernator.HealthCheckReq\x1a\x1e.pb.gubernator.HealthCheckResp\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/HealthCheckB\"Z\x1dgithub.com/mailgun/gubernator\x80\x01\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -29,40 +29,30 @@ _globals['_RATELIMITRESP_METADATAENTRY']._serialized_options = b'8\001' _globals['_V1'].methods_by_name['GetRateLimits']._options = None _globals['_V1'].methods_by_name['GetRateLimits']._serialized_options = b'\202\323\344\223\002\026\"\021/v1/GetRateLimits:\001*' - _globals['_V1'].methods_by_name['ClearRateLimits']._options = None - _globals['_V1'].methods_by_name['ClearRateLimits']._serialized_options = b'\202\323\344\223\002\030\"\023/v1/ClearRateLimits:\001*' _globals['_V1'].methods_by_name['HealthCheck']._options = None _globals['_V1'].methods_by_name['HealthCheck']._serialized_options = b'\202\323\344\223\002\021\022\017/v1/HealthCheck' - _globals['_ALGORITHM']._serialized_start=1386 - _globals['_ALGORITHM']._serialized_end=1433 - _globals['_BEHAVIOR']._serialized_start=1436 - _globals['_BEHAVIOR']._serialized_end=1577 - _globals['_STATUS']._serialized_start=1579 - _globals['_STATUS']._serialized_end=1620 + _globals['_ALGORITHM']._serialized_start=1045 + _globals['_ALGORITHM']._serialized_end=1092 + _globals['_BEHAVIOR']._serialized_start=1095 + _globals['_BEHAVIOR']._serialized_end=1236 + _globals['_STATUS']._serialized_start=1238 + _globals['_STATUS']._serialized_end=1279 _globals['_GETRATELIMITSREQ']._serialized_start=65 _globals['_GETRATELIMITSREQ']._serialized_end=140 _globals['_GETRATELIMITSRESP']._serialized_start=142 _globals['_GETRATELIMITSRESP']._serialized_end=221 - _globals['_CLEARRATELIMITSREQ']._serialized_start=223 - _globals['_CLEARRATELIMITSREQ']._serialized_end=305 - _globals['_CLEARRATELIMITSRESP']._serialized_start=307 - _globals['_CLEARRATELIMITSRESP']._serialized_end=393 - _globals['_RATELIMITREQ']._serialized_start=396 - _globals['_RATELIMITREQ']._serialized_end=794 - _globals['_RATELIMITREQ_METADATAENTRY']._serialized_start=735 - _globals['_RATELIMITREQ_METADATAENTRY']._serialized_end=794 - _globals['_RATELIMITRESP']._serialized_start=797 - _globals['_RATELIMITRESP']._serialized_end=1097 - _globals['_RATELIMITRESP_METADATAENTRY']._serialized_start=735 - _globals['_RATELIMITRESP_METADATAENTRY']._serialized_end=794 - _globals['_CLEARRATELIMITREQ']._serialized_start=1099 - _globals['_CLEARRATELIMITREQ']._serialized_end=1169 - _globals['_CLEARRATELIMITRESP']._serialized_start=1171 - _globals['_CLEARRATELIMITRESP']._serialized_end=1266 - _globals['_HEALTHCHECKREQ']._serialized_start=1268 - _globals['_HEALTHCHECKREQ']._serialized_end=1284 - _globals['_HEALTHCHECKRESP']._serialized_start=1286 - _globals['_HEALTHCHECKRESP']._serialized_end=1384 - _globals['_V1']._serialized_start=1623 - _globals['_V1']._serialized_end=1966 + _globals['_RATELIMITREQ']._serialized_start=224 + _globals['_RATELIMITREQ']._serialized_end=622 + _globals['_RATELIMITREQ_METADATAENTRY']._serialized_start=563 + _globals['_RATELIMITREQ_METADATAENTRY']._serialized_end=622 + _globals['_RATELIMITRESP']._serialized_start=625 + _globals['_RATELIMITRESP']._serialized_end=925 + _globals['_RATELIMITRESP_METADATAENTRY']._serialized_start=563 + _globals['_RATELIMITRESP_METADATAENTRY']._serialized_end=622 + _globals['_HEALTHCHECKREQ']._serialized_start=927 + _globals['_HEALTHCHECKREQ']._serialized_end=943 + _globals['_HEALTHCHECKRESP']._serialized_start=945 + _globals['_HEALTHCHECKRESP']._serialized_end=1043 + _globals['_V1']._serialized_start=1282 + _globals['_V1']._serialized_end=1503 # @@protoc_insertion_point(module_scope) diff --git a/python/gubernator/gubernator_pb2_grpc.py b/python/gubernator/gubernator_pb2_grpc.py index 5ceb8747..02dd7792 100644 --- a/python/gubernator/gubernator_pb2_grpc.py +++ b/python/gubernator/gubernator_pb2_grpc.py @@ -19,11 +19,6 @@ def __init__(self, channel): request_serializer=gubernator__pb2.GetRateLimitsReq.SerializeToString, response_deserializer=gubernator__pb2.GetRateLimitsResp.FromString, ) - self.ClearRateLimits = channel.unary_unary( - '/pb.gubernator.V1/ClearRateLimits', - request_serializer=gubernator__pb2.ClearRateLimitsReq.SerializeToString, - response_deserializer=gubernator__pb2.ClearRateLimitsResp.FromString, - ) self.HealthCheck = channel.unary_unary( '/pb.gubernator.V1/HealthCheck', request_serializer=gubernator__pb2.HealthCheckReq.SerializeToString, @@ -41,12 +36,6 @@ def GetRateLimits(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def ClearRateLimits(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - def HealthCheck(self, request, context): """This method is for round trip benchmarking and can be used by the client to determine connectivity to the server @@ -63,11 +52,6 @@ def add_V1Servicer_to_server(servicer, server): request_deserializer=gubernator__pb2.GetRateLimitsReq.FromString, response_serializer=gubernator__pb2.GetRateLimitsResp.SerializeToString, ), - 'ClearRateLimits': grpc.unary_unary_rpc_method_handler( - servicer.ClearRateLimits, - request_deserializer=gubernator__pb2.ClearRateLimitsReq.FromString, - response_serializer=gubernator__pb2.ClearRateLimitsResp.SerializeToString, - ), 'HealthCheck': grpc.unary_unary_rpc_method_handler( servicer.HealthCheck, request_deserializer=gubernator__pb2.HealthCheckReq.FromString, @@ -100,23 +84,6 @@ def GetRateLimits(request, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - @staticmethod - def ClearRateLimits(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/pb.gubernator.V1/ClearRateLimits', - gubernator__pb2.ClearRateLimitsReq.SerializeToString, - gubernator__pb2.ClearRateLimitsResp.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - @staticmethod def HealthCheck(request, target, From 76048b95f28640f36209f151ac4b612d48fdf660 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Fri, 5 Jan 2024 11:13:39 -0500 Subject: [PATCH 15/15] Update README. --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 733a217a..8c457727 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,10 @@ When using Reset Remaining, the `Hits` field should be 0. Users may add behavior `Behavior_DRAIN_OVER_LIMIT` to the rate check request. A `GetRateLimits` call drains the remaining counter on first over limit event. Then, successive `GetRateLimits` calls will return zero remaining counter and -not any residual value. +not any residual value. This behavior works best with token bucket algorithm +because the `Remaining` counter will stay zero after an over limit until reset +time, whereas leaky bucket algorithm will immediately update `Remaining` to a +non-zero value. This facilitates scenarios that require an over limit event to stay over limit until the rate limit resets. This approach is necessary if a process must make