-
Notifications
You must be signed in to change notification settings - Fork 720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server: add gRPC rate limit #6834
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Skipping CI for Draft Pull Request. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #6834 +/- ##
==========================================
- Coverage 74.23% 74.23% -0.01%
==========================================
Files 433 427 -6
Lines 45860 45508 -352
==========================================
- Hits 34046 33784 -262
+ Misses 8802 8741 -61
+ Partials 3012 2983 -29
Flags with carried forward coverage won't be shown. Click here to find out more. |
server/grpc_service.go
Outdated
defer limiter.Release(fName) | ||
} else { | ||
return &pdpb.GetStoreResponse{ | ||
Header: s.wrapErrorToHeader(pdpb.ErrorType_UNKNOWN, errs.ErrReachRateLimit.FastGenByArgs().Error()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we need to define an error type that can let the client to handle it.
@@ -848,6 +871,17 @@ func (s *GrpcServer) PutStore(ctx context.Context, request *pdpb.PutStoreRequest | |||
|
|||
// GetAllStores implements gRPC PDServer. | |||
func (s *GrpcServer) GetAllStores(ctx context.Context, request *pdpb.GetAllStoresRequest) (*pdpb.GetAllStoresResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How abou renaming GetStores
to GetAllStores
in http-api's router.go?
@@ -299,8 +305,8 @@ func CreateServer(ctx context.Context, cfg *config.Config, services []string, le | |||
diagnosticspb.RegisterDiagnosticsServer(gs, s) | |||
// Register the micro services GRPC service. | |||
s.registry.InstallAllGRPCServices(s, gs) | |||
s.grpcServer = gs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When exec initGRPCServiceLabels
, will it fetch the methods of ETCD gRPC server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we only have one gRPC server.
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
1feff7f
to
6696c12
Compare
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
6696c12
to
9b6440a
Compare
/merge |
@nolouch: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 9b6440a
|
@rleungx: Your PR was out of date, I have automatically updated it for you. If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
What problem does this PR solve?
Issue Number: ref #6556. close #5739.
What is changed and how does it work?
This PR adds a gRPC rate limit for some interfaces to prevent wasting lots of resources.
Check List
Tests
Release note