-
Notifications
You must be signed in to change notification settings - Fork 23
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
gRPC server reflection #224
Conversation
e083af7
to
39c5cd7
Compare
8830098
to
f22d8b8
Compare
Server::builder() | ||
.add_service(svc) | ||
.add_service(reflection_service) |
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.
Thinking we may want to add this when not building for target release
. We can check for debug_assertions. Or introduce it as a feature? I guess this isn't meant for a production deployment, right?
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, makes sense. I will give it a try
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.
Implemented as command line option, which defaults to not being exposed.
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.
The downside of this implementation is that the build will include tonic-reflection
crate now. The feature approach could save us doing that. I think it is handier to have a command line option instead of custom compilation to the reflection service working. Let me know what you think,
f22d8b8
to
ece1252
Compare
Signed-off-by: Eguzki Astiz Lezaun <[email protected]>
ece1252
to
80be414
Compare
What
gRPC server reflection provided by tonic-reflection
Opt-in feature to be enabled using
--grpc-reflection-service
command line option.Verification steps
Run
sandbox
dev environmentcd limitador-server/sandbox make build make deploy-in-memory
In a separate shell, inspect the RLS GRPC endpoint. First, let's install grpcurl tool. You need Go SDK 1.8+ installed.
Inspect
RateLimitService
GRPC serviceThe output should be the following
envoy.service.ratelimit.v3.RateLimitService is a service: service RateLimitService { // Determine whether rate limiting should take place. rpc ShouldRateLimit ( .envoy.service.ratelimit.v3.RateLimitRequest ) returns ( .envoy.service.ratelimit.v3.RateLimitResponse ); }
If the reflection API is not available the output looks like
Failed to resolve symbol "envoy.service.ratelimit.v3.RateLimitService": server does not support the reflection API
Make a manual request to the RLS endpoint
The response should be the following:
Let's check that rate limiting is working. The limits file looks like
Thus, the limit is set to max 5 request for 60 seconds. Do repeated requests. you should see
OVER_LIMIT
response after 5 requests.The expected output